diff options
Diffstat (limited to 'src/devices/cpu/unsp/unsp_extended.cpp')
-rw-r--r-- | src/devices/cpu/unsp/unsp_extended.cpp | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/src/devices/cpu/unsp/unsp_extended.cpp b/src/devices/cpu/unsp/unsp_extended.cpp index fa9c3d5a713..28dca6d92e5 100644 --- a/src/devices/cpu/unsp/unsp_extended.cpp +++ b/src/devices/cpu/unsp/unsp_extended.cpp @@ -27,10 +27,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x00: case 0x10: { // Ext Register Ra = Ra op Rb - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rb = (op & 0x000f) >> 0; - uint8_t ra = (op & 0x0e00) >> 9; - ra |= (op & 0x0100) >> 5; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t ra = (ximm & 0x0e00) >> 9; + ra |= (ximm & 0x0100) >> 5; logerror("(Ext) %s = %s %s %s\n", (ra & 0x8) ? extregs[ra & 0x7] : regs[ra & 0x7] , (ra & 0x8) ? extregs[ra & 0x7] : regs[ra & 0x7] @@ -42,16 +42,21 @@ void unsp_20_device::execute_extended_group(uint16_t op) } case 0x02: { + // register decoding could be incorrect here + // Ext Push/Pop - if (op & 0x8000) + if (ximm & 0x8000) { - uint8_t rb = (op & 0x000f) >> 0; - uint8_t size = (op & 0x7000) >> 12; - uint8_t rx = (op & 0x0e00) >> 9; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t size = (ximm & 0x7000) >> 12; + uint8_t rx = (ximm & 0x0e00) >> 9; + + if (size == 0) size = 8; + size -= 1; - if (rx+1 >= size && rx < size+7) + if ((rx-size) >= 0) logerror("(Ext) push %s, %s to [%s]\n", - extregs[rx+1-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]); + extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]); else logerror("(Ext) push <BAD>\n"); @@ -59,16 +64,20 @@ void unsp_20_device::execute_extended_group(uint16_t op) } else { - uint8_t rb = (op & 0x000f) >> 0; - uint8_t size = (op & 0x7000) >> 12; - uint8_t rx = (op & 0x0e00) >> 9; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t size = (ximm & 0x7000) >> 12; + uint8_t rx = (ximm & 0x0e00) >> 9; - if (rx+1 < 8 && rx+size < 8) + if (size == 0) size = 8; + size -= 1; + + if ((rx-size) >= 0) logerror("(Ext) pop %s, %s from [%s]\n", - extregs[rx+1], extregs[rx+size], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]); + extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]); else logerror("(Ext) pop <BAD>\n"); + unimplemented_opcode(op, ximm); } return; @@ -79,10 +88,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) add_lpc(1); // Ra=Rb op IMM16 - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rb = (op & 0x000f) >> 0; - uint8_t ra = (op & 0x0e00) >> 9; - ra |= (op & 0x0100) >> 5; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t ra = (ximm & 0x0e00) >> 9; + ra |= (ximm & 0x0100) >> 5; logerror("(Ext) %s = %s %s %04x\n", (ra & 0x8) ? extregs[ra & 0x7] : regs[ra & 0x7] , (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7] @@ -100,10 +109,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) add_lpc(1); // Ra=Rb op [A16] - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rb = (op & 0x000f) >> 0; - uint8_t ra = (op & 0x0e00) >> 9; - ra |= (op & 0x0100) >> 5; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t ra = (ximm & 0x0e00) >> 9; + ra |= (ximm & 0x0100) >> 5; logerror("(Ext) %s = %s %s [%04x]\n", (ra & 0x8) ? extregs[ra & 0x7] : regs[ra & 0x7] , (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7] @@ -121,10 +130,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) add_lpc(1); //[A16] = Ra op Rb - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rb = (op & 0x000f) >> 0; - uint8_t ra = (op & 0x0e00) >> 9; - ra |= (op & 0x0100) >> 5; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rb = (ximm & 0x000f) >> 0; + uint8_t ra = (ximm & 0x0e00) >> 9; + ra |= (ximm & 0x0100) >> 5; logerror("(Ext) [0x4x] = %s %s %s\n", ximm_2 , (ra & 0x8) ? extregs[ra & 0x7] : regs[ra & 0x7] @@ -138,10 +147,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x08: case 0x09: { // Ext Indirect Rx=Rx op [Ry@] - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t ry = (op & 0x0007) >> 0; - uint8_t form = (op & 0x0018) >> 3; - uint8_t rx = (op & 0x0e00) >> 9; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t ry = (ximm & 0x0007) >> 0; + uint8_t form = (ximm & 0x0018) >> 3; + uint8_t rx = (ximm & 0x0e00) >> 9; logerror("(Ext) %s=%s %s", extregs[rx], extregs[rx], aluops[aluop]); logerror(forms[form], extregs[ry]); @@ -152,10 +161,10 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x0a: case 0x0b: { // Ext DS_Indirect Rx=Rx op ds:[Ry@] - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t ry = (op & 0x0007) >> 0; - uint8_t form = (op & 0x0018) >> 3; - uint8_t rx = (op & 0x0e00) >> 9; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t ry = (ximm & 0x0007) >> 0; + uint8_t form = (ximm & 0x0018) >> 3; + uint8_t rx = (ximm & 0x0e00) >> 9; logerror("(Ext) %s=%s %s ds:", extregs[rx], extregs[rx], aluops[aluop]); logerror(forms[form], extregs[ry]); @@ -166,9 +175,9 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x18: case 0x19: case 0x1a: case 0x1b: { // Ext IM6 Rx=Rx op IM6 - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rx = (op & 0x0e00) >> 9; - uint8_t imm6 = (op & 0x003f) >> 0; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rx = (ximm & 0x0e00) >> 9; + uint8_t imm6 = (ximm & 0x003f) >> 0; logerror("(Ext) %s=%s %s %02x\n", extregs[rx], extregs[rx], aluops[aluop], imm6 ); unimplemented_opcode(op, ximm); @@ -178,9 +187,9 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x0c: case 0x0d: case 0x0e: case 0x0f: { // Ext Base+Disp6 Rx=Rx op [BP+IM6] - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rx = (op & 0x0e00) >> 9; - uint8_t imm6 = (op & 0x003f) >> 0; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rx = (ximm & 0x0e00) >> 9; + uint8_t imm6 = (ximm & 0x003f) >> 0; logerror("(Ext) %s=%s %s [BP+%02x]\n", extregs[rx], extregs[rx], aluops[aluop], imm6 ); unimplemented_opcode(op, ximm); @@ -190,9 +199,9 @@ void unsp_20_device::execute_extended_group(uint16_t op) case 0x1c: case 0x1d: case 0x1e: case 0x1f: { // Ext A6 Rx=Rx op [A6] - uint8_t aluop = (op & 0xf000) >> 12; - uint8_t rx = (op & 0x0e00) >> 9; - uint8_t a6 = (op & 0x003f) >> 0; + uint8_t aluop = (ximm & 0xf000) >> 12; + uint8_t rx = (ximm & 0x0e00) >> 9; + uint8_t a6 = (ximm & 0x003f) >> 0; logerror("(Ext) %s=%s %s [%02x]\n", extregs[rx], extregs[rx], aluops[aluop], a6 ); unimplemented_opcode(op, ximm); |