diff options
Diffstat (limited to 'src/devices/cpu/m6809')
-rw-r--r-- | src/devices/cpu/m6809/6309dasm.cpp | 28 | ||||
-rw-r--r-- | src/devices/cpu/m6809/6809dasm.cpp | 24 | ||||
-rw-r--r-- | src/devices/cpu/m6809/base6x09.ops | 56 | ||||
-rw-r--r-- | src/devices/cpu/m6809/hd6309.cpp | 92 | ||||
-rw-r--r-- | src/devices/cpu/m6809/hd6309.h | 32 | ||||
-rw-r--r-- | src/devices/cpu/m6809/hd6309.ops | 44 | ||||
-rw-r--r-- | src/devices/cpu/m6809/konami.cpp | 44 | ||||
-rw-r--r-- | src/devices/cpu/m6809/konami.h | 26 | ||||
-rw-r--r-- | src/devices/cpu/m6809/konami.ops | 32 | ||||
-rw-r--r-- | src/devices/cpu/m6809/m6809.cpp | 40 | ||||
-rw-r--r-- | src/devices/cpu/m6809/m6809.h | 120 | ||||
-rw-r--r-- | src/devices/cpu/m6809/m6809.ops | 16 | ||||
-rw-r--r-- | src/devices/cpu/m6809/m6809inl.h | 32 |
13 files changed, 293 insertions, 293 deletions
diff --git a/src/devices/cpu/m6809/6309dasm.cpp b/src/devices/cpu/m6809/6309dasm.cpp index 47637e22472..16f4c3b1752 100644 --- a/src/devices/cpu/m6809/6309dasm.cpp +++ b/src/devices/cpu/m6809/6309dasm.cpp @@ -29,10 +29,10 @@ // Opcode structure struct opcodeinfo { - UINT8 opcode; // 8-bit opcode value - UINT8 length; // Opcode length in bytes + uint8_t opcode; // 8-bit opcode value + uint8_t length; // Opcode length in bytes char name[6]; // Opcode name - UINT8 mode; // Addressing mode + uint8_t mode; // Addressing mode unsigned flags; // Disassembly flags }; @@ -608,8 +608,8 @@ static const char *const tfm_s[] = { "%s+,%s+", "%s-,%s-", "%s+,%s", "%s,%s+" }; CPU_DISASSEMBLE( hd6309 ) { - UINT8 opcode, mode, pb, pbm, reg; - const UINT8 *operandarray; + uint8_t opcode, mode, pb, pbm, reg; + const uint8_t *operandarray; unsigned int ea, flags; int numoperands, offset, indirect; @@ -712,12 +712,12 @@ CPU_DISASSEMBLE( hd6309 ) break; case REL: - offset = (INT8)operandarray[0]; + offset = (int8_t)operandarray[0]; buffer += sprintf(buffer, "$%04X", (pc + offset) & 0xffff); break; case LREL: - offset = (INT16)((operandarray[0] << 8) + operandarray[1]); + offset = (int16_t)((operandarray[0] << 8) + operandarray[1]); buffer += sprintf(buffer, "$%04X", (pc + offset) & 0xffff); break; @@ -766,7 +766,7 @@ CPU_DISASSEMBLE( hd6309 ) buffer += sprintf(buffer, ",W"); break; case 0x01: - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,W", (offset < 0) ? -offset : offset); @@ -815,14 +815,14 @@ CPU_DISASSEMBLE( hd6309 ) break; case 0x88: // (+/- 7 bit offset),R - offset = (INT8)opram[p++]; + offset = (int8_t)opram[p++]; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%02X,", (offset < 0) ? -offset : offset); buffer += sprintf(buffer, "%s", hd6309_regs[reg]); break; case 0x89: // (+/- 15 bit offset),R - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,", (offset < 0) ? -offset : offset); @@ -838,13 +838,13 @@ CPU_DISASSEMBLE( hd6309 ) break; case 0x8c: // (+/- 7 bit offset),PC - offset = (INT8)opram[p++]; + offset = (int8_t)opram[p++]; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%02X,PC", (offset < 0) ? -offset : offset); break; case 0x8d: // (+/- 15 bit offset),PC - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,PC", (offset < 0) ? -offset : offset); @@ -857,7 +857,7 @@ CPU_DISASSEMBLE( hd6309 ) case 0x8f: // address or operations relative to W if (indirect) { - ea = (UINT16)((opram[p+0] << 8) + opram[p+1]); + ea = (uint16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "$%04X", ea); break; @@ -870,7 +870,7 @@ CPU_DISASSEMBLE( hd6309 ) buffer += sprintf(buffer, ",W"); break; case 0x01: - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,W", (offset < 0) ? -offset : offset); diff --git a/src/devices/cpu/m6809/6809dasm.cpp b/src/devices/cpu/m6809/6809dasm.cpp index b2f3f44a7bb..971abc9b2a8 100644 --- a/src/devices/cpu/m6809/6809dasm.cpp +++ b/src/devices/cpu/m6809/6809dasm.cpp @@ -25,10 +25,10 @@ // Opcode structure struct opcodeinfo { - UINT8 opcode; // 8-bit opcode value - UINT8 length; // Opcode length in bytes + uint8_t opcode; // 8-bit opcode value + uint8_t length; // Opcode length in bytes char name[6]; // Opcode name - UINT8 mode; // Addressing mode + uint8_t mode; // Addressing mode unsigned flags; // Disassembly flags }; @@ -368,8 +368,8 @@ static const char *const m6809_regs_te[16] = CPU_DISASSEMBLE( m6809 ) { - UINT8 opcode, mode, pb, pbm, reg; - const UINT8 *operandarray; + uint8_t opcode, mode, pb, pbm, reg; + const uint8_t *operandarray; unsigned int ea, flags; int numoperands, offset, indirect; int i, p = 0, page = 0, opcode_found; @@ -467,12 +467,12 @@ CPU_DISASSEMBLE( m6809 ) break; case REL: - offset = (INT8)operandarray[0]; + offset = (int8_t)operandarray[0]; buffer += sprintf(buffer, "$%04X", (pc + offset) & 0xffff); break; case LREL: - offset = (INT16)((operandarray[0] << 8) + operandarray[1]); + offset = (int16_t)((operandarray[0] << 8) + operandarray[1]); buffer += sprintf(buffer, "$%04X", (pc + offset) & 0xffff); break; @@ -532,14 +532,14 @@ CPU_DISASSEMBLE( m6809 ) break; case 0x88: // (+/- 7 bit offset),R - offset = (INT8)opram[p++]; + offset = (int8_t)opram[p++]; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%02X,", (offset < 0) ? -offset : offset); buffer += sprintf(buffer, "%s", m6809_regs[reg]); break; case 0x89: // (+/- 15 bit offset),R - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,", (offset < 0) ? -offset : offset); @@ -555,13 +555,13 @@ CPU_DISASSEMBLE( m6809 ) break; case 0x8c: // (+/- 7 bit offset),PC - offset = (INT8)opram[p++]; + offset = (int8_t)opram[p++]; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%02X,PC", (offset < 0) ? -offset : offset); break; case 0x8d: // (+/- 15 bit offset),PC - offset = (INT16)((opram[p+0] << 8) + opram[p+1]); + offset = (int16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "%s", (offset < 0) ? "-" : ""); buffer += sprintf(buffer, "$%04X,PC", (offset < 0) ? -offset : offset); @@ -572,7 +572,7 @@ CPU_DISASSEMBLE( m6809 ) break; case 0x8f: // address - ea = (UINT16)((opram[p+0] << 8) + opram[p+1]); + ea = (uint16_t)((opram[p+0] << 8) + opram[p+1]); p += 2; buffer += sprintf(buffer, "$%04X", ea); break; diff --git a/src/devices/cpu/m6809/base6x09.ops b/src/devices/cpu/m6809/base6x09.ops index c9fccad7d38..8a36ecf2b78 100644 --- a/src/devices/cpu/m6809/base6x09.ops +++ b/src/devices/cpu/m6809/base6x09.ops @@ -50,7 +50,7 @@ INTERRUPT_VECTOR: NEG8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags(CC_NZVC, (UINT8)0, m_temp.b.l, -m_temp.b.l); + m_temp.b.l = set_flags(CC_NZVC, (uint8_t)0, m_temp.b.l, -m_temp.b.l); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; @@ -59,7 +59,7 @@ COM8: @m_temp.b.l = read_operand(); m_cc &= ~CC_V; m_cc |= CC_C; - m_temp.b.l = set_flags(CC_NZ, (UINT8) ~m_temp.b.l); + m_temp.b.l = set_flags(CC_NZ, (uint8_t) ~m_temp.b.l); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; @@ -68,14 +68,14 @@ LSR8: @m_temp.b.l = read_operand(); m_cc &= ~CC_C; m_cc |= (m_temp.b.l & 1) ? CC_C : 0; - m_temp.b.l = set_flags<UINT8>(CC_NZ, m_temp.b.l >> 1); + m_temp.b.l = set_flags<uint8_t>(CC_NZ, m_temp.b.l >> 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; ROR8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZ, rotate_right(m_temp.b.l)); + m_temp.b.l = set_flags<uint8_t>(CC_NZ, rotate_right(m_temp.b.l)); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; @@ -84,35 +84,35 @@ ASR8: @m_temp.b.l = read_operand(); m_cc &= ~CC_NZC; m_cc |= (m_temp.b.l & 1) ? CC_C : 0; - m_temp.b.l = set_flags<UINT8>(CC_NZ, ((INT8) m_temp.b.l) >> 1); + m_temp.b.l = set_flags<uint8_t>(CC_NZ, ((int8_t) m_temp.b.l) >> 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; ASL8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZVC, m_temp.b.l, m_temp.b.l, m_temp.b.l << 1); + m_temp.b.l = set_flags<uint8_t>(CC_NZVC, m_temp.b.l, m_temp.b.l, m_temp.b.l << 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; ROL8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZV, m_temp.b.l, m_temp.b.l, rotate_left(m_temp.b.l)); + m_temp.b.l = set_flags<uint8_t>(CC_NZV, m_temp.b.l, m_temp.b.l, rotate_left(m_temp.b.l)); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; DEC8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZV, m_temp.b.l, 1, m_temp.b.l - 1); + m_temp.b.l = set_flags<uint8_t>(CC_NZV, m_temp.b.l, 1, m_temp.b.l - 1); @eat(hd6309_native_mode() && is_register_addressing_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; INC8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZV, m_temp.b.l, 1, m_temp.b.l + 1); + m_temp.b.l = set_flags<uint8_t>(CC_NZV, m_temp.b.l, 1, m_temp.b.l + 1); @eat(hd6309_native_mode() && is_register_addressing_mode() ? 0 : 1); @write_operand(m_temp.b.l); return; @@ -139,7 +139,7 @@ CLR8: NEG16: m_temp.b.h = read_operand(0); m_temp.b.l = read_operand(1); - m_temp.w = set_flags(CC_NZVC, (UINT16)0, m_temp.w, -m_temp.w); + m_temp.w = set_flags(CC_NZVC, (uint16_t)0, m_temp.w, -m_temp.w); eat(hd6309_native_mode() ? 0 : 1); write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -150,7 +150,7 @@ LSR16: @m_temp.b.l = read_operand(1); m_cc &= ~CC_C; m_cc |= (m_temp.w & 1) ? CC_C : 0; - m_temp.w = set_flags<UINT16>(CC_NZ, m_temp.w >> 1); + m_temp.w = set_flags<uint16_t>(CC_NZ, m_temp.w >> 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -159,7 +159,7 @@ LSR16: ROR16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZ, rotate_right(m_temp.w)); + m_temp.w = set_flags<uint16_t>(CC_NZ, rotate_right(m_temp.w)); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -170,7 +170,7 @@ ASR16: @m_temp.b.l = read_operand(1); m_cc &= ~CC_NZC; m_cc |= (m_temp.w & 1) ? CC_C : 0; - m_temp.w = set_flags<UINT16>(CC_NZ, ((INT16) m_temp.w) >> 1); + m_temp.w = set_flags<uint16_t>(CC_NZ, ((int16_t) m_temp.w) >> 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -179,7 +179,7 @@ ASR16: ASL16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZVC, m_temp.w, m_temp.w, m_temp.w << 1); + m_temp.w = set_flags<uint16_t>(CC_NZVC, m_temp.w, m_temp.w, m_temp.w << 1); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -188,7 +188,7 @@ ASL16: ROL16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZV, rotate_left(m_temp.w)); + m_temp.w = set_flags<uint16_t>(CC_NZV, rotate_left(m_temp.w)); @eat(hd6309_native_mode() ? 0 : 1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -197,7 +197,7 @@ ROL16: DEC16: m_temp.b.h = read_operand(0); m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZVC, m_temp.w, 1, m_temp.w - 1); + m_temp.w = set_flags<uint16_t>(CC_NZVC, m_temp.w, 1, m_temp.w - 1); eat(hd6309_native_mode() ? 0 : 1); write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -206,7 +206,7 @@ DEC16: INC16: m_temp.b.h = read_operand(0); m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZVC, m_temp.w, 1, m_temp.w + 1); + m_temp.w = set_flags<uint16_t>(CC_NZVC, m_temp.w, 1, m_temp.w + 1); eat(hd6309_native_mode() ? 0 : 1); write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -239,33 +239,33 @@ CMP8: return; SBC8: - m_temp.w = (UINT16)read_operand() + (m_cc & CC_C ? 1 : 0); + m_temp.w = (uint16_t)read_operand() + (m_cc & CC_C ? 1 : 0); regop8() = set_flags(CC_NZVC, regop8(), m_temp.b.l, regop8() - m_temp.w); return; AND8: m_cc &= ~CC_V; - regop8() = set_flags(CC_NZ, (UINT8)0, regop8(), regop8() & read_operand()); + regop8() = set_flags(CC_NZ, (uint8_t)0, regop8(), regop8() & read_operand()); return; BIT8: m_cc &= ~CC_V; - set_flags(CC_NZ, (UINT8)0, regop8(), regop8() & read_operand()); + set_flags(CC_NZ, (uint8_t)0, regop8(), regop8() & read_operand()); return; EOR8: m_cc &= ~CC_V; - regop8() = set_flags(CC_NZ, (UINT8)0, regop8(), regop8() ^ read_operand()); + regop8() = set_flags(CC_NZ, (uint8_t)0, regop8(), regop8() ^ read_operand()); return; ADC8: - m_temp.w = (UINT16)read_operand() + (m_cc & CC_C ? 1 : 0); + m_temp.w = (uint16_t)read_operand() + (m_cc & CC_C ? 1 : 0); regop8() = set_flags(add8_sets_h() ? CC_HNZVC : CC_NZVC, regop8(), m_temp.b.l, regop8() + m_temp.w); return; OR8: m_cc &= ~CC_V; - regop8() = set_flags(CC_NZ, (UINT8)0, regop8(), regop8() | read_operand()); + regop8() = set_flags(CC_NZ, (uint8_t)0, regop8(), regop8() | read_operand()); return; ADD8: @@ -356,7 +356,7 @@ ANDCC: return; SEX: - m_q.r.d = set_flags<UINT16>(CC_NZ, (INT8) m_q.r.b); + m_q.r.d = set_flags<uint16_t>(CC_NZ, (int8_t) m_q.r.b); eat(hd6309_native_mode() ? 0 : 1); return; @@ -365,7 +365,7 @@ BRANCH: eat(1); if (branch_taken()) { - m_pc.w += (INT8) m_temp.b.l; + m_pc.w += (int8_t) m_temp.b.l; } return; @@ -382,14 +382,14 @@ LBRANCH: BSR: @m_temp.b.l = read_opcode_arg(); - m_ea.w = m_pc.w + (INT8) m_temp.b.l; + m_ea.w = m_pc.w + (int8_t) m_temp.b.l; @eat(hd6309_native_mode() ? 2 : 3); goto GOTO_SUBROUTINE; LBSR: @m_temp.b.h = read_opcode_arg(); @m_temp.b.l = read_opcode_arg(); - m_ea.w = m_pc.w + (INT16) m_temp.w; + m_ea.w = m_pc.w + (int16_t) m_temp.w; @eat(hd6309_native_mode() ? 2 : 4); goto GOTO_SUBROUTINE; @@ -528,7 +528,7 @@ SOFTWARE_INTERRUPT: goto INTERRUPT_VECTOR; DIRECT: - @set_ea(((UINT16)m_dp << 8) | read_opcode_arg()); + @set_ea(((uint16_t)m_dp << 8) | read_opcode_arg()); @eat(hd6309_native_mode() ? 0 : 1); return; diff --git a/src/devices/cpu/m6809/hd6309.cpp b/src/devices/cpu/m6809/hd6309.cpp index 213464d90dc..ef9ff98f4f2 100644 --- a/src/devices/cpu/m6809/hd6309.cpp +++ b/src/devices/cpu/m6809/hd6309.cpp @@ -19,9 +19,9 @@ 6809 Microcomputer Programming & Interfacing with Experiments" by Andrew C. Staugaard, Jr.; Howard W. Sams & Co., Inc. - System dependencies: UINT16 must be 16 bit unsigned int - UINT8 must be 8 bit unsigned int - UINT32 must be more than 16 bits + System dependencies: uint16_t must be 16 bit unsigned int + uint8_t must be 8 bit unsigned int + uint32_t must be more than 16 bits arrays up to 65536 bytes must be supported machine must be twos complement @@ -131,7 +131,7 @@ const device_type HD6309 = &device_creator<hd6309_device>; // hd6309_device - constructor //------------------------------------------------- -hd6309_device::hd6309_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : +hd6309_device::hd6309_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6809_base_device(mconfig, "HD6309", tag, owner, clock, HD6309, 4, "hd6309", __FILE__), m_md(0), m_temp_im(0) @@ -289,7 +289,7 @@ void hd6309_device::device_post_load() // of the shortest instruction, in bytes //------------------------------------------------- -UINT32 hd6309_device::disasm_min_opcode_bytes() const +uint32_t hd6309_device::disasm_min_opcode_bytes() const { return 1; } @@ -301,7 +301,7 @@ UINT32 hd6309_device::disasm_min_opcode_bytes() const // of the longest instruction, in bytes //------------------------------------------------- -UINT32 hd6309_device::disasm_max_opcode_bytes() const +uint32_t hd6309_device::disasm_max_opcode_bytes() const { return 5; } @@ -313,7 +313,7 @@ UINT32 hd6309_device::disasm_max_opcode_bytes() const // helper function //------------------------------------------------- -offs_t hd6309_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) +offs_t hd6309_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { extern CPU_DISASSEMBLE( hd6309 ); return CPU_DISASSEMBLE_NAME(hd6309)(this, buffer, pc, oprom, opram, options); @@ -325,7 +325,7 @@ offs_t hd6309_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o // read_operand //------------------------------------------------- -inline UINT8 hd6309_device::read_operand() +inline uint8_t hd6309_device::read_operand() { switch(m_addressing_mode) { @@ -344,7 +344,7 @@ inline UINT8 hd6309_device::read_operand() // read_operand //------------------------------------------------- -inline UINT8 hd6309_device::read_operand(int ordinal) +inline uint8_t hd6309_device::read_operand(int ordinal) { switch(m_addressing_mode) { @@ -368,7 +368,7 @@ inline UINT8 hd6309_device::read_operand(int ordinal) // write_operand //------------------------------------------------- -inline void hd6309_device::write_operand(UINT8 data) +inline void hd6309_device::write_operand(uint8_t data) { switch(m_addressing_mode) { @@ -387,7 +387,7 @@ inline void hd6309_device::write_operand(UINT8 data) // write_operand //------------------------------------------------- -inline void hd6309_device::write_operand(int ordinal, UINT8 data) +inline void hd6309_device::write_operand(int ordinal, uint8_t data) { switch(m_addressing_mode) { @@ -410,7 +410,7 @@ inline void hd6309_device::write_operand(int ordinal, UINT8 data) // bittest_register //------------------------------------------------- -inline UINT8 &hd6309_device::bittest_register() +inline uint8_t &hd6309_device::bittest_register() { switch(m_temp_im & 0xC0) { @@ -460,9 +460,9 @@ inline void hd6309_device::bittest_set(bool result) // read_exgtfr_register //------------------------------------------------- -inline m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(UINT8 reg) +inline m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(uint8_t reg) { - UINT16 value; + uint16_t value; switch(reg & 0x0F) { @@ -474,20 +474,20 @@ inline m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(UI case 5: value = m_pc.w; break; // PC case 6: value = m_q.r.w; break; // W case 7: value = m_v.w; break; // V - case 8: value = ((UINT16) m_q.r.a) << 8 | m_q.r.a; break; // A - case 9: value = ((UINT16) m_q.r.b) << 8 | m_q.r.b; break; // B - case 10: value = ((UINT16) m_cc) << 8 | m_cc; break; // CC - case 11: value = ((UINT16) m_dp) << 8 | m_dp; break; // DP + case 8: value = ((uint16_t) m_q.r.a) << 8 | m_q.r.a; break; // A + case 9: value = ((uint16_t) m_q.r.b) << 8 | m_q.r.b; break; // B + case 10: value = ((uint16_t) m_cc) << 8 | m_cc; break; // CC + case 11: value = ((uint16_t) m_dp) << 8 | m_dp; break; // DP case 12: value = 0; break; // 0 case 13: value = 0; break; // 0 - case 14: value = ((UINT16) m_q.r.e) << 8 | m_q.r.e; break; // E - case 15: value = ((UINT16) m_q.r.f) << 8 | m_q.r.f; break; // F + case 14: value = ((uint16_t) m_q.r.e) << 8 | m_q.r.e; break; // E + case 15: value = ((uint16_t) m_q.r.f) << 8 | m_q.r.f; break; // F default: fatalerror("Should not reach here"); } exgtfr_register result; - result.byte_value = (UINT8)value; + result.byte_value = (uint8_t)value; result.word_value = value; return result; } @@ -498,7 +498,7 @@ inline m6809_base_device::exgtfr_register hd6309_device::read_exgtfr_register(UI // write_exgtfr_register //------------------------------------------------- -inline void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +inline void hd6309_device::write_exgtfr_register(uint8_t reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x0F) { @@ -510,14 +510,14 @@ inline void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_base_device::e case 5: m_pc.w = value.word_value; break; // PC case 6: m_q.r.w = value.word_value; break; // W case 7: m_v.w = value.word_value; break; // V - case 8: m_q.r.a = (UINT8) (value.word_value >> 8); break; // A - case 9: m_q.r.b = (UINT8) (value.word_value >> 0); break; // B - case 10: m_cc = (UINT8) (value.word_value >> 0); break; // CC - case 11: m_dp = (UINT8) (value.word_value >> 8); break; // DP + case 8: m_q.r.a = (uint8_t) (value.word_value >> 8); break; // A + case 9: m_q.r.b = (uint8_t) (value.word_value >> 0); break; // B + case 10: m_cc = (uint8_t) (value.word_value >> 0); break; // CC + case 11: m_dp = (uint8_t) (value.word_value >> 8); break; // DP case 12: break; // 0 case 13: break; // 0 - case 14: m_q.r.e = (UINT8) (value.word_value >> 8); break; // E - case 15: m_q.r.f = (UINT8) (value.word_value >> 0); break; // F + case 14: m_q.r.e = (uint8_t) (value.word_value >> 8); break; // E + case 15: m_q.r.f = (uint8_t) (value.word_value >> 0); break; // F default: fatalerror("Should not reach here"); } @@ -529,7 +529,7 @@ inline void hd6309_device::write_exgtfr_register(UINT8 reg, m6809_base_device::e // tfr_read //------------------------------------------------- -inline bool hd6309_device::tfr_read(UINT8 opcode, UINT8 arg, UINT8 &data) +inline bool hd6309_device::tfr_read(uint8_t opcode, uint8_t arg, uint8_t &data) { PAIR16 *reg; @@ -562,7 +562,7 @@ inline bool hd6309_device::tfr_read(UINT8 opcode, UINT8 arg, UINT8 &data) // tfr_write //------------------------------------------------- -inline bool hd6309_device::tfr_write(UINT8 opcode, UINT8 arg, UINT8 data) +inline bool hd6309_device::tfr_write(uint8_t opcode, uint8_t arg, uint8_t data) { PAIR16 *reg; @@ -597,7 +597,7 @@ inline bool hd6309_device::tfr_write(UINT8 opcode, UINT8 arg, UINT8 data) void hd6309_device::register_register_op() { - UINT8 operand = read_opcode_arg(); + uint8_t operand = read_opcode_arg(); // if the 8/16 bit values are mismatched, we need to promote bool promote = ((operand & 0x80) ? true : false) != ((operand & 0x08) ? true : false); @@ -661,9 +661,9 @@ void hd6309_device::register_register_op() void hd6309_device::muld() { - UINT32 result; - result = ((INT16) m_q.r.d) * ((INT16) m_temp.w); - m_q.q = (set_flags<UINT32>(CC_NZ, result)); + uint32_t result; + result = ((int16_t) m_q.r.d) * ((int16_t) m_temp.w); + m_q.q = (set_flags<uint32_t>(CC_NZ, result)); m_cc &= ~CC_VC; } @@ -674,21 +674,21 @@ void hd6309_device::muld() bool hd6309_device::divq() { - INT32 result; + int32_t result; // check for divide by zero if (m_temp.w == 0) return false; - INT32 q = m_q.q; - INT32 old_q = q; + int32_t q = m_q.q; + int32_t old_q = q; // do the divide/modulo - result = q / (INT16) m_temp.w; - m_q.r.d = q % (INT16) m_temp.w; + result = q / (int16_t) m_temp.w; + m_q.r.d = q % (int16_t) m_temp.w; // set NZ condition codes - m_q.r.w = set_flags<UINT16>(CC_NZ, result); + m_q.r.w = set_flags<uint16_t>(CC_NZ, result); // set C condition code if (m_q.r.w & 0x0001) @@ -732,15 +732,15 @@ bool hd6309_device::divd() if (m_temp.b.l == 0) return false; - INT16 old_d = m_q.r.d; - INT16 result; + int16_t old_d = m_q.r.d; + int16_t result; // do the divide/modulo - result = ((INT16) m_q.r.d) / (INT8) m_temp.b.l; - m_q.r.a = ((INT16) m_q.r.d) % (INT8) m_temp.b.l; + result = ((int16_t) m_q.r.d) / (int8_t) m_temp.b.l; + m_q.r.a = ((int16_t) m_q.r.d) % (int8_t) m_temp.b.l; // set NZ condition codes - m_q.r.b = set_flags<UINT8>(CC_NZ, result); + m_q.r.b = set_flags<uint8_t>(CC_NZ, result); // set C condition code if (m_q.r.b & 0x01) @@ -756,7 +756,7 @@ bool hd6309_device::divd() if ((result > 256 ) || (result < -255 )) { // hard overflow - division is aborted - set_flags<UINT16>(CC_NZ, old_d); + set_flags<uint16_t>(CC_NZ, old_d); m_q.r.d = abs(old_d); } } diff --git a/src/devices/cpu/m6809/hd6309.h b/src/devices/cpu/m6809/hd6309.h index 762dac4737b..852f03d2d0d 100644 --- a/src/devices/cpu/m6809/hd6309.h +++ b/src/devices/cpu/m6809/hd6309.h @@ -29,7 +29,7 @@ class hd6309_device : public m6809_base_device { public: // construction/destruction - hd6309_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + hd6309_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -42,9 +42,9 @@ protected: virtual void execute_run() override; // device_disasm_interface overrides - virtual UINT32 disasm_min_opcode_bytes() const override; - virtual UINT32 disasm_max_opcode_bytes() const override; - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; + virtual uint32_t disasm_min_opcode_bytes() const override; + virtual uint32_t disasm_max_opcode_bytes() const override; + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; virtual bool is_6809() override { return false; }; @@ -76,23 +76,23 @@ private: // CPU registers PAIR16 m_v; - UINT8 m_md; + uint8_t m_md; // other state - UINT8 m_temp_im; + uint8_t m_temp_im; // operand reading/writing - UINT8 read_operand(); - UINT8 read_operand(int ordinal); - void write_operand(UINT8 data); - void write_operand(int ordinal, UINT8 data); + uint8_t read_operand(); + uint8_t read_operand(int ordinal); + void write_operand(uint8_t data); + void write_operand(int ordinal, uint8_t data); // interrupt registers bool firq_saves_entire_state() { return m_md & 0x02; } - UINT16 entire_state_registers() { return hd6309_native_mode() ? 0x3FF : 0xFF; } + uint16_t entire_state_registers() { return hd6309_native_mode() ? 0x3FF : 0xFF; } // bit tests - UINT8 &bittest_register(); + uint8_t &bittest_register(); bool bittest_source(); bool bittest_dest(); void bittest_set(bool result); @@ -106,10 +106,10 @@ private: void set_e() { m_addressing_mode = ADDRESSING_MODE_REGISTER_E; } void set_f() { m_addressing_mode = ADDRESSING_MODE_REGISTER_F; } void set_w() { m_addressing_mode = ADDRESSING_MODE_REGISTER_W; } - exgtfr_register read_exgtfr_register(UINT8 reg); - void write_exgtfr_register(UINT8 reg, exgtfr_register value); - bool tfr_read(UINT8 opcode, UINT8 arg, UINT8 &data); - bool tfr_write(UINT8 opcode, UINT8 arg, UINT8 data); + exgtfr_register read_exgtfr_register(uint8_t reg); + void write_exgtfr_register(uint8_t reg, exgtfr_register value); + bool tfr_read(uint8_t opcode, uint8_t arg, uint8_t &data); + bool tfr_write(uint8_t opcode, uint8_t arg, uint8_t data); bool add8_sets_h() { return (m_opcode & 0xFE) != 0x30; } void register_register_op(); bool hd6309_native_mode() { return m_md & 0x01; } diff --git a/src/devices/cpu/m6809/hd6309.ops b/src/devices/cpu/m6809/hd6309.ops index db04e99d981..9752460175b 100644 --- a/src/devices/cpu/m6809/hd6309.ops +++ b/src/devices/cpu/m6809/hd6309.ops @@ -673,19 +673,19 @@ INDEXED: case 0x05: case 0x25: case 0x45: case 0x65: case 0x15: case 0x35: case 0x55: case 0x75: - m_temp.w = ireg() + (INT8) m_q.r.b; + m_temp.w = ireg() + (int8_t) m_q.r.b; eat(2); break; case 0x06: case 0x26: case 0x46: case 0x66: case 0x16: case 0x36: case 0x56: case 0x76: - m_temp.w = ireg() + (INT8) m_q.r.a; + m_temp.w = ireg() + (int8_t) m_q.r.a; eat(2); break; case 0x08: case 0x28: case 0x48: case 0x68: case 0x18: case 0x38: case 0x58: case 0x78: - @m_temp.w = ireg() + (INT8) read_opcode_arg(); + @m_temp.w = ireg() + (int8_t) read_opcode_arg(); eat(1); break; @@ -706,7 +706,7 @@ INDEXED: case 0x0C: case 0x2C: case 0x4C: case 0x6C: case 0x1C: case 0x3C: case 0x5C: case 0x7C: @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_pc.w + (INT8) m_temp.b.l; + m_temp.w = m_pc.w + (int8_t) m_temp.b.l; eat(1); break; @@ -714,7 +714,7 @@ INDEXED: case 0x1D: case 0x3D: case 0x5D: case 0x7D: @m_temp.b.h = read_opcode_arg(); @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_pc.w + (INT16) m_temp.w; + m_temp.w = m_pc.w + (int16_t) m_temp.w; eat((hd6309_native_mode() && !(m_opcode & 0x10)) ? 2 : 4); break; @@ -727,14 +727,14 @@ INDEXED: case 0x07: case 0x27: case 0x47: case 0x67: case 0x17: case 0x37: case 0x57: case 0x77: // 6309 specific mode - m_temp.w = ireg() + (INT8) m_q.r.e; + m_temp.w = ireg() + (int8_t) m_q.r.e; eat(2); break; case 0x0A: case 0x2A: case 0x4A: case 0x6A: case 0x1A: case 0x3A: case 0x5A: case 0x7A: // 6309 specific mode - m_temp.w = ireg() + (INT8) m_q.r.f; + m_temp.w = ireg() + (int8_t) m_q.r.f; eat(2); break; @@ -789,7 +789,7 @@ INDEXED: else { // 5-bit offset - m_temp.w = ireg() + (INT8) ((m_opcode & 0x0F) | (m_opcode & 0x10 ? 0xF0 : 0x00)); + m_temp.w = ireg() + (int8_t) ((m_opcode & 0x0F) | (m_opcode & 0x10 ? 0xF0 : 0x00)); eat(2); } @set_ea(m_temp.w); @@ -797,7 +797,7 @@ INDEXED: EXG: { - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg1 = read_exgtfr_register(param >> 4); exgtfr_register reg2 = read_exgtfr_register(param >> 0); write_exgtfr_register(param >> 4, reg2); @@ -808,7 +808,7 @@ EXG: TFR: { - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg = read_exgtfr_register(param >> 4); write_exgtfr_register(param >> 0, reg); } @@ -839,7 +839,7 @@ LDQ: @m_q.r.b = read_operand(1); @m_q.r.e = read_operand(2); @m_q.r.f = read_operand(3); - set_flags<UINT32>(CC_NZV, m_q.q); + set_flags<uint32_t>(CC_NZV, m_q.q); return; STQ: @@ -847,13 +847,13 @@ STQ: @write_operand(1, m_q.r.b); @write_operand(2, m_q.r.e); @write_operand(3, m_q.r.f); - set_flags<UINT32>(CC_NZV, m_q.q); + set_flags<uint32_t>(CC_NZV, m_q.q); return; OIM: @m_temp.b.l = read_operand(); m_cc &= ~CC_V; - m_temp.b.l = set_flags(CC_NZ, (UINT8)0, m_temp.b.l, m_temp.b.l | m_temp_im); + m_temp.b.l = set_flags(CC_NZ, (uint8_t)0, m_temp.b.l, m_temp.b.l | m_temp_im); @eat(1); // this is just a guess @write_operand(m_temp.b.l); return; @@ -861,7 +861,7 @@ OIM: AIM: @m_temp.b.l = read_operand(); m_cc &= ~CC_V; - m_temp.b.l = set_flags(CC_NZ, (UINT8)0, m_temp.b.l, m_temp.b.l & m_temp_im); + m_temp.b.l = set_flags(CC_NZ, (uint8_t)0, m_temp.b.l, m_temp.b.l & m_temp_im); @eat(1); // this is just a guess @write_operand(m_temp.b.l); return; @@ -869,7 +869,7 @@ AIM: EIM: @m_temp.b.l = read_operand(); m_cc &= ~CC_V; - m_temp.b.l = set_flags(CC_NZ, (UINT8)0, m_temp.b.l, m_temp.b.l ^ m_temp_im); + m_temp.b.l = set_flags(CC_NZ, (uint8_t)0, m_temp.b.l, m_temp.b.l ^ m_temp_im); @eat(1); // this is just a guess @write_operand(m_temp.b.l); return; @@ -877,7 +877,7 @@ EIM: TIM: @m_temp.b.l = read_operand(); m_cc &= ~CC_V; - m_temp.b.l = set_flags(CC_NZ, (UINT8)0, m_temp.b.l, m_temp.b.l & m_temp_im); + m_temp.b.l = set_flags(CC_NZ, (uint8_t)0, m_temp.b.l, m_temp.b.l & m_temp_im); @eat(2); // this is just a guess return; @@ -926,7 +926,7 @@ COM16: m_temp.b.l = read_operand(1); m_cc &= ~CC_V; m_cc |= CC_C; - m_temp.w = set_flags(CC_NZ, (UINT16) ~m_temp.w); + m_temp.w = set_flags(CC_NZ, (uint16_t) ~m_temp.w); eat(hd6309_native_mode() ? 0 : 1); write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); @@ -950,28 +950,28 @@ AND16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); m_cc &= ~CC_V; - regop16().w = set_flags(CC_NZ, (UINT16)0, regop16().w, regop16().w & m_temp.w); + regop16().w = set_flags(CC_NZ, (uint16_t)0, regop16().w, regop16().w & m_temp.w); return; BIT16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); m_cc &= ~CC_V; - set_flags(CC_NZ, (UINT16)0, regop16().w, regop16().w & m_temp.w); + set_flags(CC_NZ, (uint16_t)0, regop16().w, regop16().w & m_temp.w); return; OR16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); m_cc &= ~CC_V; - regop16().w = set_flags(CC_NZ, (UINT16)0, regop16().w, regop16().w | m_temp.w); + regop16().w = set_flags(CC_NZ, (uint16_t)0, regop16().w, regop16().w | m_temp.w); return; EOR16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); m_cc &= ~CC_V; - regop16().w = set_flags(CC_NZ, (UINT16)0, regop16().w, regop16().w ^ m_temp.w); + regop16().w = set_flags(CC_NZ, (uint16_t)0, regop16().w, regop16().w ^ m_temp.w); return; PSHSW: @@ -1079,7 +1079,7 @@ DIVD: return; SEXW: - m_q.r.d = set_flags<UINT16>(CC_N, (m_q.r.w & 0x8000) ? 0xFFFF : 0x0000); + m_q.r.d = set_flags<uint16_t>(CC_N, (m_q.r.w & 0x8000) ? 0xFFFF : 0x0000); if ((m_q.r.d == 0x0000) && (m_q.r.w == 0x0000)) m_cc |= CC_Z; else diff --git a/src/devices/cpu/m6809/konami.cpp b/src/devices/cpu/m6809/konami.cpp index f8db9587678..8762d358635 100644 --- a/src/devices/cpu/m6809/konami.cpp +++ b/src/devices/cpu/m6809/konami.cpp @@ -18,9 +18,9 @@ 6809 Microcomputer Programming & Interfacing with Experiments" by Andrew C. Staugaard, Jr.; Howard W. Sams & Co., Inc. - System dependencies: UINT16 must be 16 bit unsigned int - UINT8 must be 8 bit unsigned int - UINT32 must be more than 16 bits + System dependencies: uint16_t must be 16 bit unsigned int + uint8_t must be 8 bit unsigned int + uint32_t must be more than 16 bits arrays up to 65536 bytes must be supported machine must be twos complement @@ -84,7 +84,7 @@ const device_type KONAMI = &device_creator<konami_cpu_device>; // konami_cpu_device - constructor //------------------------------------------------- -konami_cpu_device::konami_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +konami_cpu_device::konami_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6809_base_device(mconfig, "KONAMI CPU", tag, owner, clock, KONAMI, 1, "konami_cpu", __FILE__), m_set_lines(*this) { @@ -109,7 +109,7 @@ void konami_cpu_device::device_start() // helper function //------------------------------------------------- -offs_t konami_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) +offs_t konami_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { extern CPU_DISASSEMBLE( konami ); return CPU_DISASSEMBLE_NAME(konami)(this, buffer, pc, oprom, opram, options); @@ -120,7 +120,7 @@ offs_t konami_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT // read_operand //------------------------------------------------- -inline UINT8 konami_cpu_device::read_operand() +inline uint8_t konami_cpu_device::read_operand() { return super::read_operand(); } @@ -130,7 +130,7 @@ inline UINT8 konami_cpu_device::read_operand() // read_operand //------------------------------------------------- -inline UINT8 konami_cpu_device::read_operand(int ordinal) +inline uint8_t konami_cpu_device::read_operand(int ordinal) { switch(m_addressing_mode) { @@ -146,7 +146,7 @@ inline UINT8 konami_cpu_device::read_operand(int ordinal) // write_operand //------------------------------------------------- -inline void konami_cpu_device::write_operand(UINT8 data) +inline void konami_cpu_device::write_operand(uint8_t data) { super::write_operand(data); } @@ -157,7 +157,7 @@ inline void konami_cpu_device::write_operand(UINT8 data) // write_operand //------------------------------------------------- -inline void konami_cpu_device::write_operand(int ordinal, UINT8 data) +inline void konami_cpu_device::write_operand(int ordinal, uint8_t data) { switch(m_addressing_mode) { @@ -173,7 +173,7 @@ inline void konami_cpu_device::write_operand(int ordinal, UINT8 data) // ireg //------------------------------------------------- -inline UINT16 &konami_cpu_device::ireg() +inline uint16_t &konami_cpu_device::ireg() { switch(m_opcode & 0x70) { @@ -194,7 +194,7 @@ inline UINT16 &konami_cpu_device::ireg() // read_exgtfr_register //------------------------------------------------- -inline m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_register(UINT8 reg) +inline m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_register(uint8_t reg) { exgtfr_register result; result.word_value = 0x00FF; @@ -208,7 +208,7 @@ inline m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_registe case 4: result.word_value = m_s.w; break; // S case 5: result.word_value = m_u.w; break; // U } - result.byte_value = (UINT8) result.word_value; + result.byte_value = (uint8_t) result.word_value; return result; } @@ -217,7 +217,7 @@ inline m6809_base_device::exgtfr_register konami_cpu_device::read_exgtfr_registe // write_exgtfr_register //------------------------------------------------- -inline void konami_cpu_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +inline void konami_cpu_device::write_exgtfr_register(uint8_t reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x07) { @@ -235,7 +235,7 @@ inline void konami_cpu_device::write_exgtfr_register(UINT8 reg, m6809_base_devic // safe_shift_right //------------------------------------------------- -template<class T> T konami_cpu_device::safe_shift_right(T value, UINT32 shift) +template<class T> T konami_cpu_device::safe_shift_right(T value, uint32_t shift) { T result; @@ -254,7 +254,7 @@ template<class T> T konami_cpu_device::safe_shift_right(T value, UINT32 shift) // safe_shift_right_unsigned //------------------------------------------------- -template<class T> T konami_cpu_device::safe_shift_right_unsigned(T value, UINT32 shift) +template<class T> T konami_cpu_device::safe_shift_right_unsigned(T value, uint32_t shift) { T result; @@ -270,7 +270,7 @@ template<class T> T konami_cpu_device::safe_shift_right_unsigned(T value, UINT32 // safe_shift_left //------------------------------------------------- -template<class T> T konami_cpu_device::safe_shift_left(T value, UINT32 shift) +template<class T> T konami_cpu_device::safe_shift_left(T value, uint32_t shift) { T result; @@ -292,14 +292,14 @@ inline void konami_cpu_device::lmul() PAIR result; // do the multiply - result.d = (UINT32)m_x.w * m_y.w; + result.d = (uint32_t)m_x.w * m_y.w; // set the result registers m_x.w = result.w.h; m_y.w = result.w.l; // set Z flag - set_flags<UINT32>(CC_Z, result.d); + set_flags<uint32_t>(CC_Z, result.d); // set C flag if (result.d & 0x8000) @@ -315,8 +315,8 @@ inline void konami_cpu_device::lmul() inline void konami_cpu_device::divx() { - UINT16 result; - UINT8 remainder; + uint16_t result; + uint8_t remainder; if (m_q.r.b != 0) { @@ -331,7 +331,7 @@ inline void konami_cpu_device::divx() } // set results and Z flag - m_x.w = set_flags<UINT16>(CC_Z, result); + m_x.w = set_flags<uint16_t>(CC_Z, result); m_q.r.b = remainder; // set C flag @@ -346,7 +346,7 @@ inline void konami_cpu_device::divx() // set_lines //------------------------------------------------- -void konami_cpu_device::set_lines(UINT8 data) +void konami_cpu_device::set_lines(uint8_t data) { if (!m_set_lines.isnull()) m_set_lines((offs_t)0, data); diff --git a/src/devices/cpu/m6809/konami.h b/src/devices/cpu/m6809/konami.h index 957a4c4d3e5..ca42bbfb666 100644 --- a/src/devices/cpu/m6809/konami.h +++ b/src/devices/cpu/m6809/konami.h @@ -33,7 +33,7 @@ class konami_cpu_device : public m6809_base_device { public: // construction/destruction - konami_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + konami_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration template<class _Object> static devcb_base &set_line_callback(device_t &device, _Object object) { return downcast<konami_cpu_device &>(device).m_set_lines.set_callback(object); } @@ -46,7 +46,7 @@ protected: virtual void execute_run() override; // device_disasm_interface overrides - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; private: typedef m6809_base_device super; @@ -55,23 +55,23 @@ private: devcb_write8 m_set_lines; // konami-specific addressing modes - UINT16 &ireg(); - UINT8 read_operand(); - UINT8 read_operand(int ordinal); - void write_operand(UINT8 data); - void write_operand(int ordinal, UINT8 data); - exgtfr_register read_exgtfr_register(UINT8 reg); - void write_exgtfr_register(UINT8 reg, exgtfr_register value); + uint16_t &ireg(); + uint8_t read_operand(); + uint8_t read_operand(int ordinal); + void write_operand(uint8_t data); + void write_operand(int ordinal, uint8_t data); + exgtfr_register read_exgtfr_register(uint8_t reg); + void write_exgtfr_register(uint8_t reg, exgtfr_register value); // instructions void lmul(); void divx(); // miscellaneous - template<class T> T safe_shift_right(T value, UINT32 shift); - template<class T> T safe_shift_right_unsigned(T value, UINT32 shift); - template<class T> T safe_shift_left(T value, UINT32 shift); - void set_lines(UINT8 data); + template<class T> T safe_shift_right(T value, uint32_t shift); + template<class T> T safe_shift_right_unsigned(T value, uint32_t shift); + template<class T> T safe_shift_left(T value, uint32_t shift); + void set_lines(uint8_t data); void execute_one(); }; diff --git a/src/devices/cpu/m6809/konami.ops b/src/devices/cpu/m6809/konami.ops index f5a159621fc..d2df5273c00 100644 --- a/src/devices/cpu/m6809/konami.ops +++ b/src/devices/cpu/m6809/konami.ops @@ -372,7 +372,7 @@ INDEXED: // postbyte offset m_ea.w = ireg(); // need to do this now because ireg() might be PC @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_ea.w + (INT8) m_temp.b.l; + m_temp.w = m_ea.w + (int8_t) m_temp.b.l; eat(1); break; @@ -381,7 +381,7 @@ INDEXED: m_ea.w = ireg(); // need to do this now because ireg() might be PC @m_temp.b.h = read_opcode_arg(); @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_ea.w + (INT16) m_temp.w; + m_temp.w = m_ea.w + (int16_t) m_temp.w; eat(2); break; @@ -397,19 +397,19 @@ INDEXED: case 0xA0: case 0xB0: case 0xD0: case 0xE0: case 0xF0: // relative to register A - m_temp.w = ireg() + (INT8) m_q.r.a; + m_temp.w = ireg() + (int8_t) m_q.r.a; @eat(1); break; case 0xA1: case 0xB1: case 0xD1: case 0xE1: case 0xF1: // relative to register B - m_temp.w = ireg() + (INT8) m_q.r.b; + m_temp.w = ireg() + (int8_t) m_q.r.b; @eat(1); break; case 0xA7: case 0xB7: case 0xD7: case 0xE7: case 0xF7: // relative to register D - m_temp.w = ireg() + (INT16) m_q.r.d; + m_temp.w = ireg() + (int16_t) m_q.r.d; @eat(4); break; @@ -434,7 +434,7 @@ INDEXED: EXG: { // konami's EXG instruction differs enough from 6809 to fork the code - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg1 = read_exgtfr_register(param >> 0); exgtfr_register reg2 = read_exgtfr_register(param >> 4); write_exgtfr_register(param >> 0, reg2); @@ -446,7 +446,7 @@ EXG: TFR: { // konami's TFR instruction differs enough from 6809 to fork the code - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg = read_exgtfr_register(param >> 0); write_exgtfr_register(param >> 4, reg); } @@ -499,14 +499,14 @@ BSET2: DECXJNZ: // not sure if this affects V? - m_x.w = set_flags<UINT16>(CC_NZV, m_x.w, 1, m_x.w - 1); + m_x.w = set_flags<uint16_t>(CC_NZV, m_x.w, 1, m_x.w - 1); @eat(1); set_cond(cond_ne()); goto BRANCH; DECBJNZ: // not sure if this affects V? - m_q.r.b = set_flags<UINT8>(CC_NZV, m_q.r.b, 1, m_q.r.b - 1); + m_q.r.b = set_flags<uint8_t>(CC_NZV, m_q.r.b, 1, m_q.r.b - 1); @eat(1); set_cond(cond_ne()); goto BRANCH; @@ -521,7 +521,7 @@ LSRD: else m_cc &= ~CC_C; - m_q.r.d = set_flags<UINT16>(CC_NZ, safe_shift_right_unsigned<UINT16>(m_q.r.d, m_temp.b.l)); + m_q.r.d = set_flags<uint16_t>(CC_NZ, safe_shift_right_unsigned<uint16_t>(m_q.r.d, m_temp.b.l)); } eat(1); return; @@ -536,7 +536,7 @@ ASLD: else m_cc &= ~CC_C; - m_q.r.d = set_flags<UINT16>(CC_NZV, safe_shift_left<INT16>(m_q.r.d, m_temp.b.l)); + m_q.r.d = set_flags<uint16_t>(CC_NZV, safe_shift_left<int16_t>(m_q.r.d, m_temp.b.l)); } eat(1); return; @@ -551,7 +551,7 @@ ASRD: else m_cc &= ~CC_C; - m_q.r.d = set_flags<UINT16>(CC_NZ, safe_shift_right<INT16>(m_q.r.d, m_temp.b.l)); + m_q.r.d = set_flags<uint16_t>(CC_NZ, safe_shift_right<int16_t>(m_q.r.d, m_temp.b.l)); } eat(1); return; @@ -561,7 +561,7 @@ ROLD: // doing this as a loop is lame while(m_temp.b.l--) - m_temp.w = set_flags<UINT16>(CC_NZ, rotate_left(m_temp.w)); + m_temp.w = set_flags<uint16_t>(CC_NZ, rotate_left(m_temp.w)); eat(1); return; @@ -571,14 +571,14 @@ RORD: // doing this as a loop is lame while(m_temp.b.l--) - m_temp.w = set_flags<UINT16>(CC_NZ, rotate_right(m_temp.w)); + m_temp.w = set_flags<uint16_t>(CC_NZ, rotate_right(m_temp.w)); eat(1); return; ABS8: @m_temp.b.l = read_operand(); - m_temp.b.l = set_flags<UINT8>(CC_NZVC, 0, m_temp.b.l, ((INT8) m_temp.b.l) >= 0 ? m_temp.b.l : -m_temp.b.l); + m_temp.b.l = set_flags<uint8_t>(CC_NZVC, 0, m_temp.b.l, ((int8_t) m_temp.b.l) >= 0 ? m_temp.b.l : -m_temp.b.l); @eat(1); write_operand(m_temp.b.l); return; @@ -586,7 +586,7 @@ ABS8: ABS16: @m_temp.b.h = read_operand(0); @m_temp.b.l = read_operand(1); - m_temp.w = set_flags<UINT16>(CC_NZVC, 0, m_temp.w, ((INT16) m_temp.w) >= 0 ? m_temp.w : -m_temp.w); + m_temp.w = set_flags<uint16_t>(CC_NZVC, 0, m_temp.w, ((int16_t) m_temp.w) >= 0 ? m_temp.w : -m_temp.w); @eat(1); @write_operand(0, m_temp.b.h); write_operand(1, m_temp.b.l); diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp index 693480cd940..db0cbee9a3c 100644 --- a/src/devices/cpu/m6809/m6809.cpp +++ b/src/devices/cpu/m6809/m6809.cpp @@ -14,9 +14,9 @@ 6809 Microcomputer Programming & Interfacing with Experiments" by Andrew C. Staugaard, Jr.; Howard W. Sams & Co., Inc. - System dependencies: UINT16 must be 16 bit unsigned int - UINT8 must be 8 bit unsigned int - UINT32 must be more than 16 bits + System dependencies: uint16_t must be 16 bit unsigned int + uint8_t must be 8 bit unsigned int + uint32_t must be more than 16 bits arrays up to 65536 bytes must be supported machine must be twos complement @@ -111,7 +111,7 @@ const device_type M6809E = &device_creator<m6809e_device>; // m6809_base_device - constructor //------------------------------------------------- -m6809_base_device::m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, int divider, const char *shortname, const char *source) +m6809_base_device::m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, uint32_t clock, const device_type type, int divider, const char *shortname, const char *source) : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source), m_lic_func(*this), m_program_config("program", ENDIANNESS_BIG, 8, 16), @@ -351,7 +351,7 @@ void m6809_base_device::state_string_export(const device_state_entry &entry, std // of the shortest instruction, in bytes //------------------------------------------------- -UINT32 m6809_base_device::disasm_min_opcode_bytes() const +uint32_t m6809_base_device::disasm_min_opcode_bytes() const { return 1; } @@ -362,7 +362,7 @@ UINT32 m6809_base_device::disasm_min_opcode_bytes() const // of the longest instruction, in bytes //------------------------------------------------- -UINT32 m6809_base_device::disasm_max_opcode_bytes() const +uint32_t m6809_base_device::disasm_max_opcode_bytes() const { return 5; } @@ -373,7 +373,7 @@ UINT32 m6809_base_device::disasm_max_opcode_bytes() const // helper function //------------------------------------------------- -offs_t m6809_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) +offs_t m6809_base_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) { extern CPU_DISASSEMBLE( m6809 ); return CPU_DISASSEMBLE_NAME(m6809)(this, buffer, pc, oprom, opram, options); @@ -389,7 +389,7 @@ offs_t m6809_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT // clock into cycles per second //------------------------------------------------- -UINT64 m6809_base_device::execute_clocks_to_cycles(UINT64 clocks) const +uint64_t m6809_base_device::execute_clocks_to_cycles(uint64_t clocks) const { return (clocks + m_clock_divider - 1) / m_clock_divider; } @@ -400,7 +400,7 @@ UINT64 m6809_base_device::execute_clocks_to_cycles(UINT64 clocks) const // count back to raw clocks //------------------------------------------------- -UINT64 m6809_base_device::execute_cycles_to_clocks(UINT64 cycles) const +uint64_t m6809_base_device::execute_cycles_to_clocks(uint64_t cycles) const { return cycles * m_clock_divider; } @@ -411,7 +411,7 @@ UINT64 m6809_base_device::execute_cycles_to_clocks(UINT64 cycles) const // cycles it takes for one instruction to execute //------------------------------------------------- -UINT32 m6809_base_device::execute_min_cycles() const +uint32_t m6809_base_device::execute_min_cycles() const { return 1; } @@ -422,7 +422,7 @@ UINT32 m6809_base_device::execute_min_cycles() const // cycles it takes for one instruction to execute //------------------------------------------------- -UINT32 m6809_base_device::execute_max_cycles() const +uint32_t m6809_base_device::execute_max_cycles() const { return 19; } @@ -433,7 +433,7 @@ UINT32 m6809_base_device::execute_max_cycles() const // input/interrupt lines //------------------------------------------------- -UINT32 m6809_base_device::execute_input_lines() const +uint32_t m6809_base_device::execute_input_lines() const { return 3; } @@ -490,7 +490,7 @@ const char *m6809_base_device::inputnum_string(int inputnum) // read_exgtfr_register //------------------------------------------------- -m6809_base_device::exgtfr_register m6809_base_device::read_exgtfr_register(UINT8 reg) +m6809_base_device::exgtfr_register m6809_base_device::read_exgtfr_register(uint8_t reg) { exgtfr_register result; result.byte_value = 0xFF; @@ -517,7 +517,7 @@ m6809_base_device::exgtfr_register m6809_base_device::read_exgtfr_register(UINT8 // write_exgtfr_register //------------------------------------------------- -void m6809_base_device::write_exgtfr_register(UINT8 reg, m6809_base_device::exgtfr_register value) +void m6809_base_device::write_exgtfr_register(uint8_t reg, m6809_base_device::exgtfr_register value) { switch(reg & 0x0F) { @@ -573,23 +573,23 @@ void m6809_base_device::execute_run() } -UINT8 m6809_base_device::mi_default::read(UINT16 adr) +uint8_t m6809_base_device::mi_default::read(uint16_t adr) { return m_program->read_byte(adr); } -UINT8 m6809_base_device::mi_default::read_opcode(UINT16 adr) +uint8_t m6809_base_device::mi_default::read_opcode(uint16_t adr) { return m_sdirect->read_byte(adr); } -UINT8 m6809_base_device::mi_default::read_opcode_arg(UINT16 adr) +uint8_t m6809_base_device::mi_default::read_opcode_arg(uint16_t adr) { return m_direct->read_byte(adr); } -void m6809_base_device::mi_default::write(UINT16 adr, UINT8 val) +void m6809_base_device::mi_default::write(uint16_t adr, uint8_t val) { m_program->write_byte(adr, val); } @@ -600,7 +600,7 @@ void m6809_base_device::mi_default::write(UINT16 adr, UINT8 val) // m6809_device //------------------------------------------------- -m6809_device::m6809_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +m6809_device::m6809_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6809_base_device(mconfig, "M6809", tag, owner, clock, M6809, 1, "m6809", __FILE__) { } @@ -611,7 +611,7 @@ m6809_device::m6809_device(const machine_config &mconfig, const char *tag, devic // m6809e_device //------------------------------------------------- -m6809e_device::m6809e_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +m6809e_device::m6809e_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6809_base_device(mconfig, "M6809E", tag, owner, clock, M6809E, 4, "m6809e", __FILE__) { } diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h index d2124afc277..b9b6c365f35 100644 --- a/src/devices/cpu/m6809/m6809.h +++ b/src/devices/cpu/m6809/m6809.h @@ -32,7 +32,7 @@ class m6809_base_device : public cpu_device { public: // construction/destruction - m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, int divider, const char *shortname, const char *source); + m6809_base_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, uint32_t clock, const device_type type, int divider, const char *shortname, const char *source); protected: class memory_interface { @@ -41,19 +41,19 @@ protected: direct_read_data *m_direct, *m_sdirect; virtual ~memory_interface() {} - virtual UINT8 read(UINT16 adr) = 0; - virtual UINT8 read_opcode(UINT16 adr) = 0; - virtual UINT8 read_opcode_arg(UINT16 adr) = 0; - virtual void write(UINT16 adr, UINT8 val) = 0; + virtual uint8_t read(uint16_t adr) = 0; + virtual uint8_t read_opcode(uint16_t adr) = 0; + virtual uint8_t read_opcode_arg(uint16_t adr) = 0; + virtual void write(uint16_t adr, uint8_t val) = 0; }; class mi_default : public memory_interface { public: virtual ~mi_default() {} - virtual UINT8 read(UINT16 adr) override; - virtual UINT8 read_opcode(UINT16 adr) override; - virtual UINT8 read_opcode_arg(UINT16 adr) override; - virtual void write(UINT16 adr, UINT8 val) override; + virtual uint8_t read(uint16_t adr) override; + virtual uint8_t read_opcode(uint16_t adr) override; + virtual uint8_t read_opcode_arg(uint16_t adr) override; + virtual void write(uint16_t adr, uint8_t val) override; }; // device-level overrides @@ -63,21 +63,21 @@ protected: virtual void device_post_load() override; // device_execute_interface overrides - virtual UINT32 execute_min_cycles() const override; - virtual UINT32 execute_max_cycles() const override; - virtual UINT32 execute_input_lines() const override; + virtual uint32_t execute_min_cycles() const override; + virtual uint32_t execute_max_cycles() const override; + virtual uint32_t execute_input_lines() const override; virtual void execute_run() override; virtual void execute_set_input(int inputnum, int state) override; - virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const override; - virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const override; + virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const override; + virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override; // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override; // device_disasm_interface overrides - virtual UINT32 disasm_min_opcode_bytes() const override; - virtual UINT32 disasm_max_opcode_bytes() const override; - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override; + virtual uint32_t disasm_min_opcode_bytes() const override; + virtual uint32_t disasm_max_opcode_bytes() const override; + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override; // device_state_interface overrides virtual void state_import(const device_state_entry &entry) override; @@ -98,8 +98,8 @@ protected: // register transfer struct exgtfr_register { - UINT8 byte_value; - UINT16 word_value; + uint8_t byte_value; + uint16_t word_value; }; // flag bits in the cc register @@ -144,19 +144,19 @@ protected: #ifdef LSB_FIRST union { - struct { UINT8 f, e, b, a; }; - struct { UINT16 w, d; }; + struct { uint8_t f, e, b, a; }; + struct { uint16_t w, d; }; } r; struct { PAIR16 w, d; } p; #else union { - struct { UINT8 a, b, e, f; }; - struct { UINT16 d, w; }; + struct { uint8_t a, b, e, f; }; + struct { uint16_t d, w; }; } r; struct { PAIR16 d, w; } p; #endif - UINT32 q; + uint32_t q; }; // Memory interface @@ -168,13 +168,13 @@ protected: M6809Q m_q; // accumulator a and b (plus e and f on 6309) PAIR16 m_x, m_y; // index registers PAIR16 m_u, m_s; // stack pointers - UINT8 m_dp; // direct page register - UINT8 m_cc; + uint8_t m_dp; // direct page register + uint8_t m_cc; PAIR16 m_temp; - UINT8 m_opcode; + uint8_t m_opcode; // other internal state - UINT8 * m_reg8; + uint8_t * m_reg8; PAIR16 * m_reg16; int m_reg; bool m_nmi_line; @@ -194,41 +194,41 @@ protected: void eat_remaining(); // read a byte from given memory location - inline UINT8 read_memory(UINT16 address) { eat(1); return m_mintf->read(address); } + inline uint8_t read_memory(uint16_t address) { eat(1); return m_mintf->read(address); } // write a byte to given memory location - inline void write_memory(UINT16 address, UINT8 data) { eat(1); m_mintf->write(address, data); } + inline void write_memory(uint16_t address, uint8_t data) { eat(1); m_mintf->write(address, data); } // read_opcode() is like read_memory() except it is used for reading opcodes. In the case of a system // with memory mapped I/O, this function can be used to greatly speed up emulation. - inline UINT8 read_opcode(UINT16 address) { eat(1); return m_mintf->read_opcode(address); } + inline uint8_t read_opcode(uint16_t address) { eat(1); return m_mintf->read_opcode(address); } // read_opcode_arg() is identical to read_opcode() except it is used for reading opcode arguments. This // difference can be used to support systems that use different encoding mechanisms for opcodes // and opcode arguments. - inline UINT8 read_opcode_arg(UINT16 address) { eat(1); return m_mintf->read_opcode_arg(address); } + inline uint8_t read_opcode_arg(uint16_t address) { eat(1); return m_mintf->read_opcode_arg(address); } // read_opcode() and bump the program counter - inline UINT8 read_opcode() { return read_opcode(m_pc.w++); } - inline UINT8 read_opcode_arg() { return read_opcode_arg(m_pc.w++); } + inline uint8_t read_opcode() { return read_opcode(m_pc.w++); } + inline uint8_t read_opcode_arg() { return read_opcode_arg(m_pc.w++); } - // state stack - implemented as a UINT32 - void push_state(UINT8 state) { m_state = (m_state << 8) | state; } - UINT8 pop_state() { UINT8 result = (UINT8) m_state; m_state >>= 8; return result; } + // state stack - implemented as a uint32_t + void push_state(uint8_t state) { m_state = (m_state << 8) | state; } + uint8_t pop_state() { uint8_t result = (uint8_t) m_state; m_state >>= 8; return result; } void reset_state() { m_state = 0; } // effective address reading/writing - UINT8 read_ea() { return read_memory(m_ea.w); } - void write_ea(UINT8 data) { write_memory(m_ea.w, data); } - void set_ea(UINT16 ea) { m_ea.w = ea; m_addressing_mode = ADDRESSING_MODE_EA; } - void set_ea_h(UINT8 ea_h) { m_ea.b.h = ea_h; } - void set_ea_l(UINT8 ea_l) { m_ea.b.l = ea_l; m_addressing_mode = ADDRESSING_MODE_EA; } + uint8_t read_ea() { return read_memory(m_ea.w); } + void write_ea(uint8_t data) { write_memory(m_ea.w, data); } + void set_ea(uint16_t ea) { m_ea.w = ea; m_addressing_mode = ADDRESSING_MODE_EA; } + void set_ea_h(uint8_t ea_h) { m_ea.b.h = ea_h; } + void set_ea_l(uint8_t ea_l) { m_ea.b.l = ea_l; m_addressing_mode = ADDRESSING_MODE_EA; } // operand reading/writing - UINT8 read_operand(); - UINT8 read_operand(int ordinal); - void write_operand(UINT8 data); - void write_operand(int ordinal, UINT8 data); + uint8_t read_operand(); + uint8_t read_operand(int ordinal); + void write_operand(uint8_t data); + void write_operand(int ordinal, uint8_t data); // instructions void daa(); @@ -237,25 +237,25 @@ protected: // miscellaneous void nop() { } template<class T> T rotate_right(T value); - template<class T> UINT32 rotate_left(T value); + template<class T> uint32_t rotate_left(T value); void set_a() { m_addressing_mode = ADDRESSING_MODE_REGISTER_A; } void set_b() { m_addressing_mode = ADDRESSING_MODE_REGISTER_B; } void set_d() { m_addressing_mode = ADDRESSING_MODE_REGISTER_D; } void set_imm() { m_addressing_mode = ADDRESSING_MODE_IMMEDIATE; } - void set_regop8(UINT8 ®) { m_reg8 = ® m_reg16 = nullptr; } + void set_regop8(uint8_t ®) { m_reg8 = ® m_reg16 = nullptr; } void set_regop16(PAIR16 ®) { m_reg16 = ® m_reg8 = nullptr; } - UINT8 ®op8() { assert(m_reg8 != nullptr); return *m_reg8; } + uint8_t ®op8() { assert(m_reg8 != nullptr); return *m_reg8; } PAIR16 ®op16() { assert(m_reg16 != nullptr); return *m_reg16; } bool is_register_register_op_16_bit() { return m_reg16 != nullptr; } bool add8_sets_h() { return true; } bool hd6309_native_mode() { return false; } // index reg - UINT16 &ireg(); + uint16_t &ireg(); // flags - template<class T> T set_flags(UINT8 mask, T a, T b, UINT32 r); - template<class T> T set_flags(UINT8 mask, T r); + template<class T> T set_flags(uint8_t mask, T a, T b, uint32_t r); + template<class T> T set_flags(uint8_t mask, T r); // branch conditions inline bool cond_hi() { return !(m_cc & CC_ZC); } // BHI/BLS @@ -270,15 +270,15 @@ protected: // interrupt registers bool firq_saves_entire_state() { return false; } - UINT16 partial_state_registers() { return 0x81; } - UINT16 entire_state_registers() { return 0xFF; } + uint16_t partial_state_registers() { return 0x81; } + uint16_t entire_state_registers() { return 0xFF; } // miscellaneous - inline exgtfr_register read_exgtfr_register(UINT8 reg); - inline void write_exgtfr_register(UINT8 reg, exgtfr_register value); + inline exgtfr_register read_exgtfr_register(uint8_t reg); + inline void write_exgtfr_register(uint8_t reg, exgtfr_register value); bool is_register_addressing_mode(); bool is_ea_addressing_mode() { return m_addressing_mode == ADDRESSING_MODE_EA; } - UINT16 get_pending_interrupt(); + uint16_t get_pending_interrupt(); void log_illegal(); private: @@ -287,7 +287,7 @@ private: const address_space_config m_sprogram_config; // other state - UINT32 m_state; + uint32_t m_state; bool m_cond; // incidentals @@ -304,7 +304,7 @@ class m6809_device : public m6809_base_device { public: // construction/destruction - m6809_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + m6809_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; // ======================> m6809e_device @@ -317,7 +317,7 @@ class m6809e_device : public m6809_base_device { public: // construction/destruction - m6809e_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + m6809e_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration helpers template<class _Object> static devcb_base &set_lic_cb(device_t &device, _Object object) { return downcast<m6809e_device &>(device).m_lic_func.set_callback(object); } diff --git a/src/devices/cpu/m6809/m6809.ops b/src/devices/cpu/m6809/m6809.ops index 7c554a3bac9..125be180ce5 100644 --- a/src/devices/cpu/m6809/m6809.ops +++ b/src/devices/cpu/m6809/m6809.ops @@ -479,19 +479,19 @@ INDEXED: case 0x05: case 0x25: case 0x45: case 0x65: case 0x15: case 0x35: case 0x55: case 0x75: - m_temp.w = ireg() + (INT8) m_q.r.b; + m_temp.w = ireg() + (int8_t) m_q.r.b; eat(2); break; case 0x06: case 0x26: case 0x46: case 0x66: case 0x16: case 0x36: case 0x56: case 0x76: - m_temp.w = ireg() + (INT8) m_q.r.a; + m_temp.w = ireg() + (int8_t) m_q.r.a; eat(2); break; case 0x08: case 0x28: case 0x48: case 0x68: case 0x18: case 0x38: case 0x58: case 0x78: - @m_temp.w = ireg() + (INT8) read_opcode_arg(); + @m_temp.w = ireg() + (int8_t) read_opcode_arg(); eat(1); break; @@ -512,7 +512,7 @@ INDEXED: case 0x0C: case 0x2C: case 0x4C: case 0x6C: case 0x1C: case 0x3C: case 0x5C: case 0x7C: @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_pc.w + (INT8) m_temp.b.l; + m_temp.w = m_pc.w + (int8_t) m_temp.b.l; eat(1); break; @@ -520,7 +520,7 @@ INDEXED: case 0x1D: case 0x3D: case 0x5D: case 0x7D: @m_temp.b.h = read_opcode_arg(); @m_temp.b.l = read_opcode_arg(); - m_temp.w = m_pc.w + (INT16) m_temp.w; + m_temp.w = m_pc.w + (int16_t) m_temp.w; eat(4); break; @@ -548,7 +548,7 @@ INDEXED: else { // 5-bit offset - m_temp.w = ireg() + (INT8) ((m_opcode & 0x0F) | (m_opcode & 0x10 ? 0xF0 : 0x00)); + m_temp.w = ireg() + (int8_t) ((m_opcode & 0x0F) | (m_opcode & 0x10 ? 0xF0 : 0x00)); eat(2); } @set_ea(m_temp.w); @@ -556,7 +556,7 @@ INDEXED: EXG: { - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg1 = read_exgtfr_register(param >> 4); exgtfr_register reg2 = read_exgtfr_register(param >> 0); write_exgtfr_register(param >> 4, reg2); @@ -567,7 +567,7 @@ EXG: TFR: { - UINT8 param = read_opcode_arg(); + uint8_t param = read_opcode_arg(); exgtfr_register reg = read_exgtfr_register(param >> 4); write_exgtfr_register(param >> 0, reg); if ((param & 0x0F) == 4) { diff --git a/src/devices/cpu/m6809/m6809inl.h b/src/devices/cpu/m6809/m6809inl.h index 88c282319c2..71bd4f22ec9 100644 --- a/src/devices/cpu/m6809/m6809inl.h +++ b/src/devices/cpu/m6809/m6809inl.h @@ -40,12 +40,12 @@ inline ATTR_FORCE_INLINE T m6809_base_device::rotate_right(T value) //------------------------------------------------- template<class T> -inline ATTR_FORCE_INLINE UINT32 m6809_base_device::rotate_left(T value) +inline ATTR_FORCE_INLINE uint32_t m6809_base_device::rotate_left(T value) { T high_bit = ((T) 1) << (sizeof(T) * 8 - 1); bool new_carry = (value & high_bit) ? true : false; - UINT32 new_value = value; + uint32_t new_value = value; new_value <<= 1; if (m_cc & CC_C) @@ -65,7 +65,7 @@ inline ATTR_FORCE_INLINE UINT32 m6809_base_device::rotate_left(T value) // read_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE UINT8 m6809_base_device::read_operand() +inline ATTR_FORCE_INLINE uint8_t m6809_base_device::read_operand() { switch(m_addressing_mode) { @@ -82,7 +82,7 @@ inline ATTR_FORCE_INLINE UINT8 m6809_base_device::read_operand() // read_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE UINT8 m6809_base_device::read_operand(int ordinal) +inline ATTR_FORCE_INLINE uint8_t m6809_base_device::read_operand(int ordinal) { switch(m_addressing_mode) { @@ -97,7 +97,7 @@ inline ATTR_FORCE_INLINE UINT8 m6809_base_device::read_operand(int ordinal) // write_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(UINT8 data) +inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(uint8_t data) { switch(m_addressing_mode) { @@ -114,7 +114,7 @@ inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(UINT8 data) // write_operand //------------------------------------------------- -inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, UINT8 data) +inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, uint8_t data) { switch(m_addressing_mode) { @@ -131,9 +131,9 @@ inline ATTR_FORCE_INLINE void m6809_base_device::write_operand(int ordinal, UINT inline ATTR_FORCE_INLINE void m6809_base_device::daa() { - UINT16 t, cf = 0; - UINT8 msn = m_q.r.a & 0xF0; - UINT8 lsn = m_q.r.a & 0x0F; + uint16_t t, cf = 0; + uint8_t msn = m_q.r.a & 0xF0; + uint8_t lsn = m_q.r.a & 0x0F; // compute the carry if (lsn > 0x09 || m_cc & CC_H) cf |= 0x06; @@ -148,7 +148,7 @@ inline ATTR_FORCE_INLINE void m6809_base_device::daa() m_cc |= CC_C; // and put it back into A - m_q.r.a = set_flags(CC_NZ, (UINT8) t); + m_q.r.a = set_flags(CC_NZ, (uint8_t) t); } @@ -159,7 +159,7 @@ inline ATTR_FORCE_INLINE void m6809_base_device::daa() inline ATTR_FORCE_INLINE void m6809_base_device::mul() { // perform multiply - UINT16 result = ((UINT16) m_q.r.a) * ((UINT16) m_q.r.b); + uint16_t result = ((uint16_t) m_q.r.a) * ((uint16_t) m_q.r.b); // set result and Z flag m_q.r.d = set_flags(CC_Z, result); @@ -176,7 +176,7 @@ inline ATTR_FORCE_INLINE void m6809_base_device::mul() // ireg //------------------------------------------------- -inline ATTR_FORCE_INLINE UINT16 &m6809_base_device::ireg() +inline ATTR_FORCE_INLINE uint16_t &m6809_base_device::ireg() { switch(m_opcode & 0x60) { @@ -196,7 +196,7 @@ inline ATTR_FORCE_INLINE UINT16 &m6809_base_device::ireg() //------------------------------------------------- template<class T> -inline T m6809_base_device::set_flags(UINT8 mask, T a, T b, UINT32 r) +inline T m6809_base_device::set_flags(uint8_t mask, T a, T b, uint32_t r) { T hi_bit = (T) (1 << (sizeof(T) * 8 - 1)); @@ -220,7 +220,7 @@ inline T m6809_base_device::set_flags(UINT8 mask, T a, T b, UINT32 r) //------------------------------------------------- template<class T> -inline T m6809_base_device::set_flags(UINT8 mask, T r) +inline T m6809_base_device::set_flags(uint8_t mask, T r) { return set_flags(mask, (T)0, r, r); } @@ -233,7 +233,7 @@ inline T m6809_base_device::set_flags(UINT8 mask, T r) inline void m6809_base_device::eat_remaining() { // we do this in order to be nice to people debugging - UINT16 real_pc = m_pc.w; + uint16_t real_pc = m_pc.w; eat(m_icount); @@ -260,7 +260,7 @@ inline bool m6809_base_device::is_register_addressing_mode() // get_pending_interrupt //------------------------------------------------- -inline UINT16 m6809_base_device::get_pending_interrupt() +inline uint16_t m6809_base_device::get_pending_interrupt() { if (m_nmi_asserted) return VECTOR_NMI; |