mirror of
https://github.com/holub/mame
synced 2025-07-13 13:35:41 +03:00
small update while trying to find a suspected opcode bug
This commit is contained in:
parent
2d3b835e80
commit
c99b5bf4aa
@ -113,7 +113,7 @@ void mn10200_device::refresh_timer(int tmr)
|
||||
int p = m_simple_timer[tmr].mode & 1;
|
||||
|
||||
// enabled, and source is prescaler?
|
||||
if ((m_simple_timer[tmr].mode & 0x82) == 0x82 && m_simple_timer[tmr].cur != 0 && m_prescaler[p].mode & 0x80)
|
||||
if ((m_simple_timer[tmr].mode & 0x82) == 0x82 && m_prescaler[p].mode & 0x80)
|
||||
{
|
||||
attotime period = m_sysclock_base * (m_prescaler[p].base + 1) * (m_simple_timer[tmr].cur + 1);
|
||||
m_timer_timers[tmr]->adjust(period, tmr);
|
||||
@ -152,8 +152,7 @@ int mn10200_device::timer_tick_simple(int tmr)
|
||||
}
|
||||
else
|
||||
{
|
||||
// reload and trigger irq
|
||||
m_simple_timer[tmr].cur = m_simple_timer[tmr].base;
|
||||
// trigger irq
|
||||
m_icrl[1 + (tmr >> 2)] |= (1 << (4 + (tmr & 3)));
|
||||
check_irq();
|
||||
|
||||
@ -166,23 +165,11 @@ TIMER_CALLBACK_MEMBER( mn10200_device::simple_timer_cb )
|
||||
int tmr = param;
|
||||
|
||||
// handle our expiring and also tick our cascaded children
|
||||
switch (timer_tick_simple(tmr))
|
||||
{
|
||||
// cascaded, underflow
|
||||
case 1:
|
||||
m_simple_timer[tmr].cur = m_simple_timer[tmr].base;
|
||||
break;
|
||||
|
||||
// cascaded, no underflow
|
||||
case 2:
|
||||
m_simple_timer[tmr].cur = 0xff;
|
||||
break;
|
||||
|
||||
// no action needed
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (timer_tick_simple(tmr) == 2)
|
||||
m_simple_timer[tmr].cur = 0xff; // cascaded and no underflow occured
|
||||
else
|
||||
m_simple_timer[tmr].cur = m_simple_timer[tmr].base;
|
||||
|
||||
// refresh this timer
|
||||
refresh_timer(tmr);
|
||||
}
|
||||
@ -489,7 +476,7 @@ void mn10200_device::execute_run()
|
||||
// movb dm, (an)
|
||||
case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
|
||||
case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
|
||||
write_mem8(m_a[op>>2&3], m_d[op&3]); // note: typo in manual
|
||||
write_mem8(m_a[op>>2&3], m_d[op&3]); // note: error in manual
|
||||
break;
|
||||
|
||||
// mov (an), dm
|
||||
@ -534,7 +521,7 @@ void mn10200_device::execute_run()
|
||||
m_pc += 1;
|
||||
break;
|
||||
|
||||
// mov dm, dn
|
||||
// mov dn, dm
|
||||
case 0x81: case 0x82: case 0x83: case 0x84: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8b: case 0x8c: case 0x8d: case 0x8e:
|
||||
m_d[op&3] = m_d[op>>2&3];
|
||||
@ -578,13 +565,13 @@ void mn10200_device::execute_run()
|
||||
m_d[op&3] = (UINT8)m_d[op&3];
|
||||
break;
|
||||
|
||||
// mov dn, (imm16)
|
||||
// mov dn, (abs16)
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
write_mem16(read_arg16(m_pc), m_d[op&3]);
|
||||
m_pc += 2;
|
||||
break;
|
||||
|
||||
// movb dn, (imm16)
|
||||
// movb dn, (abs16)
|
||||
case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
write_mem8(read_arg16(m_pc), m_d[op&3]);
|
||||
m_pc += 2;
|
||||
@ -890,52 +877,52 @@ void mn10200_device::execute_run()
|
||||
do_sub(m_a[op&3], m_d[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// mov am, dn
|
||||
// mov dm, an
|
||||
case 0x30:
|
||||
m_a[op&3] = m_d[op>>2&3];
|
||||
break;
|
||||
|
||||
// add am, an
|
||||
// add an, am
|
||||
case 0x40:
|
||||
m_a[op&3] = do_add(m_a[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// sub am, an
|
||||
// sub an, am
|
||||
case 0x50:
|
||||
m_a[op&3] = do_sub(m_a[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// cmp am, an
|
||||
// cmp an, am
|
||||
case 0x60:
|
||||
do_sub(m_a[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// mov am, an
|
||||
// mov an, am
|
||||
case 0x70:
|
||||
m_a[op&3] = m_a[op>>2&3];
|
||||
break;
|
||||
|
||||
// addc dm, dn
|
||||
// addc dn, dm
|
||||
case 0x80:
|
||||
m_d[op&3] = do_add(m_d[op&3], m_d[op>>2&3], (m_psw & FLAG_CF) ? 1 : 0);
|
||||
break;
|
||||
|
||||
// subc dm, dn
|
||||
// subc dn, dm
|
||||
case 0x90:
|
||||
m_d[op&3] = do_sub(m_d[op&3], m_d[op>>2&3], (m_psw & FLAG_CF) ? 1 : 0);
|
||||
break;
|
||||
|
||||
// add am, dn
|
||||
// add an, dm
|
||||
case 0xc0:
|
||||
m_d[op&3] = do_add(m_d[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// sub am, dn
|
||||
// sub an, dm
|
||||
case 0xd0:
|
||||
m_d[op&3] = do_sub(m_d[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// cmp am, dn
|
||||
// cmp an, dm
|
||||
case 0xe0:
|
||||
do_sub(m_d[op&3], m_a[op>>2&3], 0);
|
||||
break;
|
||||
@ -963,19 +950,19 @@ void mn10200_device::execute_run()
|
||||
switch (op)
|
||||
{
|
||||
|
||||
// and dm, dn
|
||||
// and dn, dm
|
||||
case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
test_nz16(m_d[op&3] &= 0xff0000 | m_d[op>>2&3]);
|
||||
break;
|
||||
|
||||
// or dm, dn
|
||||
// or dn, dm
|
||||
case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
|
||||
case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
|
||||
test_nz16(m_d[op&3] |= 0x00ffff & m_d[op>>2&3]);
|
||||
break;
|
||||
|
||||
// xor dm, dn
|
||||
// xor dn, dm
|
||||
case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
|
||||
case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
|
||||
test_nz16(m_d[op&3] ^= 0x00ffff & m_d[op>>2&3]);
|
||||
@ -1086,13 +1073,13 @@ void mn10200_device::execute_run()
|
||||
break;
|
||||
}
|
||||
|
||||
// cmp dm, dn
|
||||
// cmp dn, dm
|
||||
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
|
||||
case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
|
||||
do_sub(m_d[op&3], m_d[op>>2&3], 0);
|
||||
break;
|
||||
|
||||
// mov mdr, dn
|
||||
// mov dn, mdr
|
||||
case 0xc0: case 0xc4: case 0xc8: case 0xcc:
|
||||
m_mdr = m_d[op>>2&3];
|
||||
break;
|
||||
@ -1110,7 +1097,7 @@ void mn10200_device::execute_run()
|
||||
possible_irq = true;
|
||||
break;
|
||||
|
||||
// mov dn, mdr
|
||||
// mov mdr, dn
|
||||
case 0xe0: case 0xe1: case 0xe2: case 0xe3:
|
||||
m_d[op&3] = m_mdr;
|
||||
break;
|
||||
@ -1144,26 +1131,26 @@ void mn10200_device::execute_run()
|
||||
switch (op)
|
||||
{
|
||||
|
||||
// mov dm, (abs24, an)
|
||||
// mov dm, (d24, an)
|
||||
case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
write_mem16(read_arg24(m_pc) + m_a[op>>2&3], m_d[op&3]);
|
||||
break;
|
||||
|
||||
// mov am, (abs24, an)
|
||||
// mov am, (d24, an)
|
||||
case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
|
||||
case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
|
||||
m_cycles -= 1;
|
||||
write_mem24(read_arg24(m_pc) + m_a[op>>2&3], m_a[op&3]);
|
||||
break;
|
||||
|
||||
// movb dm, (abs24, an)
|
||||
// movb dm, (d24, an)
|
||||
case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
|
||||
case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
|
||||
write_mem8(read_arg24(m_pc) + m_a[op>>2&3], m_d[op&3]);
|
||||
break;
|
||||
|
||||
// movx dm, (abs24, an)
|
||||
// movx dm, (d24, an)
|
||||
case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
|
||||
case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
|
||||
m_cycles -= 1;
|
||||
@ -1185,22 +1172,22 @@ void mn10200_device::execute_run()
|
||||
write_mem24(read_arg24(m_pc), m_a[op&3]);
|
||||
break;
|
||||
|
||||
// add abs24, dn
|
||||
// add imm24, dn
|
||||
case 0x60: case 0x61: case 0x62: case 0x63:
|
||||
m_d[op&3] = do_add(m_d[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
|
||||
// add abs24, an
|
||||
// add imm24, an
|
||||
case 0x64: case 0x65: case 0x66: case 0x67:
|
||||
m_a[op&3] = do_add(m_a[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
|
||||
// sub abs24, dn
|
||||
// sub imm24, dn
|
||||
case 0x68: case 0x69: case 0x6a: case 0x6b:
|
||||
m_d[op&3] = do_sub(m_d[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
|
||||
// sub abs24, an
|
||||
// sub imm24, an
|
||||
case 0x6c: case 0x6d: case 0x6e: case 0x6f:
|
||||
m_a[op&3] = do_sub(m_a[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
@ -1215,35 +1202,35 @@ void mn10200_device::execute_run()
|
||||
m_a[op&3] = read_arg24(m_pc);
|
||||
break;
|
||||
|
||||
// cmp abs24, dn
|
||||
// cmp imm24, dn
|
||||
case 0x78: case 0x79: case 0x7a: case 0x7b:
|
||||
do_sub(m_d[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
|
||||
// cmp abs24, an
|
||||
// cmp imm24, an
|
||||
case 0x7c: case 0x7d: case 0x7e: case 0x7f:
|
||||
do_sub(m_a[op&3], read_arg24(m_pc), 0);
|
||||
break;
|
||||
|
||||
// mov (abs24, an), dm
|
||||
// mov (d24, an), dm
|
||||
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
|
||||
m_d[op&3] = (INT16)read_mem16(m_a[op>>2&3] + read_arg24(m_pc));
|
||||
break;
|
||||
|
||||
// movbu (abs24, an), dm
|
||||
// movbu (d24, an), dm
|
||||
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
|
||||
case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
|
||||
m_d[op&3] = read_mem8(m_a[op>>2&3] + read_arg24(m_pc));
|
||||
break;
|
||||
|
||||
// movb (abs24, an), dm
|
||||
// movb (d24, an), dm
|
||||
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
|
||||
m_d[op&3] = (INT8)read_mem8(m_a[op>>2&3] + read_arg24(m_pc));
|
||||
break;
|
||||
|
||||
// movx (abs24, an), dm
|
||||
// movx (d24, an), dm
|
||||
case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
m_cycles -= 1;
|
||||
@ -1270,7 +1257,7 @@ void mn10200_device::execute_run()
|
||||
m_a[op&3] = read_mem24(read_arg24(m_pc));
|
||||
break;
|
||||
|
||||
// jmp imm24
|
||||
// jmp label24
|
||||
case 0xe0:
|
||||
m_cycles -= 1;
|
||||
change_pc(m_pc + read_arg24(m_pc));
|
||||
@ -1282,7 +1269,7 @@ void mn10200_device::execute_run()
|
||||
do_jsr(m_pc + read_arg24(m_pc), m_pc + 3);
|
||||
break;
|
||||
|
||||
// mov (abs24, an), am
|
||||
// mov (d24, an), am
|
||||
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
|
||||
m_cycles -= 1;
|
||||
@ -1536,63 +1523,62 @@ void mn10200_device::execute_run()
|
||||
|
||||
// xor imm16, dn
|
||||
case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
||||
m_cycles -= 1;
|
||||
test_nz16(m_d[op&3] ^= read_arg16(m_pc));
|
||||
break;
|
||||
|
||||
// movbu (imm16, an), dm
|
||||
// movbu (d16, an), dm
|
||||
case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
|
||||
case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
|
||||
m_d[op&3] = read_mem8(m_a[op>>2&3] + (INT16)read_arg16(m_pc));
|
||||
break;
|
||||
|
||||
// movx dm, (imm16, an)
|
||||
// movx dm, (d16, an)
|
||||
case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67:
|
||||
case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
|
||||
m_cycles -= 1;
|
||||
write_mem24(m_a[op>>2&3] + (INT16)read_arg16(m_pc), m_d[op&3]);
|
||||
break;
|
||||
|
||||
// movx (imm16, an), dm
|
||||
// movx (d16, an), dm
|
||||
case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77:
|
||||
case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f:
|
||||
m_cycles -= 1;
|
||||
m_d[op&3] = read_mem24(m_a[op>>2&3] + (INT16)read_arg16(m_pc));
|
||||
break;
|
||||
|
||||
// mov dm, (imm16, an)
|
||||
// mov dm, (d16, an)
|
||||
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
|
||||
write_mem16(m_a[op>>2&3] + (INT16)read_arg16(m_pc), m_d[op&3]);
|
||||
break;
|
||||
|
||||
// movb dm, (imm16, an)
|
||||
// movb dm, (d16, an)
|
||||
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
|
||||
case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
|
||||
write_mem8(m_a[op>>2&3] + (INT16)read_arg16(m_pc), m_d[op&3]);
|
||||
break;
|
||||
|
||||
// mov am, (imm16, an)
|
||||
// mov am, (d16, an)
|
||||
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
|
||||
m_cycles -= 1;
|
||||
write_mem24(m_a[op>>2&3] + (INT16)read_arg16(m_pc), m_a[op&3]);
|
||||
break;
|
||||
|
||||
// mov (imm16, an), am
|
||||
// mov (d16, an), am
|
||||
case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
|
||||
case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
|
||||
m_cycles -= 1;
|
||||
m_a[op&3] = read_mem24(m_a[op>>2&3] + (INT16)read_arg16(m_pc));
|
||||
break;
|
||||
|
||||
// mov (imm16, an), dm
|
||||
// mov (d16, an), dm
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
m_d[op&3] = (INT16)read_mem16(m_a[op>>2&3] + (INT16)read_arg16(m_pc));
|
||||
break;
|
||||
|
||||
// movb (imm16, an), dm
|
||||
// movb (d16, an), dm
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
|
||||
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
|
||||
m_d[op&3] = (INT8)read_mem8(m_a[op>>2&3] + (INT16)read_arg16(m_pc));
|
||||
|
@ -71,8 +71,8 @@ protected:
|
||||
virtual void device_reset();
|
||||
|
||||
// device_execute_interface overrides
|
||||
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 2 - 1) / 2; }
|
||||
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 2); }
|
||||
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 2 - 1) / 2; } // internal /2 divider
|
||||
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 2); } // internal /2 divider
|
||||
virtual UINT32 execute_min_cycles() const { return 1; }
|
||||
virtual UINT32 execute_max_cycles() const { return 13; }
|
||||
virtual UINT32 execute_input_lines() const { return 4; }
|
||||
|
@ -34,9 +34,9 @@ static const char *i8str(INT8 v)
|
||||
{
|
||||
static char res[4];
|
||||
if(v>=0)
|
||||
sprintf(res, "%x", v);
|
||||
sprintf(res, "$%x", v);
|
||||
else
|
||||
sprintf(res, "-%x", (UINT8)(-v));
|
||||
sprintf(res, "-$%x", (UINT8)(-v));
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -44,9 +44,9 @@ static const char *i16str(INT16 v)
|
||||
{
|
||||
static char res[6];
|
||||
if(v>=0)
|
||||
sprintf(res, "%x", v);
|
||||
sprintf(res, "$%x", v);
|
||||
else
|
||||
sprintf(res, "-%x", (UINT16)(-v));
|
||||
sprintf(res, "-$%x", (UINT16)(-v));
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ static const char *i24str(INT32 v)
|
||||
{
|
||||
static char res[8];
|
||||
if(v>=0)
|
||||
sprintf(res, "%x", v);
|
||||
sprintf(res, "$%x", v);
|
||||
else
|
||||
sprintf(res, "-%x", -v);
|
||||
sprintf(res, "-$%x", -v);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -69,7 +69,8 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
sBasePC = pc;
|
||||
|
||||
opcode = program_read_byte(pc);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
sprintf(buffer, "mov d%d, (a%d)", opcode & 3, (opcode>>2) & 3);
|
||||
@ -146,19 +147,19 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 1;
|
||||
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
sprintf(buffer, "mov d%d, (%x)", opcode & 3, r16u(pc+1));
|
||||
sprintf(buffer, "mov d%d, ($%04x)", opcode & 3, r16u(pc+1));
|
||||
return 3;
|
||||
|
||||
case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
sprintf(buffer, "movb d%d, (%04x)", opcode & 3, r16u(pc+1));
|
||||
sprintf(buffer, "movb d%d, ($%04x)", opcode & 3, r16u(pc+1));
|
||||
return 3;
|
||||
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb:
|
||||
sprintf(buffer, "mov (%04x), d%d", r16u(pc+1), opcode & 3);
|
||||
sprintf(buffer, "mov ($%04x), d%d", r16u(pc+1), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
sprintf(buffer, "movbu (%04x), d%d", r16u(pc+1), opcode & 3);
|
||||
sprintf(buffer, "movbu ($%04x), d%d", r16u(pc+1), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3:
|
||||
@ -174,51 +175,51 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 2;
|
||||
|
||||
case 0xdc: case 0xdd: case 0xde: case 0xdf:
|
||||
sprintf(buffer, "move %x, a%d", r16u(pc+1), opcode & 3);
|
||||
sprintf(buffer, "move $%04x, a%d", r16u(pc+1), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0xe0:
|
||||
sprintf(buffer, "blt %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "blt $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe1:
|
||||
sprintf(buffer, "bgt %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bgt $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe2:
|
||||
sprintf(buffer, "bge %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bge $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe3:
|
||||
sprintf(buffer, "ble %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "ble $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe4:
|
||||
sprintf(buffer, "bcs %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bcs $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe5:
|
||||
sprintf(buffer, "bhi %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bhi $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe6:
|
||||
sprintf(buffer, "bcc %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bcc $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe7:
|
||||
sprintf(buffer, "bls %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bls $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe8:
|
||||
sprintf(buffer, "beq %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "beq $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xe9:
|
||||
sprintf(buffer, "bne %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bne $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xea:
|
||||
sprintf(buffer, "bra %x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "bra $%x", (pc+2+(INT8)program_read_byte(pc+1)) & 0xffffff);
|
||||
return 2;
|
||||
|
||||
case 0xeb:
|
||||
@ -226,12 +227,13 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 1;
|
||||
|
||||
case 0xec: case 0xed: case 0xee: case 0xef:
|
||||
sprintf(buffer, "cmp %x, a%d", r16u(pc+1), opcode & 3);
|
||||
sprintf(buffer, "cmp $%04x, a%d", r16u(pc+1), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0xf0:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x04: case 0x08: case 0x0c:
|
||||
sprintf(buffer, "jmp (a%d)", (opcode>>2) & 3);
|
||||
return 2;
|
||||
@ -290,84 +292,83 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xf1:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode>>6) {
|
||||
switch(opcode&0xc0)
|
||||
{
|
||||
case 0x00:
|
||||
sprintf(buffer, "mov (d%d, a%d), a%d", (opcode>>4) & 3, (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x01:
|
||||
case 0x40:
|
||||
sprintf(buffer, "mov (d%d, a%d), d%d", (opcode>>4) & 3, (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x02:
|
||||
case 0x80:
|
||||
sprintf(buffer, "mov a%d, (d%d, a%d)", opcode & 3, (opcode>>4) & 3, (opcode>>2) & 3);
|
||||
return 2;
|
||||
|
||||
case 0x03:
|
||||
case 0xc0:
|
||||
sprintf(buffer, "mov d%d, (d%d, a%d)", opcode & 3, (opcode>>4) & 3, (opcode>>2) & 3);
|
||||
return 2;
|
||||
|
||||
default:
|
||||
goto illegal2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf2:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode>>4) {
|
||||
case 0x0:
|
||||
switch(opcode&0xf0)
|
||||
{
|
||||
case 0x00:
|
||||
sprintf(buffer, "add d%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x1:
|
||||
case 0x10:
|
||||
sprintf(buffer, "sub d%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x2:
|
||||
case 0x20:
|
||||
sprintf(buffer, "cmp d%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x3:
|
||||
case 0x30:
|
||||
sprintf(buffer, "mov d%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x4:
|
||||
case 0x40:
|
||||
sprintf(buffer, "add a%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x5:
|
||||
case 0x50:
|
||||
sprintf(buffer, "sub a%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x6:
|
||||
case 0x60:
|
||||
sprintf(buffer, "cmp a%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x7:
|
||||
case 0x70:
|
||||
sprintf(buffer, "mov a%d, a%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x8:
|
||||
case 0x80:
|
||||
sprintf(buffer, "addc d%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0x9:
|
||||
case 0x90:
|
||||
sprintf(buffer, "subc d%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0xc:
|
||||
case 0xc0:
|
||||
sprintf(buffer, "add a%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0xd:
|
||||
case 0xd0:
|
||||
sprintf(buffer, "sub a%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0xe:
|
||||
case 0xe0:
|
||||
sprintf(buffer, "cmp a%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
case 0xf:
|
||||
case 0xf0:
|
||||
sprintf(buffer, "mov a%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
return 2;
|
||||
|
||||
@ -378,7 +379,8 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xf3:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
sprintf(buffer, "and d%d, d%d", (opcode>>2) & 3, opcode & 3);
|
||||
@ -460,23 +462,24 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xfe:
|
||||
opcode = program_read_byte(pc+2);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
sprintf(buffer, "tbz (%x) %d, %x", r24u(pc+3), opcode & 7,
|
||||
sprintf(buffer, "tbz ($%x) %d, $%x", r24u(pc+3), opcode & 7,
|
||||
(pc+7+(INT8)program_read_byte(pc+6)) & 0xffffff);
|
||||
return 7;
|
||||
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
sprintf(buffer, "tbnz (%x) %d, %x", r24u(pc+3), opcode & 7,
|
||||
sprintf(buffer, "tbnz ($%x) %d, $%x", r24u(pc+3), opcode & 7,
|
||||
(pc+7+(INT8)program_read_byte(pc+6)) & 0xffffff);
|
||||
return 7;
|
||||
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
|
||||
sprintf(buffer, "bset (%x) %d", r24u(pc+2), opcode & 7);
|
||||
sprintf(buffer, "bset ($%x) %d", r24u(pc+2), opcode & 7);
|
||||
return 6;
|
||||
|
||||
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
|
||||
sprintf(buffer, "bclr (%x) %d", r24u(pc+2), opcode & 7);
|
||||
sprintf(buffer, "bclr ($%x) %d", r24u(pc+2), opcode & 7);
|
||||
return 6;
|
||||
|
||||
default:
|
||||
@ -486,10 +489,11 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xff:
|
||||
opcode = program_read_byte(pc+2);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
|
||||
sprintf(buffer, "tbz (%s, a%d) %d, %x", i8str(program_read_byte(pc+3)), 2+((opcode>>3)&1), opcode & 7,
|
||||
sprintf(buffer, "tbz (%s, a%d) %d, $%x", i8str(program_read_byte(pc+3)), 2+((opcode>>3)&1), opcode & 7,
|
||||
(pc+5+(INT8)program_read_byte(pc+4)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
@ -500,7 +504,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
|
||||
sprintf(buffer, "tbnz (%s, a%d) %d, %x", i8str(program_read_byte(pc+3)), 2+((opcode>>3)&1), opcode & 7,
|
||||
sprintf(buffer, "tbnz (%s, a%d) %d, $%x", i8str(program_read_byte(pc+3)), 2+((opcode>>3)&1), opcode & 7,
|
||||
(pc+5+(INT8)program_read_byte(pc+4)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
@ -521,7 +525,8 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xf4:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
sprintf(buffer, "mov d%d, (%s, a%d)", opcode & 3, i24str(r24s(pc+2)), (opcode>>2) & 3);
|
||||
@ -543,25 +548,23 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 5;
|
||||
|
||||
case 0x40: case 0x41: case 0x42: case 0x43:
|
||||
sprintf(buffer, "mov d%d, (%x)", opcode & 3, r24u(pc+2));
|
||||
sprintf(buffer, "mov d%d, ($%06x)", opcode & 3, r24u(pc+2));
|
||||
return 5;
|
||||
|
||||
case 0x44: case 0x45: case 0x46: case 0x47:
|
||||
sprintf(buffer, "movb d%d, (%x)", opcode & 3, r24u(pc+2));
|
||||
sprintf(buffer, "movb d%d, ($%06x)", opcode & 3, r24u(pc+2));
|
||||
return 5;
|
||||
|
||||
#if 0 // huh?
|
||||
case 0x4b:
|
||||
sprintf(buffer, "bset %02x, (%x)", program_read_byte(pc+5), r24u(pc+2));
|
||||
sprintf(buffer, "bset %02x, ($%06x)", program_read_byte(pc+5), r24u(pc+2));
|
||||
return 6;
|
||||
|
||||
case 0x4f:
|
||||
sprintf(buffer, "bclr %02x, (%x)", program_read_byte(pc+5), r24u(pc+2));
|
||||
sprintf(buffer, "bclr %02x, ($%06x)", program_read_byte(pc+5), r24u(pc+2));
|
||||
return 6;
|
||||
#endif
|
||||
|
||||
case 0x50: case 0x51: case 0x52: case 0x53:
|
||||
sprintf(buffer, "mov a%d, (%x)", opcode & 3, r24u(pc+2));
|
||||
sprintf(buffer, "mov a%d, ($%06x)", opcode & 3, r24u(pc+2));
|
||||
return 5;
|
||||
|
||||
case 0x60: case 0x61: case 0x62: case 0x63:
|
||||
@ -585,7 +588,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 5;
|
||||
|
||||
case 0x74: case 0x75: case 0x76: case 0x77:
|
||||
sprintf(buffer, "mov %x, a%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "mov $%06x, a%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0x78: case 0x79: case 0x7a: case 0x7b:
|
||||
@ -593,7 +596,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 5;
|
||||
|
||||
case 0x7c: case 0x7d: case 0x7e: case 0x7f:
|
||||
sprintf(buffer, "cmp %x, a%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "cmp $%06x, a%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
@ -617,43 +620,43 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 5;
|
||||
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||
sprintf(buffer, "mov (%x), d%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "mov ($%06x), d%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
sprintf(buffer, "movb (%x), d%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "movb ($%06x), d%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb:
|
||||
sprintf(buffer, "movbu (%x), d%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "movbu ($%06x), d%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3:
|
||||
sprintf(buffer, "mov (%x), a%d", r24u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "mov ($%06x), a%d", r24u(pc+2), opcode & 3);
|
||||
return 5;
|
||||
|
||||
case 0xe0:
|
||||
sprintf(buffer, "jmp %x", (pc+5+r24s(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "jmp $%x", (pc+5+r24s(pc+2)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
case 0xe1:
|
||||
sprintf(buffer, "jsr %x", (pc+5+r24s(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "jsr $%x", (pc+5+r24s(pc+2)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
case 0xe3:
|
||||
sprintf(buffer, "bset %02x, (%x)", program_read_byte(pc+4), r16u(pc+2));
|
||||
sprintf(buffer, "bset $%02x, ($%x)", program_read_byte(pc+4), r16u(pc+2));
|
||||
return 6;
|
||||
|
||||
case 0xe7:
|
||||
sprintf(buffer, "bclr %02x, (%x)", program_read_byte(pc+4), r16u(pc+2));
|
||||
sprintf(buffer, "bclr $%02x, ($%x)", program_read_byte(pc+4), r16u(pc+2));
|
||||
return 6;
|
||||
|
||||
case 0xe8: case 0xe9: case 0xea: case 0xeb:
|
||||
sprintf(buffer, "bset %02x, (%s, a%d)", program_read_byte(pc+3), i8str(program_read_byte(pc+2)), opcode & 3);
|
||||
sprintf(buffer, "bset $%02x, (%s, a%d)", program_read_byte(pc+3), i8str(program_read_byte(pc+2)), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0xec: case 0xed: case 0xee: case 0xef:
|
||||
sprintf(buffer, "bclr %02x, (%s, a%d)", program_read_byte(pc+3), i8str(program_read_byte(pc+2)), opcode & 3);
|
||||
sprintf(buffer, "bclr $%02x, (%s, a%d)", program_read_byte(pc+3), i8str(program_read_byte(pc+2)), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
@ -668,17 +671,18 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xf5:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x01: case 0x02: case 0x03:
|
||||
sprintf(buffer, "and %02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
sprintf(buffer, "and $%02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
sprintf(buffer, "btst %02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
sprintf(buffer, "btst $%02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b:
|
||||
sprintf(buffer, "or %02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
sprintf(buffer, "or $%02x, d%d", program_read_byte(pc+2), opcode & 3);
|
||||
return 3;
|
||||
|
||||
case 0x0c: case 0x0d: case 0x0e: case 0x0f:
|
||||
@ -701,9 +705,11 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 3;
|
||||
|
||||
case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47:
|
||||
case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f: {
|
||||
case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
||||
{
|
||||
UINT8 opcode2 = program_read_byte(pc+2);
|
||||
switch(opcode2) {
|
||||
switch(opcode2)
|
||||
{
|
||||
case 0x00:
|
||||
sprintf(buffer, "mulql d%d, d%d", (opcode>>3) & 3, opcode & 3);
|
||||
return 3;
|
||||
@ -724,9 +730,11 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 3;
|
||||
|
||||
case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67:
|
||||
case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: {
|
||||
case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
|
||||
{
|
||||
UINT8 opcode2 = program_read_byte(pc+2);
|
||||
switch(opcode2) {
|
||||
switch(opcode2)
|
||||
{
|
||||
case 0x10:
|
||||
sprintf(buffer, "mulq d%d, d%d", (opcode>>3) & 3, opcode & 3);
|
||||
return 3;
|
||||
@ -744,7 +752,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
|
||||
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
|
||||
sprintf(buffer, "tbz (%s, a%d) %d, %x", i8str(program_read_byte(pc+2)), (opcode>>3)&1, opcode & 7,
|
||||
sprintf(buffer, "tbz (%s, a%d) %d, $%x", i8str(program_read_byte(pc+2)), (opcode>>3)&1, opcode & 7,
|
||||
(pc+4+(INT8)program_read_byte(pc+3)) & 0xffffff);
|
||||
return 4;
|
||||
|
||||
@ -755,7 +763,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
|
||||
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
|
||||
sprintf(buffer, "tbnz (%s, a%d) %d, %x", i8str(program_read_byte(pc+2)), (opcode>>3)&1, opcode & 7,
|
||||
sprintf(buffer, "tbnz (%s, a%d) %d, $%x", i8str(program_read_byte(pc+2)), (opcode>>3)&1, opcode & 7,
|
||||
(pc+4+(INT8)program_read_byte(pc+3)) & 0xffffff);
|
||||
return 4;
|
||||
|
||||
@ -765,82 +773,84 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 3;
|
||||
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
sprintf(buffer, "tbz (%x) %d, %x", r16u(pc+2), opcode & 7,
|
||||
sprintf(buffer, "tbz ($%x) %d, $%x", r16u(pc+2), opcode & 7,
|
||||
(pc+5+(INT8)program_read_byte(pc+4)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
sprintf(buffer, "tbnz (%x) %d, %x", r16u(pc+2), opcode & 7,
|
||||
sprintf(buffer, "tbnz ($%x) %d, $%x", r16u(pc+2), opcode & 7,
|
||||
(pc+5+(INT8)program_read_byte(pc+4)) & 0xffffff);
|
||||
return 5;
|
||||
|
||||
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
|
||||
sprintf(buffer, "bset (%x) %d", r16u(pc+2), opcode & 7);
|
||||
sprintf(buffer, "bset ($%x) %d", r16u(pc+2), opcode & 7);
|
||||
return 4;
|
||||
|
||||
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
|
||||
sprintf(buffer, "bclr (%x) %d", r16u(pc+2), opcode & 7);
|
||||
sprintf(buffer, "bclr ($%x) %d", r16u(pc+2), opcode & 7);
|
||||
return 4;
|
||||
|
||||
case 0xe0:
|
||||
sprintf(buffer, "bltx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bltx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe1:
|
||||
sprintf(buffer, "bgtx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bgtx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe2:
|
||||
sprintf(buffer, "bgex %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bgex $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe3:
|
||||
sprintf(buffer, "blex %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "blex $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe4:
|
||||
sprintf(buffer, "bcsx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bcsx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe5:
|
||||
sprintf(buffer, "bhix %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bhix $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe6:
|
||||
sprintf(buffer, "bccx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bccx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe7:
|
||||
sprintf(buffer, "blsx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "blsx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe8:
|
||||
sprintf(buffer, "beqx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "beqx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xe9:
|
||||
sprintf(buffer, "bnex %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bnex $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xec:
|
||||
sprintf(buffer, "bvcx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bvcx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xed:
|
||||
sprintf(buffer, "bvsx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bvsx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xee:
|
||||
sprintf(buffer, "bncx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bncx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xef:
|
||||
sprintf(buffer, "bnsx %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bnsx $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: {
|
||||
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
{
|
||||
UINT8 opcode2 = program_read_byte(pc+2);
|
||||
switch(opcode2) {
|
||||
switch(opcode2)
|
||||
{
|
||||
case 0x04:
|
||||
sprintf(buffer, "mulql %s, d%d", i8str(program_read_byte(pc+3)), opcode & 3);
|
||||
return 4;
|
||||
@ -864,19 +874,19 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
}
|
||||
|
||||
case 0xfc:
|
||||
sprintf(buffer, "bvc %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bvc $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xfd:
|
||||
sprintf(buffer, "bvs %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bvs $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xfe:
|
||||
sprintf(buffer, "bnc %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bnc $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xff:
|
||||
sprintf(buffer, "bns %x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
sprintf(buffer, "bns $%x", (pc+3+(INT8)program_read_byte(pc+2)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
default:
|
||||
@ -890,13 +900,14 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
|
||||
case 0xf7:
|
||||
opcode = program_read_byte(pc+1);
|
||||
switch(opcode) {
|
||||
switch(opcode)
|
||||
{
|
||||
case 0x00: case 0x01: case 0x02: case 0x03:
|
||||
sprintf(buffer, "and %04x, d%d", r16u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "and $%04x, d%d", r16u(pc+2), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
sprintf(buffer, "btst %04x, d%d", r16u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "btst $%04x, d%d", r16u(pc+2), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b:
|
||||
@ -908,11 +919,11 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 4;
|
||||
|
||||
case 0x10:
|
||||
sprintf(buffer, "and %04x, psw", r16u(pc+2));
|
||||
sprintf(buffer, "and $%04x, psw", r16u(pc+2));
|
||||
return 4;
|
||||
|
||||
case 0x14:
|
||||
sprintf(buffer, "or %04x, psw", r16u(pc+2));
|
||||
sprintf(buffer, "or $%04x, psw", r16u(pc+2));
|
||||
return 4;
|
||||
|
||||
case 0x18: case 0x19: case 0x1a: case 0x1b:
|
||||
@ -924,15 +935,15 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 4;
|
||||
|
||||
case 0x20: case 0x21: case 0x22: case 0x23:
|
||||
sprintf(buffer, "move a%d, (%x)", opcode & 3, r16u(pc+2));
|
||||
sprintf(buffer, "mov a%d, ($%04x)", opcode & 3, r16u(pc+2));
|
||||
return 4;
|
||||
|
||||
case 0x30: case 0x31: case 0x32: case 0x33:
|
||||
sprintf(buffer, "move (%x), a%d", r16u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "mov ($%04x), a%d", r16u(pc+2), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0x40: case 0x41: case 0x42: case 0x43:
|
||||
sprintf(buffer, "or %04x, d%d", r16u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "or $%04x, d%d", r16u(pc+2), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0x48: case 0x49: case 0x4a: case 0x4b:
|
||||
@ -940,7 +951,7 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 4;
|
||||
|
||||
case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
||||
sprintf(buffer, "xor %04x, d%d", r16u(pc+2), opcode & 3);
|
||||
sprintf(buffer, "xor $%04x, d%d", r16u(pc+2), opcode & 3);
|
||||
return 4;
|
||||
|
||||
case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
|
||||
@ -998,11 +1009,11 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
return 3;
|
||||
|
||||
case 0xfc:
|
||||
sprintf(buffer, "jmp %x", (pc+3+r16s(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "jmp $%x", (pc+3+r16s(pc+1)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xfd:
|
||||
sprintf(buffer, "jsr %x", (pc+3+r16s(pc+1)) & 0xffffff);
|
||||
sprintf(buffer, "jsr $%x", (pc+3+r16s(pc+1)) & 0xffffff);
|
||||
return 3;
|
||||
|
||||
case 0xfe:
|
||||
@ -1014,15 +1025,15 @@ static int mn102_disassemble(char *buffer, UINT32 pc, const UINT8 *oprom)
|
||||
};
|
||||
|
||||
illegal1:
|
||||
sprintf(buffer, "dc.b %02x", program_read_byte(pc));
|
||||
sprintf(buffer, "dc.b $%02x", program_read_byte(pc));
|
||||
return 1;
|
||||
|
||||
illegal2:
|
||||
sprintf(buffer, "dc.b %02x %02x", program_read_byte(pc), program_read_byte(pc+1));
|
||||
sprintf(buffer, "dc.b $%02x $%02x", program_read_byte(pc), program_read_byte(pc+1));
|
||||
return 2;
|
||||
|
||||
illegal3:
|
||||
sprintf(buffer, "dc.b %02x %02x %02x", program_read_byte(pc), program_read_byte(pc+1), program_read_byte(pc+2));
|
||||
sprintf(buffer, "dc.b $%02x $%02x $%02x", program_read_byte(pc), program_read_byte(pc+1), program_read_byte(pc+2));
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user