diff options
Diffstat (limited to 'src/devices/cpu/z8/z8dasm.cpp')
-rw-r--r-- | src/devices/cpu/z8/z8dasm.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/devices/cpu/z8/z8dasm.cpp b/src/devices/cpu/z8/z8dasm.cpp index 8cd29344f2a..a832dab8fe9 100644 --- a/src/devices/cpu/z8/z8dasm.cpp +++ b/src/devices/cpu/z8/z8dasm.cpp @@ -1,14 +1,14 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder + #include "emu.h" -#include "debugger.h" -#include "z8.h" +#include "z8dasm.h" /*************************************************************************** CONSTANTS ***************************************************************************/ -static const char *const REGISTER_NAME[256] = +const char *const z8_disassembler::REGISTER_NAME[256] = { "P0", "P1", "P2", "P3", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -28,7 +28,7 @@ static const char *const REGISTER_NAME[256] = "SIO", "TMR", "T1", "PRE1", "T0", "PRE0", "P2M", "P3M", "P01M", "IPR", "IRQ", "IMR", "FLAGS", "RP", "SPH", "SPL" }; -static const char *const CONDITION_CODE[16] = +const char *const z8_disassembler::CONDITION_CODE[16] = { "F", "LT", "LE", "ULE", "OV", "MI", "Z", "C", "", "GE", "GT", "UGT", "NOV", "PL", "NZ", "NC" @@ -50,8 +50,8 @@ static const char *const CONDITION_CODE[16] = #define DA "%04Xh" #define RA "%04Xh" -#define B0 oprom[0] -#define B1 oprom[1] +#define B0 opcodes.r8(pos) +#define B1 opcodes.r8(pos+1) #define B0H (B0 >> 4) #define B0L (B0 & 0x0f) #define OPH (opcode >> 4) @@ -74,19 +74,24 @@ static const char *const CONDITION_CODE[16] = #define illegal util::stream_format(stream, "Illegal") #define mnemonic(_mnemonic) util::stream_format(stream, "%-5s", _mnemonic) -#define bytes(_count) oprom += (_count - 1) -#define step_over flags = DASMFLAG_STEP_OVER -#define step_out flags = DASMFLAG_STEP_OUT +#define bytes(_count) pos += (_count - 1) +#define step_over flags = STEP_OVER +#define step_out flags = STEP_OUT /*************************************************************************** DISASSEMBLER ***************************************************************************/ -CPU_DISASSEMBLE(z8) +u32 z8_disassembler::opcode_alignment() const +{ + return 1; +} + +offs_t z8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { - const uint8_t *startrom = oprom; + offs_t pos = pc; uint32_t flags = 0; - uint8_t opcode = *oprom++; + uint8_t opcode = opcodes.r8(pos++); int argc = 0; switch (pc) @@ -97,7 +102,7 @@ CPU_DISASSEMBLE(z8) case 0x0006: case 0x0008: case 0x000a: - util::stream_format(stream, "IRQ%u Vector %04Xh", pc / 2, opcode << 8 | *oprom++); break; + util::stream_format(stream, "IRQ%u Vector %04Xh", pc / 2, opcode << 8 | opcodes.r8(pos++)); break; default: switch (opcode) { @@ -375,5 +380,5 @@ CPU_DISASSEMBLE(z8) } } - return (oprom - startrom) | flags | DASMFLAG_SUPPORTED; + return (pos - pc) | flags | SUPPORTED; } |