diff options
Diffstat (limited to 'src/devices/cpu/unsp/unsp_fxxx.cpp')
-rw-r--r-- | src/devices/cpu/unsp/unsp_fxxx.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/devices/cpu/unsp/unsp_fxxx.cpp b/src/devices/cpu/unsp/unsp_fxxx.cpp index d0e4b5b776b..649bc162160 100644 --- a/src/devices/cpu/unsp/unsp_fxxx.cpp +++ b/src/devices/cpu/unsp/unsp_fxxx.cpp @@ -251,7 +251,6 @@ void unsp_12_device::execute_fxxx_101_group(uint16_t op) { m_core->m_icount -= 1; // unknown count uint32_t addr = m_core->m_r[REG_R3] | ((m_core->m_r[REG_R4] & 0x3f) << 16); - add_lpc(1); push(m_core->m_r[REG_PC], &m_core->m_r[REG_SP]); push(m_core->m_r[REG_SR], &m_core->m_r[REG_SP]); m_core->m_r[REG_PC] = addr & 0x0000ffff; @@ -280,12 +279,27 @@ void unsp_12_device::execute_fxxx_101_group(uint16_t op) case 0xf16c: case 0xf36c: case 0xf56c: case 0xf76c: case 0xf96c: case 0xfb6c: case 0xfd6c: case 0xff6c: case 0xf174: case 0xf374: case 0xf574: case 0xf774: case 0xf974: case 0xfb74: case 0xfd74: case 0xff74: case 0xf17c: case 0xf37c: case 0xf57c: case 0xf77c: case 0xf97c: case 0xfb7c: case 0xfd7c: case 0xff7c: + { //unimplemented_opcode(op); // what is this, sign extend / sign expand / zero expand? it doesn't seem to be exponent - logerror("r2 = exp r4 (with r2 = %04x r4 = %04x)\n", m_core->m_r[REG_R2], m_core->m_r[REG_R4]); - m_core->m_r[REG_R2] = 0x0001; // WRONG!! - return; + // palette uploads in smartfp depend on this, however this logic only works for the first few, so isn't correct + uint16_t result = m_core->m_r[REG_R4];// rand(); + uint16_t temp = m_core->m_r[REG_R4]; + + for (int i = 0; i < 16; i++) + { + int bit = (temp << i) & 0x8000; + if (bit) + break; + + result |= 1 << (15 - i); + } + + logerror("pc:%06x: r2 = exp r4 (with r2 = %04x r4 = %04x) (returning %04x)\n", UNSP_LPC, m_core->m_r[REG_R2], m_core->m_r[REG_R4], result); + m_core->m_r[REG_R2] = result; + return; + } default: return unsp_device::execute_fxxx_101_group(op); |