diff options
Diffstat (limited to 'src/devices/cpu/i86/i86.cpp')
-rw-r--r-- | src/devices/cpu/i86/i86.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp index ae68d66b66e..77566cbd9aa 100644 --- a/src/devices/cpu/i86/i86.cpp +++ b/src/devices/cpu/i86/i86.cpp @@ -18,7 +18,7 @@ #define I8086_NMI_INT_VECTOR 2 -const UINT8 i8086_cpu_device::m_i8086_timing[] = +const uint8_t i8086_cpu_device::m_i8086_timing[] = { 51,32, /* exception, IRET */ 2, 0, 4, 2, /* INTs */ @@ -90,14 +90,14 @@ const UINT8 i8086_cpu_device::m_i8086_timing[] = const device_type I8086 = &device_creator<i8086_cpu_device>; const device_type I8088 = &device_creator<i8088_cpu_device>; -i8088_cpu_device::i8088_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +i8088_cpu_device::i8088_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : i8086_cpu_device(mconfig, I8088, "I8088", tag, owner, clock, "i8088", __FILE__, 8) { memcpy(m_timing, m_i8086_timing, sizeof(m_i8086_timing)); m_fetch_xor = 0; } -i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : i8086_common_cpu_device(mconfig, I8086, "I8086", tag, owner, clock, "i8086", __FILE__) , m_program_config("program", ENDIANNESS_LITTLE, 16, 20, 0) , m_io_config("io", ENDIANNESS_LITTLE, 16, 16, 0) @@ -106,24 +106,24 @@ i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, const char *ta m_fetch_xor = BYTE_XOR_LE(0); } -i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int data_bus_size) +i8086_cpu_device::i8086_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, int data_bus_size) : i8086_common_cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_program_config("program", ENDIANNESS_LITTLE, data_bus_size, 20, 0) , m_io_config("io", ENDIANNESS_LITTLE, data_bus_size, 16, 0) { } -UINT8 i8086_cpu_device::fetch_op() +uint8_t i8086_cpu_device::fetch_op() { - UINT8 data; + uint8_t data; data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; } -UINT8 i8086_cpu_device::fetch() +uint8_t i8086_cpu_device::fetch() { - UINT8 data; + uint8_t data; data = m_direct->read_byte(pc(), m_fetch_xor); m_ip++; return data; @@ -189,7 +189,7 @@ void i8086_cpu_device::execute_run() debugger_instruction_hook( this, pc() ); } - UINT8 op = fetch_op(); + uint8_t op = fetch_op(); switch(op) { @@ -200,7 +200,7 @@ void i8086_cpu_device::execute_run() case 0xd2: // i_rotshft_bcl { - UINT8 c; + uint8_t c; m_modrm = fetch(); m_src = GetRMByte(); @@ -227,7 +227,7 @@ void i8086_cpu_device::execute_run() case 0xd3: // i_rotshft_wcl { - UINT8 c; + uint8_t c; m_modrm = fetch(); m_src = GetRMWord(); @@ -277,7 +277,7 @@ void i8086_cpu_device::device_start() state_add(STATE_GENPCBASE, "CURPC", m_pc).callexport().formatstr("%05X"); } -i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) +i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) , m_ip(0) , m_TF(0) @@ -293,23 +293,23 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig, static const BREGS reg_name[8]={ AL, CL, DL, BL, AH, CH, DH, BH }; /* Set up parity lookup table. */ - for (UINT16 i = 0;i < 256; i++) + for (uint16_t i = 0;i < 256; i++) { - UINT16 c = 0; - for (UINT16 j = i; j > 0; j >>= 1) + uint16_t c = 0; + for (uint16_t j = i; j > 0; j >>= 1) { if (j & 1) c++; } m_parity_table[i] = !(c & 1); } - for (UINT16 i = 0; i < 256; i++) + for (uint16_t i = 0; i < 256; i++) { m_Mod_RM.reg.b[i] = reg_name[(i & 0x38) >> 3]; m_Mod_RM.reg.w[i] = (WREGS) ( (i & 0x38) >> 3) ; } - for (UINT16 i = 0xc0; i < 0x100; i++) + for (uint16_t i = 0xc0; i < 0x100; i++) { m_Mod_RM.RM.w[i] = (WREGS)( i & 7 ); m_Mod_RM.RM.b[i] = (BREGS)reg_name[i & 7]; @@ -330,7 +330,7 @@ void i8086_common_cpu_device::state_string_export(const device_state_entry &entr case STATE_GENFLAGS: { - UINT16 flags = CompressFlags(); + uint16_t flags = CompressFlags(); str = string_format("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? '1':'.', flags & 0x4000 ? '1':'.', @@ -466,8 +466,8 @@ void i8086_common_cpu_device::interrupt(int int_num, int trap) m_pending_irq &= ~INT_IRQ; } - UINT16 dest_off = read_word( int_num * 4 + 0 ); - UINT16 dest_seg = read_word( int_num * 4 + 2 ); + uint16_t dest_off = read_word( int_num * 4 + 0 ); + uint16_t dest_seg = read_word( int_num * 4 + 2 ); PUSH(m_sregs[CS]); PUSH(m_ip); @@ -508,33 +508,33 @@ void i8086_common_cpu_device::execute_set_input( int inptnum, int state ) } } -offs_t i8086_common_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) +offs_t i8086_common_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { - extern int i386_dasm_one(char *buffer, offs_t eip, const UINT8 *oprom, int mode); + extern int i386_dasm_one(char *buffer, offs_t eip, const uint8_t *oprom, int mode); return i386_dasm_one(buffer, pc, oprom, 1); } -UINT8 i8086_common_cpu_device::read_port_byte(UINT16 port) +uint8_t i8086_common_cpu_device::read_port_byte(uint16_t port) { return m_io->read_byte(port); } -UINT16 i8086_common_cpu_device::read_port_word(UINT16 port) +uint16_t i8086_common_cpu_device::read_port_word(uint16_t port) { return m_io->read_word_unaligned(port); } -void i8086_common_cpu_device::write_port_byte(UINT16 port, UINT8 data) +void i8086_common_cpu_device::write_port_byte(uint16_t port, uint8_t data) { m_io->write_byte(port, data); } -void i8086_common_cpu_device::write_port_word(UINT16 port, UINT16 data) +void i8086_common_cpu_device::write_port_word(uint16_t port, uint16_t data) { m_io->write_word_unaligned(port, data); } -UINT32 i8086_common_cpu_device::calc_addr(int seg, UINT16 offset, int size, int op, bool override) +uint32_t i8086_common_cpu_device::calc_addr(int seg, uint16_t offset, int size, int op, bool override) { if ( m_seg_prefix && (seg==DS || seg==SS) && override ) { @@ -546,7 +546,7 @@ UINT32 i8086_common_cpu_device::calc_addr(int seg, UINT16 offset, int size, int } } -bool i8086_common_cpu_device::common_op(UINT8 op) +bool i8086_common_cpu_device::common_op(uint8_t op) { switch(op) { @@ -653,7 +653,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) { DEF_br8(); m_src += CF ? 1 : 0; - UINT32 tmpcf = ADDB(); + uint32_t tmpcf = ADDB(); PutbackRMByte(m_dst); set_CFB(tmpcf); CLKM(ALU_RR8,ALU_MR8); @@ -663,7 +663,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) { DEF_wr16(); m_src += CF ? 1 : 0; - UINT32 tmpcf = ADDX(); + uint32_t tmpcf = ADDX(); PutbackRMWord(m_dst); set_CFW(tmpcf); CLKM(ALU_RR16,ALU_MR16); @@ -715,7 +715,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x18: // i_sbb_br8 { - UINT32 tmpcf; + uint32_t tmpcf; DEF_br8(); m_src += CF ? 1 : 0; tmpcf = SUBB(); @@ -727,7 +727,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x19: // i_sbb_wr16 { - UINT32 tmpcf; + uint32_t tmpcf; DEF_wr16(); m_src += CF ? 1 : 0; tmpcf = SUBX(); @@ -1243,7 +1243,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x80: // i_80pre { - UINT32 tmpcf; + uint32_t tmpcf; m_modrm = fetch(); m_dst = GetRMByte(); m_src = fetch(); @@ -1267,7 +1267,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x81: // i_81pre { - UINT32 tmpcf; + uint32_t tmpcf; m_modrm = fetch(); m_dst = GetRMWord(); m_src = fetch_word(); @@ -1291,10 +1291,10 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x82: // i_82pre { - UINT32 tmpcf; + uint32_t tmpcf; m_modrm = fetch(); m_dst = GetRMByte(); - m_src = (INT8)fetch(); + m_src = (int8_t)fetch(); if (m_modrm >=0xc0 ) { CLK(ALU_RI8); } else if ((m_modrm & 0x38)==0x38) { CLK(ALU_MI8_RO); } else { CLK(ALU_MI8); } @@ -1315,10 +1315,10 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x83: // i_83pre { - UINT32 tmpcf; + uint32_t tmpcf; m_modrm = fetch(); m_dst = GetRMWord(); - m_src = (UINT16)((INT16)((INT8)fetch())); + m_src = (uint16_t)((int16_t)((int8_t)fetch())); if (m_modrm >=0xc0 ) { CLK(ALU_R16I8); } else if ((m_modrm & 0x38)==0x38) { CLK(ALU_M16I8_RO); } else { CLK(ALU_M16I8); } @@ -1471,8 +1471,8 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x9a: // i_call_far { - UINT16 tmp = fetch_word(); - UINT16 tmp2 = fetch_word(); + uint16_t tmp = fetch_word(); + uint16_t tmp2 = fetch_word(); PUSH(m_sregs[CS]); PUSH(m_ip); m_ip = tmp; @@ -1503,7 +1503,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x9e: // i_sahf { - UINT32 tmp = (CompressFlags() & 0xff00) | (m_regs.b[AH] & 0xd5); + uint32_t tmp = (CompressFlags() & 0xff00) | (m_regs.b[AH] & 0xd5); ExpandFlags(tmp); CLK(SAHF); } @@ -1517,7 +1517,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xa0: // i_mov_aldisp { - UINT32 addr = fetch_word(); + uint32_t addr = fetch_word(); m_regs.b[AL] = GetMemB(DS, addr); CLK(MOV_AM8); } @@ -1525,7 +1525,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xa1: // i_mov_axdisp { - UINT32 addr = fetch_word(); + uint32_t addr = fetch_word(); m_regs.w[AX] = GetMemW(DS, addr); CLK(MOV_AM16); } @@ -1533,7 +1533,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xa2: // i_mov_dispal { - UINT32 addr = fetch_word(); + uint32_t addr = fetch_word(); PutMemB(DS, addr, m_regs.b[AL]); CLK(MOV_MA8); } @@ -1541,7 +1541,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xa3: // i_mov_dispax { - UINT32 addr = fetch_word(); + uint32_t addr = fetch_word(); PutMemW(DS, addr, m_regs.w[AX]); CLK(MOV_MA16); } @@ -1693,7 +1693,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xc0: // 0xc0 is 0xc2 - see (*) case 0xc2: // i_ret_d16 { - UINT32 count = fetch_word(); + uint32_t count = fetch_word(); m_ip = POP(); m_regs.w[SP] += count; CLK(RET_NEAR_IMM); @@ -1735,7 +1735,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xc8: // 0xc8 = 0xca - see (*) case 0xca: // i_retf_d16 { - UINT32 count = fetch_word(); + uint32_t count = fetch_word(); m_ip = POP(); m_sregs[CS] = POP(); m_regs.w[SP] += count; @@ -1815,7 +1815,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xd4: // i_aam { - UINT8 base = fetch(); + uint8_t base = fetch(); if(!base) { interrupt(0); @@ -1830,7 +1830,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xd5: // i_aad { - UINT8 base = fetch(); + uint8_t base = fetch(); m_regs.b[AL] = m_regs.b[AH] * base + m_regs.b[AL]; m_regs.b[AH] = 0; set_SZPF_Byte(m_regs.b[AL]); @@ -1865,7 +1865,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe0: // i_loopne { - INT8 disp = (INT8)fetch(); + int8_t disp = (int8_t)fetch(); m_regs.w[CX]--; if (!ZF && m_regs.w[CX]) @@ -1880,7 +1880,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe1: // i_loope { - INT8 disp = (INT8)fetch(); + int8_t disp = (int8_t)fetch(); m_regs.w[CX]--; if (ZF && m_regs.w[CX]) @@ -1895,7 +1895,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe2: // i_loop { - INT8 disp = (INT8)fetch(); + int8_t disp = (int8_t)fetch(); m_regs.w[CX]--; if (m_regs.w[CX]) @@ -1910,7 +1910,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe3: // i_jcxz { - INT8 disp = (INT8)fetch(); + int8_t disp = (int8_t)fetch(); if (m_regs.w[CX] == 0) { @@ -1931,7 +1931,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe5: // i_inax { - UINT8 port = fetch(); + uint8_t port = fetch(); m_regs.w[AX] = read_port_word(port); CLK(IN_IMM16); @@ -1945,7 +1945,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe7: // i_outax { - UINT8 port = fetch(); + uint8_t port = fetch(); write_port_word(port, m_regs.w[AX]); CLK(OUT_IMM16); @@ -1955,7 +1955,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe8: // i_call_d16 { - INT16 tmp = (INT16)fetch_word(); + int16_t tmp = (int16_t)fetch_word(); PUSH(m_ip); m_ip = m_ip + tmp; @@ -1965,7 +1965,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xe9: // i_jmp_d16 { - INT16 offset = (INT16)fetch_word(); + int16_t offset = (int16_t)fetch_word(); m_ip += offset; CLK(JMP_NEAR); } @@ -1973,8 +1973,8 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xea: // i_jmp_far { - UINT16 tmp = fetch_word(); - UINT16 tmp1 = fetch_word(); + uint16_t tmp = fetch_word(); + uint16_t tmp1 = fetch_word(); m_sregs[CS] = tmp1; m_ip = tmp; @@ -1984,14 +1984,14 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xeb: // i_jmp_d8 { - int tmp = (int)((INT8)fetch()); + int tmp = (int)((int8_t)fetch()); CLK(JMP_SHORT); if (tmp==-2 && m_no_interrupt==0 && (m_pending_irq==0) && m_icount>0) { m_icount%=12; /* cycle skip */ } - m_ip = (UINT16)(m_ip+tmp); + m_ip = (uint16_t)(m_ip+tmp); } break; @@ -2002,7 +2002,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xed: // i_inaxdx { - UINT32 port = m_regs.w[DX]; + uint32_t port = m_regs.w[DX]; m_regs.w[AX] = read_port_word(port); CLK(IN_DX16); @@ -2016,7 +2016,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xef: // i_outdxax { - UINT32 port = m_regs.w[DX]; + uint32_t port = m_regs.w[DX]; write_port_word(port, m_regs.w[AX]); CLK(OUT_DX16); @@ -2035,8 +2035,8 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xf2: // i_repne { bool invalid = false; - UINT8 next = repx_op(); - UINT16 c = m_regs.w[CX]; + uint8_t next = repx_op(); + uint16_t c = m_regs.w[CX]; switch (next) { @@ -2068,8 +2068,8 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xf3: // i_repe { bool invalid = false; - UINT8 next = repx_op(); - UINT16 c = m_regs.w[CX]; + uint8_t next = repx_op(); + uint16_t c = m_regs.w[CX]; switch (next) { @@ -2111,9 +2111,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xf6: // i_f6pre { - UINT32 tmp; - UINT32 uresult,uresult2; - INT32 result,result2; + uint32_t tmp; + uint32_t uresult,uresult2; + int32_t result,result2; m_modrm = fetch(); tmp = GetRMByte(); @@ -2139,14 +2139,14 @@ bool i8086_common_cpu_device::common_op(UINT8 op) break; case 0x20: /* MUL */ uresult = m_regs.b[AL] * tmp; - m_regs.w[AX] = (UINT16)uresult; + m_regs.w[AX] = (uint16_t)uresult; m_CarryVal = m_OverVal = (m_regs.b[AH]!=0) ? 1 : 0; set_ZF(m_regs.w[AX]); CLKM(MUL_R8,MUL_M8); break; case 0x28: /* IMUL */ - result = (INT16)((INT8)m_regs.b[AL])*(INT16)((INT8)tmp); - m_regs.w[AX] = (UINT16)result; + result = (int16_t)((int8_t)m_regs.b[AL])*(int16_t)((int8_t)tmp); + m_regs.w[AX] = (uint16_t)result; m_CarryVal = m_OverVal = (m_regs.b[AH]!=0) ? 1 : 0; set_ZF(m_regs.w[AX]); CLKM(IMUL_R8,IMUL_M8); @@ -2175,9 +2175,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x38: /* IDIV */ if (tmp) { - result = (INT16)m_regs.w[AX]; - result2 = result % (INT16)((INT8)tmp); - if ((result /= (INT16)((INT8)tmp)) > 0xff) + result = (int16_t)m_regs.w[AX]; + result2 = result % (int16_t)((int8_t)tmp); + if ((result /= (int16_t)((int8_t)tmp)) > 0xff) { interrupt(0); } @@ -2200,9 +2200,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xf7: // i_f7pre { - UINT32 tmp,tmp2; - UINT32 uresult,uresult2; - INT32 result,result2; + uint32_t tmp,tmp2; + uint32_t uresult,uresult2; + int32_t result,result2; m_modrm = fetch(); tmp = GetRMWord(); @@ -2230,13 +2230,13 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x20: /* MUL */ uresult = m_regs.w[AX]*tmp; m_regs.w[AX] = uresult & 0xffff; - m_regs.w[DX] = ((UINT32)uresult)>>16; + m_regs.w[DX] = ((uint32_t)uresult)>>16; m_CarryVal = m_OverVal = (m_regs.w[DX] != 0) ? 1 : 0; set_ZF(m_regs.w[AX] | m_regs.w[DX]); CLKM(MUL_R16,MUL_M16); break; case 0x28: /* IMUL */ - result = (INT32)((INT16)m_regs.w[AX]) * (INT32)((INT16)tmp); + result = (int32_t)((int16_t)m_regs.w[AX]) * (int32_t)((int16_t)tmp); m_regs.w[AX] = result & 0xffff; m_regs.w[DX] = result >> 16; m_CarryVal = m_OverVal = (m_regs.w[DX] != 0) ? 1 : 0; @@ -2246,7 +2246,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x30: /* DIV */ if (tmp) { - uresult = (((UINT32)m_regs.w[DX]) << 16) | m_regs.w[AX]; + uresult = (((uint32_t)m_regs.w[DX]) << 16) | m_regs.w[AX]; uresult2 = uresult % tmp; if ((uresult /= tmp) > 0xffff) { @@ -2267,9 +2267,9 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0x38: /* IDIV */ if (tmp) { - result = ((UINT32)m_regs.w[DX] << 16) + m_regs.w[AX]; - result2 = result % (INT32)((INT16)tmp); - if ((result /= (INT32)((INT16)tmp)) > 0xffff) + result = ((uint32_t)m_regs.w[DX] << 16) + m_regs.w[AX]; + result2 = result % (int32_t)((int16_t)tmp); + if ((result /= (int32_t)((int16_t)tmp)) > 0xffff) { interrupt(0); } @@ -2322,7 +2322,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xfe: // i_fepre { - UINT32 tmp, tmp1; + uint32_t tmp, tmp1; m_modrm = fetch(); tmp = GetRMByte(); switch ( m_modrm & 0x38 ) @@ -2352,7 +2352,7 @@ bool i8086_common_cpu_device::common_op(UINT8 op) case 0xff: // i_ffpre { - UINT32 tmp, tmp1; + uint32_t tmp, tmp1; m_modrm = fetch(); tmp = GetRMWord(); switch ( m_modrm & 0x38 ) |