From 427fa75327daf2a70bf63e37b7d8e0c8efc398bd Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 13 May 2019 23:41:33 -0400 Subject: z8000: Pile on some extra address spaces (nw) --- src/devices/cpu/z8000/z8000.cpp | 195 +++++------- src/devices/cpu/z8000/z8000.h | 44 ++- src/devices/cpu/z8000/z8000ops.hxx | 627 +++++++++++++++++++++---------------- src/mame/drivers/c900.cpp | 7 + 4 files changed, 475 insertions(+), 398 deletions(-) diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp index ef210facf4c..3f8570abaff 100644 --- a/src/devices/cpu/z8000/z8000.cpp +++ b/src/devices/cpu/z8000/z8000.cpp @@ -35,7 +35,11 @@ z8002_device::z8002_device(const machine_config &mconfig, const char *tag, devic z8002_device::z8002_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int addrbits, int iobits, int vecmult) : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_BIG, 16, addrbits, 0) - , m_io_config("io", ENDIANNESS_BIG, iobits, 16, 0) + , m_data_config("data", ENDIANNESS_BIG, 16, addrbits, 0) + , m_io_config("I/O", ENDIANNESS_BIG, iobits, 16, 0) + , m_opcodes_config("first word", ENDIANNESS_BIG, 16, addrbits, 0) + , m_stack_config("stack", ENDIANNESS_BIG, 16, addrbits, 0) + , m_sio_config("special I/O", ENDIANNESS_BIG, iobits, 16, 0) , m_mo_out(*this) , m_ppc(0), m_pc(0), m_psapseg(0), m_psapoff(0), m_fcw(0), m_refresh(0), m_nspseg(0), m_nspoff(0), m_irq_req(0), m_irq_vec(0), m_op_valid(0), m_nmi_state(0), m_mi(0), m_program(nullptr), m_data(nullptr), m_cache(nullptr), m_io(nullptr), m_icount(0) , m_vector_mult(vecmult) @@ -45,26 +49,25 @@ z8002_device::z8002_device(const machine_config &mconfig, device_type type, cons z8001_device::z8001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : z8002_device(mconfig, Z8001, tag, owner, clock, 20, 16, 2) - , m_data_config("data", ENDIANNESS_BIG, 16, 20, 0) { } device_memory_interface::space_config_vector z8002_device::memory_space_config() const { - return space_config_vector { + auto spaces = space_config_vector { std::make_pair(AS_PROGRAM, &m_program_config), std::make_pair(AS_IO, &m_io_config) }; -} - -device_memory_interface::space_config_vector z8001_device::memory_space_config() const -{ - return space_config_vector { - std::make_pair(AS_PROGRAM, &m_program_config), - std::make_pair(AS_DATA, &m_data_config), - std::make_pair(AS_IO, &m_io_config) - }; + if (has_configured_map(AS_DATA)) + spaces.push_back(std::make_pair(AS_DATA, &m_data_config)); + if (has_configured_map(AS_OPCODES)) + spaces.push_back(std::make_pair(AS_OPCODES, &m_opcodes_config)); + if (has_configured_map(AS_STACK)) + spaces.push_back(std::make_pair(AS_STACK, &m_stack_config)); + if (has_configured_map(AS_SIO)) + spaces.push_back(std::make_pair(AS_SIO, &m_sio_config)); + return spaces; } bool z8002_device::get_segmented_mode() const @@ -92,7 +95,7 @@ uint32_t z8002_device::addr_sub(uint32_t addr, uint32_t subtrahend) uint16_t z8002_device::RDOP() { - uint16_t res = m_program->read_word(m_pc); + uint16_t res = m_opcache->read_word(m_pc); m_pc += 2; return res; } @@ -108,7 +111,7 @@ uint32_t z8002_device::get_operand(int opnum) if (! (m_op_valid & (1 << opnum))) { - m_op[opnum] = m_program->read_word(m_pc); + m_op[opnum] = m_cache->read_word(m_pc); m_pc += 2; m_op_valid |= (1 << opnum); } @@ -126,13 +129,13 @@ uint32_t z8002_device::get_addr_operand(int opnum) if (! (m_op_valid & (1 << opnum))) { - uint32_t seg = m_program->read_word(m_pc); + uint32_t seg = m_cache->read_word(m_pc); m_pc += 2; if (get_segmented_mode()) { if (seg & 0x8000) { - m_op[opnum] = ((seg & 0x7f00) << 8) | m_program->read_word(m_pc); + m_op[opnum] = ((seg & 0x7f00) << 8) | m_cache->read_word(m_pc); m_pc += 2; } else @@ -156,13 +159,13 @@ uint32_t z8002_device::get_raw_addr_operand(int opnum) if (! (m_op_valid & (1 << opnum))) { - uint32_t seg = m_program->read_word(m_pc); + uint32_t seg = m_cache->read_word(m_pc); m_pc += 2; if (get_segmented_mode()) { if (seg & 0x8000) { - m_op[opnum] = (seg << 16) | m_program->read_word(m_pc); + m_op[opnum] = (seg << 16) | m_cache->read_word(m_pc); m_pc += 2; } else @@ -192,16 +195,13 @@ uint32_t z8001_device::adjust_addr_for_nonseg_mode(uint32_t addr) } } -uint8_t z8002_device::RDMEM_B(int spacenum, uint32_t addr) +uint8_t z8002_device::RDMEM_B(address_space &space, uint32_t addr) { addr = adjust_addr_for_nonseg_mode(addr); - if (spacenum == AS_PROGRAM) - return m_program->read_byte(addr); - else - return m_data->read_byte(addr); + return space.read_byte(addr); } -uint16_t z8002_device::RDMEM_W(int spacenum, uint32_t addr) +uint16_t z8002_device::RDMEM_W(address_space &space, uint32_t addr) { addr = adjust_addr_for_nonseg_mode(addr); addr &= ~1; @@ -210,62 +210,37 @@ uint16_t z8002_device::RDMEM_W(int spacenum, uint32_t addr) m_irq_req = Z8000_SEGTRAP; return 0xffff; } - if (spacenum == AS_PROGRAM) - return m_program->read_word(addr); - else - return m_data->read_word(addr); + return space.read_word(addr); } -uint32_t z8002_device::RDMEM_L(int spacenum, uint32_t addr) +uint32_t z8002_device::RDMEM_L(address_space &space, uint32_t addr) { uint32_t result; addr = adjust_addr_for_nonseg_mode(addr); addr &= ~1; - if (spacenum == AS_PROGRAM) - { - result = m_program->read_word(addr) << 16; - return result + m_program->read_word(addr_add(addr, 2)); - } - else - { - result = m_data->read_word(addr) << 16; - return result + m_data->read_word(addr_add(addr, 2)); - } + result = space.read_word(addr) << 16; + return result + space.read_word(addr_add(addr, 2)); } -void z8002_device::WRMEM_B(int spacenum, uint32_t addr, uint8_t value) +void z8002_device::WRMEM_B(address_space &space, uint32_t addr, uint8_t value) { addr = adjust_addr_for_nonseg_mode(addr); - if (spacenum == AS_PROGRAM) - m_program->write_byte(addr, value); - else - m_data->write_byte(addr, value); + space.write_byte(addr, value); } -void z8002_device::WRMEM_W(int spacenum, uint32_t addr, uint16_t value) +void z8002_device::WRMEM_W(address_space &space, uint32_t addr, uint16_t value) { addr = adjust_addr_for_nonseg_mode(addr); addr &= ~1; - if (spacenum == AS_PROGRAM) - m_program->write_word(addr, value); - else - m_data->write_word(addr, value); + space.write_word(addr, value); } -void z8002_device::WRMEM_L(int spacenum, uint32_t addr, uint32_t value) +void z8002_device::WRMEM_L(address_space &space, uint32_t addr, uint32_t value) { addr = adjust_addr_for_nonseg_mode(addr); addr &= ~1; - if (spacenum == AS_PROGRAM) - { - m_program->write_word(addr, value >> 16); - m_program->write_word(addr_add(addr, 2), value & 0xffff); - } - else - { - m_data->write_word(addr, value >> 16); - m_data->write_word(addr_add(addr, 2), value & 0xffff); - } + space.write_word(addr, value >> 16); + space.write_word(addr_add(addr, 2), value & 0xffff); } uint8_t z8002_device::RDPORT_B(int mode, uint16_t addr) @@ -277,7 +252,7 @@ uint8_t z8002_device::RDPORT_B(int mode, uint16_t addr) else { /* how to handle MMU reads? for now just do it */ - return m_io->read_byte(addr); + return m_sio->read_byte(addr); } } @@ -292,7 +267,7 @@ uint16_t z8002_device::RDPORT_W(int mode, uint16_t addr) else { /* how to handle MMU reads? */ - return 0x0000; + return m_sio->read_word_unaligned((uint16_t)addr); } } @@ -305,7 +280,7 @@ uint16_t z8001_device::RDPORT_W(int mode, uint16_t addr) else { /* how to handle MMU reads? */ - return 0x0000; + return m_sio->read_word_unaligned((uint16_t)addr); } } @@ -318,7 +293,7 @@ void z8002_device::WRPORT_B(int mode, uint16_t addr, uint8_t value) else { /* how to handle MMU writes? for now just do it */ - m_io->write_byte(addr,value); + m_sio->write_byte(addr,value); } } @@ -333,6 +308,7 @@ void z8002_device::WRPORT_W(int mode, uint16_t addr, uint16_t value) else { /* how to handle MMU writes? */ + m_sio->write_word_unaligned((uint16_t)addr, value); } } @@ -345,6 +321,7 @@ void z8001_device::WRPORT_W(int mode, uint16_t addr, uint16_t value) else { /* how to handle MMU writes? */ + m_sio->write_word_unaligned((uint16_t)addr, value); } } @@ -403,22 +380,22 @@ void z8001_device::PUSH_PC() uint32_t z8002_device::GET_PC(uint32_t VEC) { - return RDMEM_W(AS_PROGRAM, VEC + 2); + return RDMEM_W(*m_program, VEC + 2); } uint32_t z8001_device::GET_PC(uint32_t VEC) { - return segmented_addr(RDMEM_L(AS_PROGRAM, VEC + 4)); + return segmented_addr(RDMEM_L(*m_program, VEC + 4)); } uint16_t z8002_device::GET_FCW(uint32_t VEC) { - return RDMEM_W(AS_PROGRAM, VEC); + return RDMEM_W(*m_program, VEC); } uint16_t z8001_device::GET_FCW(uint32_t VEC) { - return RDMEM_W(AS_PROGRAM, VEC + 2); + return RDMEM_W(*m_program, VEC + 2); } uint32_t z8002_device::F_SEG_Z8001() @@ -464,7 +441,7 @@ void z8002_device::Interrupt() CHANGE_FCW(fcw | F_S_N | F_SEG_Z8001());/* switch to segmented (on Z8001) system mode */ PUSH_PC(); PUSHW(SP, fcw); /* save current m_fcw */ - PUSHW(SP, RDMEM_W(AS_PROGRAM, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ + PUSHW(SP, RDMEM_W(*m_program, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ m_irq_req &= ~Z8000_EPU; CHANGE_FCW(GET_FCW(EPU)); m_pc = GET_PC(EPU); @@ -476,7 +453,7 @@ void z8002_device::Interrupt() CHANGE_FCW(fcw | F_S_N | F_SEG_Z8001());/* switch to segmented (on Z8001) system mode */ PUSH_PC(); PUSHW(SP, fcw); /* save current m_fcw */ - PUSHW(SP, RDMEM_W(AS_PROGRAM, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ + PUSHW(SP, RDMEM_W(*m_program, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ m_irq_req &= ~Z8000_TRAP; CHANGE_FCW(GET_FCW(TRAP)); m_pc = GET_PC(TRAP); @@ -488,7 +465,7 @@ void z8002_device::Interrupt() CHANGE_FCW(fcw | F_S_N | F_SEG_Z8001());/* switch to segmented (on Z8001) system mode */ PUSH_PC(); PUSHW(SP, fcw); /* save current m_fcw */ - PUSHW(SP, RDMEM_W(AS_PROGRAM, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ + PUSHW(SP, RDMEM_W(*m_program, m_ppc)); /* for internal traps, the 1st word of the instruction is pushed */ m_irq_req &= ~Z8000_SYSCALL; CHANGE_FCW(GET_FCW(SYSCALL)); m_pc = GET_PC(SYSCALL); @@ -513,7 +490,7 @@ void z8002_device::Interrupt() PUSH_PC(); PUSHW(SP, fcw); /* save current m_fcw */ PUSHW(SP, m_irq_req); /* save interrupt/trap type tag */ - m_pc = RDMEM_W(AS_PROGRAM, NMI); + m_pc = RDMEM_W(*m_program, NMI); m_irq_req &= ~Z8000_NMI; CHANGE_FCW(GET_FCW(NMI)); m_pc = GET_PC(NMI); @@ -547,13 +524,13 @@ void z8002_device::Interrupt() uint32_t z8002_device::read_irq_vector() { - return RDMEM_W(AS_PROGRAM, VEC00 + 2 * (m_irq_req & 0xff)); + return RDMEM_W(*m_program, VEC00 + 2 * (m_irq_req & 0xff)); } uint32_t z8001_device::read_irq_vector() { - return segmented_addr(RDMEM_L(AS_PROGRAM, VEC00 + 4 * (m_irq_req & 0xff))); + return segmented_addr(RDMEM_L(*m_program, VEC00 + 4 * (m_irq_req & 0xff))); } @@ -658,6 +635,31 @@ void z8002_device::register_save_state() save_item(NAME(m_vector_mult)); } +void z8002_device::init_spaces() +{ + m_program = &space(AS_PROGRAM); + /* If the system decodes STn lines to distinguish between data and program memory fetches, + install the data space. If it doesn't, install the program memory into data memory space. */ + if (has_space(AS_DATA)) + m_data = &space(AS_DATA); + else + m_data = m_program; + if (has_space(AS_STACK)) + m_stack = &space(AS_STACK); + else + m_stack = m_data; + m_cache = m_program->cache<1, 0, ENDIANNESS_BIG>(); + if (has_space(AS_OPCODES)) + m_opcache = space(AS_OPCODES).cache<1, 0, ENDIANNESS_BIG>(); + else + m_opcache = m_cache; + m_io = &space(AS_IO); + if (has_space(AS_SIO)) + m_sio = &space(AS_SIO); + else + m_sio = m_io; +} + void z8002_device::init_tables() { /* set up the zero, sign, parity lookup table */ @@ -676,44 +678,11 @@ std::unique_ptr z8002_device::create_disassembler() return std::make_unique(this); } -void z8001_device::device_start() -{ - clear_internal_state(); - - m_program = &space(AS_PROGRAM); - /* If the system decodes STn lines to distinguish between data and program memory fetches, - install the data space. If it doesn't, install the program memory into data memory space. */ - if (has_space(AS_DATA)) - m_data = &space(AS_DATA); - else - m_data = &space(AS_PROGRAM); - m_cache = m_program->cache<1, 0, ENDIANNESS_BIG>(); - m_io = &space(AS_IO); - - init_tables(); - - register_debug_state(); - register_save_state(); - - set_icountptr(m_icount); - m_mo_out.resolve_safe(); - m_mi = CLEAR_LINE; -} - void z8002_device::device_start() { clear_internal_state(); - m_program = &space(AS_PROGRAM); - /* If the system decodes STn lines to distinguish between data and program memory fetches, - install the data space. If it doesn't, install the program memory into data memory space. */ - if (has_space(AS_DATA)) - m_data = &space(AS_DATA); - else - m_data = &space(AS_PROGRAM); - m_cache = m_program->cache<1, 0, ENDIANNESS_BIG>(); - m_io = &space(AS_IO); - + init_spaces(); init_tables(); register_debug_state(); @@ -726,22 +695,22 @@ void z8002_device::device_start() void z8001_device::device_reset() { - m_fcw = RDMEM_W(AS_PROGRAM, 2); /* get reset m_fcw */ + m_fcw = RDMEM_W(*m_program, 2); /* get reset m_fcw */ if(m_fcw & F_SEG) { - m_pc = ((RDMEM_W(AS_PROGRAM, 4) & 0x0700) << 8) | (RDMEM_W(AS_PROGRAM, 6) & 0xffff); /* get reset m_pc */ + m_pc = ((RDMEM_W(*m_program, 4) & 0x0700) << 8) | (RDMEM_W(*m_program, 6) & 0xffff); /* get reset m_pc */ } else { - m_pc = RDMEM_W(AS_PROGRAM, 4); /* get reset m_pc */ + m_pc = RDMEM_W(*m_program, 4); /* get reset m_pc */ } m_ppc = m_pc; } void z8002_device::device_reset() { - m_fcw = RDMEM_W(AS_PROGRAM, 2); /* get reset m_fcw */ - m_pc = RDMEM_W(AS_PROGRAM, 4); /* get reset m_pc */ + m_fcw = RDMEM_W(*m_program, 2); /* get reset m_fcw */ + m_pc = RDMEM_W(*m_program, 4); /* get reset m_pc */ m_ppc = m_pc; } diff --git a/src/devices/cpu/z8000/z8000.h b/src/devices/cpu/z8000/z8000.h index 6defce263df..5dc360fa3fd 100644 --- a/src/devices/cpu/z8000/z8000.h +++ b/src/devices/cpu/z8000/z8000.h @@ -40,6 +40,12 @@ public: NMI_LINE = INPUT_LINE_NMI }; + enum + { + AS_STACK = AS_OPCODES + 1, + AS_SIO = AS_OPCODES + 2 + }; + // construction/destruction z8002_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~z8002_device(); @@ -72,10 +78,15 @@ protected: // device_disasm_interface overrides virtual std::unique_ptr create_disassembler() override; + void init_spaces(); void init_tables(); address_space_config m_program_config; + address_space_config m_data_config; address_space_config m_io_config; + address_space_config m_opcodes_config; + address_space_config m_stack_config; + address_space_config m_sio_config; devcb_write_line m_mo_out; uint32_t m_op[4]; /* opcodes/data of current instruction */ @@ -102,8 +113,11 @@ protected: int m_mi; address_space *m_program; address_space *m_data; + address_space *m_stack; memory_access_cache<1, 0, ENDIANNESS_BIG> *m_cache; + memory_access_cache<1, 0, ENDIANNESS_BIG> *m_opcache; address_space *m_io; + address_space *m_sio; int m_icount; int m_vector_mult; @@ -118,12 +132,12 @@ protected: inline uint32_t get_addr_operand(int opnum); inline uint32_t get_raw_addr_operand(int opnum); virtual uint32_t adjust_addr_for_nonseg_mode(uint32_t addr); - inline uint8_t RDMEM_B(int spacenum, uint32_t addr); - inline uint16_t RDMEM_W(int spacenum, uint32_t addr); - inline uint32_t RDMEM_L(int spacenum, uint32_t addr); - inline void WRMEM_B(int spacenum, uint32_t addr, uint8_t value); - inline void WRMEM_W(int spacenum, uint32_t addr, uint16_t value); - inline void WRMEM_L(int spacenum, uint32_t addr, uint32_t value); + inline uint8_t RDMEM_B(address_space &space, uint32_t addr); + inline uint16_t RDMEM_W(address_space &space, uint32_t addr); + inline uint32_t RDMEM_L(address_space &space, uint32_t addr); + inline void WRMEM_B(address_space &space, uint32_t addr, uint8_t value); + inline void WRMEM_W(address_space &space, uint32_t addr, uint16_t value); + inline void WRMEM_L(address_space &space, uint32_t addr, uint32_t value); inline uint8_t RDPORT_B(int mode, uint16_t addr); virtual uint16_t RDPORT_W(int mode, uint16_t addr); inline void WRPORT_B(int mode, uint16_t addr, uint8_t value); @@ -139,6 +153,18 @@ protected: inline void add_to_addr_reg(int regno, uint16_t addend); inline void sub_from_addr_reg(int regno, uint16_t subtrahend); inline void set_pc(uint32_t addr); + inline uint8_t RDIR_B(uint8_t reg); + inline uint16_t RDIR_W(uint8_t reg); + inline uint32_t RDIR_L(uint8_t reg); + inline void WRIR_B(uint8_t reg, uint8_t value); + inline void WRIR_W(uint8_t reg, uint16_t value); + inline void WRIR_L(uint8_t reg, uint32_t value); + inline uint8_t RDBX_B(uint8_t reg, uint16_t idx); + inline uint16_t RDBX_W(uint8_t reg, uint16_t idx); + inline uint32_t RDBX_L(uint8_t reg, uint16_t idx); + inline void WRBX_B(uint8_t reg, uint16_t idx, uint8_t value); + inline void WRBX_W(uint8_t reg, uint16_t idx, uint16_t value); + inline void WRBX_L(uint8_t reg, uint16_t idx, uint32_t value); inline void PUSHW(uint8_t dst, uint16_t value); inline uint16_t POPW(uint8_t src); inline void PUSHL(uint8_t dst, uint32_t value); @@ -649,14 +675,8 @@ public: protected: // device-level overrides - virtual void device_start() override; virtual void device_reset() override; - // device_memory_interface overrides - virtual space_config_vector memory_space_config() const override; - - address_space_config m_data_config; - virtual bool get_segmented_mode() const override; virtual uint32_t adjust_addr_for_nonseg_mode(uint32_t addr) override; virtual uint16_t RDPORT_W(int mode, uint16_t addr) override; diff --git a/src/devices/cpu/z8000/z8000ops.hxx b/src/devices/cpu/z8000/z8000ops.hxx index 4599538525f..2ffb6edc26b 100644 --- a/src/devices/cpu/z8000/z8000ops.hxx +++ b/src/devices/cpu/z8000/z8000ops.hxx @@ -135,18 +135,78 @@ void z8002_device::set_pc(uint32_t addr) m_pc = (m_pc & 0xffff0000) | (addr & 0xffff); } +uint8_t z8002_device::RDIR_B(uint8_t reg) +{ + return RDMEM_B(reg == SP ? *m_stack : *m_data, addr_from_reg(reg)); +} + +uint16_t z8002_device::RDIR_W(uint8_t reg) +{ + return RDMEM_W(reg == SP ? *m_stack : *m_data, addr_from_reg(reg)); +} + +uint32_t z8002_device::RDIR_L(uint8_t reg) +{ + return RDMEM_L(reg == SP ? *m_stack : *m_data, addr_from_reg(reg)); +} + +void z8002_device::WRIR_B(uint8_t reg, uint8_t value) +{ + WRMEM_B(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value); +} + +void z8002_device::WRIR_W(uint8_t reg, uint16_t value) +{ + WRMEM_W(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value); +} + +void z8002_device::WRIR_L(uint8_t reg, uint32_t value) +{ + WRMEM_L(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value); +} + +uint8_t z8002_device::RDBX_B(uint8_t reg, uint16_t idx) +{ + return RDMEM_B(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx)); +} + +uint16_t z8002_device::RDBX_W(uint8_t reg, uint16_t idx) +{ + return RDMEM_W(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx)); +} + +uint32_t z8002_device::RDBX_L(uint8_t reg, uint16_t idx) +{ + return RDMEM_L(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx)); +} + +void z8002_device::WRBX_B(uint8_t reg, uint16_t idx, uint8_t value) +{ + WRMEM_B(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value); +} + +void z8002_device::WRBX_W(uint8_t reg, uint16_t idx, uint16_t value) +{ + WRMEM_W(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value); +} + +void z8002_device::WRBX_L(uint8_t reg, uint16_t idx, uint32_t value) +{ + WRMEM_L(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value); +} + void z8002_device::PUSHW(uint8_t dst, uint16_t value) { if (get_segmented_mode()) RW(dst | 1) -= 2; else RW(dst) -= 2; - WRMEM_W(AS_DATA, addr_from_reg(dst), value); + WRIR_W(dst, value); } uint16_t z8002_device::POPW(uint8_t src) { - uint16_t result = RDMEM_W(AS_DATA, addr_from_reg(src)); + uint16_t result = RDIR_W(src); if (get_segmented_mode()) RW(src | 1) += 2; else @@ -160,12 +220,12 @@ void z8002_device::PUSHL(uint8_t dst, uint32_t value) RW(dst | 1) -= 4; else RW(dst) -= 4; - WRMEM_L(AS_DATA, addr_from_reg(dst), value); + WRIR_L(dst, value); } uint32_t z8002_device::POPL(uint8_t src) { - uint32_t result = RDMEM_L(AS_DATA, addr_from_reg(src)); + uint32_t result = RDIR_L(src); if (get_segmented_mode()) RW(src | 1) += 4; else @@ -1223,7 +1283,7 @@ void z8002_device::Z00_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = ADDB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + RB(dst) = ADDB(RB(dst), RDIR_B(src)); } /****************************************** @@ -1245,7 +1305,7 @@ void z8002_device::Z01_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = ADDW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RW(dst) = ADDW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1267,7 +1327,7 @@ void z8002_device::Z02_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = SUBB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); /* EHC */ + RB(dst) = SUBB(RB(dst), RDIR_B(src)); /* EHC */ } /****************************************** @@ -1289,7 +1349,7 @@ void z8002_device::Z03_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = SUBW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RW(dst) = SUBW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1311,7 +1371,7 @@ void z8002_device::Z04_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = ORB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + RB(dst) = ORB(RB(dst), RDIR_B(src)); } /****************************************** @@ -1333,7 +1393,7 @@ void z8002_device::Z05_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = ORW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RW(dst) = ORW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1355,7 +1415,7 @@ void z8002_device::Z06_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = ANDB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + RB(dst) = ANDB(RB(dst), RDIR_B(src)); } /****************************************** @@ -1377,7 +1437,7 @@ void z8002_device::Z07_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = ANDW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RW(dst) = ANDW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1399,7 +1459,7 @@ void z8002_device::Z08_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = XORB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + RB(dst) = XORB(RB(dst), RDIR_B(src)); } /****************************************** @@ -1421,7 +1481,7 @@ void z8002_device::Z09_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = XORW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RW(dst) = XORW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1443,7 +1503,7 @@ void z8002_device::Z0A_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - CPB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RB(dst), RDIR_B(src)); } /****************************************** @@ -1465,7 +1525,7 @@ void z8002_device::Z0B_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - CPW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RW(dst), RDIR_W(src)); } /****************************************** @@ -1475,8 +1535,9 @@ void z8002_device::Z0B_ssN0_dddd() void z8002_device::Z0C_ddN0_0000() { GET_DST(OP0,NIB3); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, COMB(RDMEM_B(AS_DATA, addr))); + WRMEM_B(space, addr, COMB(RDMEM_B(space, addr))); } /****************************************** @@ -1487,7 +1548,7 @@ void z8002_device::Z0C_ddN0_0001_imm8() { GET_DST(OP0,NIB2); GET_IMM8(OP1); - CPB(RDMEM_B(AS_DATA, addr_from_reg(dst)), imm8); // @@@done + CPB(RDIR_B(dst), imm8); // @@@done } /****************************************** @@ -1497,8 +1558,9 @@ void z8002_device::Z0C_ddN0_0001_imm8() void z8002_device::Z0C_ddN0_0010() { GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, NEGB(RDMEM_B(AS_DATA, addr))); + WRMEM_B(space, addr, NEGB(RDMEM_B(space, addr))); } /****************************************** @@ -1508,7 +1570,7 @@ void z8002_device::Z0C_ddN0_0010() void z8002_device::Z0C_ddN0_0100() { GET_DST(OP0,NIB2); - TESTB(RDMEM_B(AS_DATA, addr_from_reg(dst))); + TESTB(RDIR_B(dst)); } /****************************************** @@ -1519,7 +1581,7 @@ void z8002_device::Z0C_ddN0_0101_imm8() { GET_DST(OP0,NIB2); GET_IMM8(OP1); - WRMEM_B(AS_DATA, addr_from_reg(dst), imm8); + WRIR_B(dst, imm8); } /****************************************** @@ -1529,9 +1591,10 @@ void z8002_device::Z0C_ddN0_0101_imm8() void z8002_device::Z0C_ddN0_0110() { GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - if (RDMEM_B(AS_DATA, addr) & S08) SET_S; else CLR_S; - WRMEM_B(AS_DATA, addr, 0xff); + if (RDMEM_B(space, addr) & S08) SET_S; else CLR_S; + WRMEM_B(space, addr, 0xff); } /****************************************** @@ -1541,7 +1604,7 @@ void z8002_device::Z0C_ddN0_0110() void z8002_device::Z0C_ddN0_1000() { GET_DST(OP0,NIB2); - WRMEM_B(AS_DATA, addr_from_reg(dst), 0); + WRIR_B(dst, 0); } /****************************************** @@ -1551,8 +1614,9 @@ void z8002_device::Z0C_ddN0_1000() void z8002_device::Z0D_ddN0_0000() { GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, COMW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(space, addr, COMW(RDMEM_W(space, addr))); } /****************************************** @@ -1563,7 +1627,7 @@ void z8002_device::Z0D_ddN0_0001_imm16() { GET_DST(OP0,NIB2); GET_IMM16(OP1); - CPW(RDMEM_W(AS_DATA, addr_from_reg(dst)), imm16); + CPW(RDIR_W(dst), imm16); } /****************************************** @@ -1573,8 +1637,9 @@ void z8002_device::Z0D_ddN0_0001_imm16() void z8002_device::Z0D_ddN0_0010() { GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, NEGW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(space, addr, NEGW(RDMEM_W(space, addr))); } /****************************************** @@ -1584,7 +1649,7 @@ void z8002_device::Z0D_ddN0_0010() void z8002_device::Z0D_ddN0_0100() { GET_DST(OP0,NIB2); - TESTW(RDMEM_W(AS_DATA, addr_from_reg(dst))); + TESTW(RDIR_W(dst)); } /****************************************** @@ -1595,7 +1660,7 @@ void z8002_device::Z0D_ddN0_0101_imm16() { GET_DST(OP0,NIB2); GET_IMM16(OP1); - WRMEM_W(AS_DATA, addr_from_reg(dst), imm16); + WRIR_W(dst, imm16); } /****************************************** @@ -1605,9 +1670,10 @@ void z8002_device::Z0D_ddN0_0101_imm16() void z8002_device::Z0D_ddN0_0110() { GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - if (RDMEM_W(AS_DATA, addr) & S16) SET_S; else CLR_S; - WRMEM_W(AS_DATA, addr, 0xffff); + if (RDMEM_W(space, addr) & S16) SET_S; else CLR_S; + WRMEM_W(space, addr, 0xffff); } /****************************************** @@ -1617,7 +1683,7 @@ void z8002_device::Z0D_ddN0_0110() void z8002_device::Z0D_ddN0_1000() { GET_DST(OP0,NIB2); - WRMEM_W(AS_DATA, addr_from_reg(dst), 0); + WRIR_W(dst, 0); } /****************************************** @@ -1680,7 +1746,7 @@ void z8002_device::Z10_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - CPL(RL(dst), RDMEM_L(AS_DATA, addr_from_reg(src))); + CPL(RL(dst), RDIR_L(src)); } /****************************************** @@ -1691,7 +1757,7 @@ void z8002_device::Z11_ddN0_ssN0() { GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); - PUSHL(dst, RDMEM_L(AS_DATA, addr_from_reg(src))); + PUSHL(dst, RDIR_L(src)); } /****************************************** @@ -1713,7 +1779,7 @@ void z8002_device::Z12_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RL(dst) = SUBL(RL(dst), RDMEM_L(AS_DATA, addr_from_reg(src))); + RL(dst) = SUBL(RL(dst), RDIR_L(src)); } /****************************************** @@ -1724,7 +1790,7 @@ void z8002_device::Z13_ddN0_ssN0() { GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); - PUSHW(dst, RDMEM_W(AS_DATA, addr_from_reg(src))); + PUSHW(dst, RDIR_W(src)); } /****************************************** @@ -1746,7 +1812,7 @@ void z8002_device::Z14_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RL(dst) = RDMEM_L( AS_DATA, addr_from_reg(src)); + RL(dst) = RDIR_L(src); } /****************************************** @@ -1779,7 +1845,7 @@ void z8002_device::Z16_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RL(dst) = ADDL(RL(dst), RDMEM_L(AS_DATA, addr_from_reg(src))); + RL(dst) = ADDL(RL(dst), RDIR_L(src)); } /****************************************** @@ -1790,7 +1856,7 @@ void z8002_device::Z17_ssN0_ddN0() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - WRMEM_W(AS_DATA, addr_from_reg(dst), POPW(src)); + WRIR_W(dst, POPW(src)); } /****************************************** @@ -1834,7 +1900,7 @@ void z8002_device::Z19_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RL(dst) = MULTW(RL(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RL(dst) = MULTW(RL(dst), RDIR_W(src)); } /****************************************** @@ -1856,7 +1922,7 @@ void z8002_device::Z1A_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RQ(dst) = DIVL(RQ(dst), RDMEM_L(AS_DATA, addr_from_reg(src))); + RQ(dst) = DIVL(RQ(dst), RDIR_L(src)); } /****************************************** @@ -1878,7 +1944,7 @@ void z8002_device::Z1B_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RL(dst) = DIVW(RL(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + RL(dst) = DIVW(RL(dst), RDIR_W(src)); } /****************************************** @@ -1888,7 +1954,7 @@ void z8002_device::Z1B_ssN0_dddd() void z8002_device::Z1C_ddN0_1000() { GET_DST(OP0,NIB2); - TESTL(RDMEM_L(AS_DATA, addr_from_reg(dst))); + TESTL(RDIR_L(dst)); } /****************************************** @@ -1900,9 +1966,10 @@ void z8002_device::Z1C_ddN0_1001_0000_ssss_0000_nmin1() GET_DST(OP0,NIB2); GET_CNT(OP1,NIB3); GET_SRC(OP1,NIB1); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); while (cnt-- >= 0) { - WRMEM_W(AS_DATA, addr, RW(src)); + WRMEM_W(space, addr, RW(src)); addr = addr_add(addr, 2); src = (src+1) & 15; } @@ -1917,9 +1984,10 @@ void z8002_device::Z1C_ssN0_0001_0000_dddd_0000_nmin1() GET_SRC(OP0,NIB2); GET_CNT(OP1,NIB3); GET_DST(OP1,NIB1); + address_space &space = src == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(src); while (cnt-- >= 0) { - RW(dst) = RDMEM_W(AS_DATA, addr); + RW(dst) = RDMEM_W(space, addr); addr = addr_add(addr, 2); dst = (dst+1) & 15; } @@ -1933,7 +2001,7 @@ void z8002_device::Z1D_ddN0_ssss() { GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); - WRMEM_L(AS_DATA, addr_from_reg(dst), RL(src)); + WRIR_L(dst, RL(src)); } /****************************************** @@ -1986,7 +2054,7 @@ void z8002_device::Z20_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RB(dst) = RDMEM_B(AS_DATA, addr_from_reg(src)); + RB(dst) = RDIR_B(src); } /****************************************** @@ -2008,7 +2076,7 @@ void z8002_device::Z21_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); - RW(dst) = RDMEM_W(AS_DATA, addr_from_reg(src)); + RW(dst) = RDIR_W(src); } /****************************************** @@ -2030,8 +2098,9 @@ void z8002_device::Z22_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) & ~bit); + WRMEM_B(space, addr, RDMEM_B(space, addr) & ~bit); } /****************************************** @@ -2053,8 +2122,9 @@ void z8002_device::Z23_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) & ~bit); + WRMEM_W(space, addr, RDMEM_W(space, addr) & ~bit); } /****************************************** @@ -2076,8 +2146,9 @@ void z8002_device::Z24_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) | bit); + WRMEM_B(space, addr, RDMEM_B(space, addr) | bit); } /****************************************** @@ -2099,8 +2170,9 @@ void z8002_device::Z25_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) | bit); + WRMEM_W(space, addr, RDMEM_W(space, addr) | bit); } /****************************************** @@ -2122,7 +2194,7 @@ void z8002_device::Z26_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); - if (RDMEM_B(AS_DATA, addr_from_reg(dst)) & bit) CLR_Z; else SET_Z; + if (RDIR_B(dst) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -2144,7 +2216,7 @@ void z8002_device::Z27_ddN0_imm4() { GET_BIT(OP0); GET_DST(OP0,NIB2); - if (RDMEM_W(AS_DATA, addr_from_reg(dst)) & bit) CLR_Z; else SET_Z; + if (RDIR_W(dst) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -2155,8 +2227,9 @@ void z8002_device::Z28_ddN0_imm4m1() { GET_I4M1(OP0,NIB3); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, INCB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(space, addr, INCB(RDMEM_B(space, addr), i4p1)); } /****************************************** @@ -2167,8 +2240,9 @@ void z8002_device::Z29_ddN0_imm4m1() { GET_I4M1(OP0,NIB3); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, INCW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(space, addr, INCW(RDMEM_W(space, addr), i4p1)); } /****************************************** @@ -2179,8 +2253,9 @@ void z8002_device::Z2A_ddN0_imm4m1() { GET_I4M1(OP0,NIB3); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_B(AS_DATA, addr, DECB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(space, addr, DECB(RDMEM_B(space, addr), i4p1)); } /****************************************** @@ -2191,8 +2266,9 @@ void z8002_device::Z2B_ddN0_imm4m1() { GET_I4M1(OP0,NIB3); GET_DST(OP0,NIB2); + address_space &space = dst == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(dst); - WRMEM_W(AS_DATA, addr, DECW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(space, addr, DECW(RDMEM_W(space, addr), i4p1)); } /****************************************** @@ -2203,9 +2279,10 @@ void z8002_device::Z2C_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); + address_space &space = src == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(src); - uint8_t tmp = RDMEM_B( AS_DATA, addr); - WRMEM_B(AS_DATA, addr, RB(dst)); + uint8_t tmp = RDMEM_B(space, addr); + WRMEM_B(space, addr, RB(dst)); RB(dst) = tmp; } @@ -2217,9 +2294,10 @@ void z8002_device::Z2D_ssN0_dddd() { GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); + address_space &space = src == SP ? *m_stack : *m_data; uint32_t addr = addr_from_reg(src); - uint16_t tmp = RDMEM_W(AS_DATA, addr); - WRMEM_W(AS_DATA, addr, RW(dst)); + uint16_t tmp = RDMEM_W(space, addr); + WRMEM_W(space, addr, RW(dst)); RW(dst) = tmp; } @@ -2231,7 +2309,7 @@ void z8002_device::Z2E_ddN0_ssss() { GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); - WRMEM_B(AS_DATA, addr_from_reg(dst), RB(src)); + WRIR_B(dst, RB(src)); } /****************************************** @@ -2242,7 +2320,7 @@ void z8002_device::Z2F_ddN0_ssss() { GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); - WRMEM_W(AS_DATA, addr_from_reg(dst), RW(src)); + WRIR_W(dst, RW(src)); } /****************************************** @@ -2253,7 +2331,7 @@ void z8002_device::Z30_0000_dddd_dsp16() { GET_DST(OP0,NIB3); GET_DSP16; - RB(dst) = RDMEM_B(AS_PROGRAM, dsp16); + RB(dst) = RDMEM_B(*m_program, dsp16); } /****************************************** @@ -2265,8 +2343,7 @@ void z8002_device::Z30_ssN0_dddd_imm16() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(src), idx16); - RB(dst) = RDMEM_B(AS_DATA, idx16); + RB(dst) = RDBX_B(src, idx16); } /****************************************** @@ -2277,7 +2354,7 @@ void z8002_device::Z31_0000_dddd_dsp16() { GET_DST(OP0,NIB3); GET_DSP16; - RW(dst) = RDMEM_W(AS_PROGRAM, dsp16); + RW(dst) = RDMEM_W(*m_program, dsp16); } /****************************************** @@ -2289,8 +2366,7 @@ void z8002_device::Z31_ssN0_dddd_imm16() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(src), idx16); - RW(dst) = RDMEM_W(AS_DATA, idx16); + RW(dst) = RDBX_W(src, idx16); } /****************************************** @@ -2301,7 +2377,7 @@ void z8002_device::Z32_0000_ssss_dsp16() { GET_SRC(OP0,NIB3); GET_DSP16; - WRMEM_B(AS_PROGRAM, dsp16, RB(src)); + WRMEM_B(*m_program, dsp16, RB(src)); } /****************************************** @@ -2313,8 +2389,7 @@ void z8002_device::Z32_ddN0_ssss_imm16() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(dst), idx16); - WRMEM_B(AS_DATA, idx16, RB(src)); + WRBX_B(dst, idx16, RB(src)); } /****************************************** @@ -2325,7 +2400,7 @@ void z8002_device::Z33_0000_ssss_dsp16() { GET_SRC(OP0,NIB3); GET_DSP16; - WRMEM_W(AS_PROGRAM, dsp16, RW(src)); + WRMEM_W(*m_program, dsp16, RW(src)); } /****************************************** @@ -2337,8 +2412,7 @@ void z8002_device::Z33_ddN0_ssss_imm16() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(dst), idx16); - WRMEM_W(AS_DATA, idx16, RW(src)); + WRBX_W(dst, idx16, RW(src)); } /****************************************** @@ -2378,7 +2452,7 @@ void z8002_device::Z35_0000_dddd_dsp16() { GET_DST(OP0,NIB3); GET_DSP16; - RL(dst) = RDMEM_L(AS_PROGRAM, dsp16); + RL(dst) = RDMEM_L(*m_program, dsp16); } /****************************************** @@ -2390,8 +2464,7 @@ void z8002_device::Z35_ssN0_dddd_imm16() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(src), idx16); - RL(dst) = RDMEM_L(AS_DATA, idx16); + RL(dst) = RDBX_L(src, idx16); } /****************************************** @@ -2426,7 +2499,7 @@ void z8002_device::Z37_0000_ssss_dsp16() { GET_SRC(OP0,NIB3); GET_DSP16; - WRMEM_L(AS_PROGRAM, dsp16, RL(src)); + WRMEM_L(*m_program, dsp16, RL(src)); } /****************************************** @@ -2438,8 +2511,7 @@ void z8002_device::Z37_ddN0_ssss_imm16() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX16(OP1); - idx16 = addr_add(addr_from_reg(dst), idx16); - WRMEM_L(AS_DATA, idx16, RL(src)); + WRBX_L(dst, idx16, RL(src)); } /****************************************** @@ -2465,14 +2537,15 @@ void z8002_device::Z39_ssN0_0000() CHECK_PRIVILEGED_INSTR(); GET_SRC(OP0,NIB2); uint16_t fcw; + address_space &space = src == SP ? *m_stack : *m_data; if (get_segmented_mode()) { uint32_t addr = addr_from_reg(src); - fcw = RDMEM_W(AS_DATA, addr + 2); - set_pc(segmented_addr(RDMEM_L(AS_DATA, addr + 4))); + fcw = RDMEM_W(space, addr + 2); + set_pc(segmented_addr(RDMEM_L(space, addr + 4))); } else { - fcw = RDMEM_W(AS_DATA, RW(src)); - set_pc(RDMEM_W(AS_DATA, (uint16_t)(RW(src) + 2))); + fcw = RDMEM_W(space, RW(src)); + set_pc(RDMEM_W(space, (uint16_t)(RW(src) + 2))); } if ((fcw ^ m_fcw) & F_SEG) printf("ldps 1 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", m_pc, (m_fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-"); CHANGE_FCW(fcw); /* check for user/system mode change */ @@ -2489,7 +2562,7 @@ void z8002_device::Z3A_ssss_0000_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_B(AS_DATA, addr_from_reg(dst), RDPORT_B( 0, RW(src))); + WRIR_B(dst, RDPORT_B( 0, RW(src))); add_to_addr_reg(dst, 1); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; } @@ -2506,7 +2579,7 @@ void z8002_device::Z3A_ssss_0001_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_B(AS_DATA, RW(dst), RDPORT_B( 1, RW(src))); + WRIR_B(dst, RDPORT_B( 1, RW(src))); RW(dst)++; RW(src)++; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2524,7 +2597,7 @@ void z8002_device::Z3A_ssss_0010_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_B( 0, RW(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + WRPORT_B( 0, RW(dst), RDIR_B(src)); add_to_addr_reg(src, 1); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; } @@ -2541,7 +2614,7 @@ void z8002_device::Z3A_ssss_0011_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_B( 1, RW(dst), RDMEM_B(AS_DATA, RW(src))); + WRPORT_B( 1, RW(dst), RDIR_W(src)); RW(dst)++; RW(src)++; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2607,7 +2680,7 @@ void z8002_device::Z3A_ssss_1000_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_B(AS_DATA, RW(dst), RDPORT_B( 0, RW(src))); + WRIR_B(dst, RDPORT_B( 0, RW(src))); RW(dst)--; RW(src)--; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2625,7 +2698,7 @@ void z8002_device::Z3A_ssss_1001_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_B(AS_DATA, RW(dst), RDPORT_B( 1, RW(src))); + WRIR_B(dst, RDPORT_B( 1, RW(src))); RW(dst)--; RW(src)--; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2643,7 +2716,7 @@ void z8002_device::Z3A_ssss_1010_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_B( 0, RW(dst), RDMEM_B(AS_DATA, RW(src))); + WRPORT_B( 0, RW(dst), RDIR_B(src)); RW(dst)--; RW(src)--; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2661,7 +2734,7 @@ void z8002_device::Z3A_ssss_1011_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_B( 1, RW(dst), RDMEM_B(AS_DATA, RW(src))); + WRPORT_B( 1, RW(dst), RDIR_B(src)); RW(dst)--; RW(src)--; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2679,7 +2752,7 @@ void z8002_device::Z3B_ssss_0000_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, RW(dst), RDPORT_W( 0, RW(src))); + WRIR_W(dst, RDPORT_W( 0, RW(src))); RW(dst) += 2; RW(src) += 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2697,7 +2770,7 @@ void z8002_device::Z3B_ssss_0001_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, RW(dst), RDPORT_W( 1, RW(src))); + WRIR_W(dst, RDPORT_W( 1, RW(src))); RW(dst) += 2; RW(src) += 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2715,7 +2788,7 @@ void z8002_device::Z3B_ssss_0010_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_W( 0, RW(dst), RDMEM_W(AS_DATA, RW(src))); + WRPORT_W( 0, RW(dst), RDIR_W(src)); RW(dst) += 2; RW(src) += 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2733,7 +2806,7 @@ void z8002_device::Z3B_ssss_0011_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_W( 1, RW(dst), RDMEM_W(AS_DATA, RW(src))); + WRPORT_W( 1, RW(dst), RDIR_W(src)); RW(dst) += 2; RW(src) += 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2799,7 +2872,7 @@ void z8002_device::Z3B_ssss_1000_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, RW(dst), RDPORT_W( 0, RW(src))); + WRIR_W(dst, RDPORT_W( 0, RW(src))); RW(dst) -= 2; RW(src) -= 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2817,7 +2890,7 @@ void z8002_device::Z3B_ssss_1001_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, RW(dst), RDPORT_W( 1, RW(src))); + WRIR_W(dst, RDPORT_W( 1, RW(src))); RW(dst) -= 2; RW(src) -= 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2835,7 +2908,7 @@ void z8002_device::Z3B_ssss_1010_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_W( 0, RW(dst), RDMEM_W(AS_DATA, RW(src))); + WRPORT_W( 0, RW(dst), RDIR_W(src)); RW(dst) -= 2; RW(src) -= 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2853,7 +2926,7 @@ void z8002_device::Z3B_ssss_1011_0000_aaaa_dddd_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRPORT_W( 1, RW(dst), RDMEM_W(AS_DATA, RW(src))); + WRPORT_W( 1, RW(dst), RDIR_W(src)); RW(dst) -= 2; RW(src) -= 2; if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -2915,7 +2988,7 @@ void z8002_device::Z40_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = ADDB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ADDB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -2928,7 +3001,7 @@ void z8002_device::Z40_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = ADDB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ADDB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -2939,7 +3012,7 @@ void z8002_device::Z41_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = ADDW(RW(dst), RDMEM_W(AS_DATA, addr)); /* EHC */ + RW(dst) = ADDW(RW(dst), RDMEM_W(*m_data, addr)); /* EHC */ } /****************************************** @@ -2952,7 +3025,7 @@ void z8002_device::Z41_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = ADDW(RW(dst), RDMEM_W(AS_DATA, addr)); /* ASG */ + RW(dst) = ADDW(RW(dst), RDMEM_W(*m_data, addr)); /* ASG */ } /****************************************** @@ -2963,7 +3036,7 @@ void z8002_device::Z42_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = SUBB(RB(dst), RDMEM_B(AS_DATA, addr)); /* EHC */ + RB(dst) = SUBB(RB(dst), RDMEM_B(*m_data, addr)); /* EHC */ } /****************************************** @@ -2976,7 +3049,7 @@ void z8002_device::Z42_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = SUBB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = SUBB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -2987,7 +3060,7 @@ void z8002_device::Z43_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = SUBW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = SUBW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3000,7 +3073,7 @@ void z8002_device::Z43_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = SUBW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = SUBW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3011,7 +3084,7 @@ void z8002_device::Z44_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = ORB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ORB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3024,7 +3097,7 @@ void z8002_device::Z44_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = ORB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ORB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3035,7 +3108,7 @@ void z8002_device::Z45_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = ORW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = ORW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3048,7 +3121,7 @@ void z8002_device::Z45_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = ORW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = ORW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3059,7 +3132,7 @@ void z8002_device::Z46_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = ANDB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ANDB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3072,7 +3145,7 @@ void z8002_device::Z46_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = ANDB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = ANDB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3083,7 +3156,7 @@ void z8002_device::Z47_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = ANDW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = ANDW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3096,7 +3169,7 @@ void z8002_device::Z47_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = ANDW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = ANDW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3107,7 +3180,7 @@ void z8002_device::Z48_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = XORB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = XORB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3120,7 +3193,7 @@ void z8002_device::Z48_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = XORB(RB(dst), RDMEM_B(AS_DATA, addr)); + RB(dst) = XORB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3131,7 +3204,7 @@ void z8002_device::Z49_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = XORW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = XORW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3144,7 +3217,7 @@ void z8002_device::Z49_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = XORW(RW(dst), RDMEM_W(AS_DATA, addr)); + RW(dst) = XORW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3155,7 +3228,7 @@ void z8002_device::Z4A_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - CPB(RB(dst), RDMEM_B(AS_DATA, addr)); + CPB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3168,7 +3241,7 @@ void z8002_device::Z4A_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - CPB(RB(dst), RDMEM_B(AS_DATA, addr)); + CPB(RB(dst), RDMEM_B(*m_data, addr)); } /****************************************** @@ -3179,7 +3252,7 @@ void z8002_device::Z4B_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - CPW(RW(dst), RDMEM_W(AS_DATA, addr)); + CPW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3192,7 +3265,7 @@ void z8002_device::Z4B_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - CPW(RW(dst), RDMEM_W(AS_DATA, addr)); + CPW(RW(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3202,7 +3275,7 @@ void z8002_device::Z4B_ssN0_dddd_addr() void z8002_device::Z4C_0000_0000_addr() { GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, COMB(RDMEM_W(AS_DATA, addr))); + WRMEM_B(*m_data, addr, COMB(RDMEM_W(*m_data, addr))); } /****************************************** @@ -3213,7 +3286,7 @@ void z8002_device::Z4C_0000_0001_addr_imm8() { GET_ADDR(OP1); GET_IMM8(OP2); - CPB(RDMEM_B(AS_DATA, addr), imm8); + CPB(RDMEM_B(*m_data, addr), imm8); } /****************************************** @@ -3223,7 +3296,7 @@ void z8002_device::Z4C_0000_0001_addr_imm8() void z8002_device::Z4C_0000_0010_addr() { GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, NEGB(RDMEM_B(AS_DATA, addr))); + WRMEM_B(*m_data, addr, NEGB(RDMEM_B(*m_data, addr))); } /****************************************** @@ -3233,7 +3306,7 @@ void z8002_device::Z4C_0000_0010_addr() void z8002_device::Z4C_0000_0100_addr() { GET_ADDR(OP1); - TESTB(RDMEM_B(AS_DATA, addr)); + TESTB(RDMEM_B(*m_data, addr)); } /****************************************** @@ -3244,7 +3317,7 @@ void z8002_device::Z4C_0000_0101_addr_imm8() { GET_ADDR(OP1); GET_IMM8(OP2); - WRMEM_B(AS_DATA, addr, imm8); + WRMEM_B(*m_data, addr, imm8); } /****************************************** @@ -3254,8 +3327,8 @@ void z8002_device::Z4C_0000_0101_addr_imm8() void z8002_device::Z4C_0000_0110_addr() { GET_ADDR(OP1); - if (RDMEM_B(AS_DATA, addr) & S08) SET_S; else CLR_S; - WRMEM_B(AS_DATA, addr, 0xff); + if (RDMEM_B(*m_data, addr) & S08) SET_S; else CLR_S; + WRMEM_B(*m_data, addr, 0xff); } /****************************************** @@ -3265,7 +3338,7 @@ void z8002_device::Z4C_0000_0110_addr() void z8002_device::Z4C_0000_1000_addr() { GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, 0); + WRMEM_B(*m_data, addr, 0); } /****************************************** @@ -3277,7 +3350,7 @@ void z8002_device::Z4C_ddN0_0000_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, COMB(RDMEM_B(AS_DATA, addr))); + WRMEM_B(*m_data, addr, COMB(RDMEM_B(*m_data, addr))); } /****************************************** @@ -3290,7 +3363,7 @@ void z8002_device::Z4C_ddN0_0001_addr_imm8() GET_ADDR(OP1); GET_IMM8(OP2); addr = addr_add(addr, RW(dst)); - CPB(RDMEM_B(AS_DATA, addr), imm8); + CPB(RDMEM_B(*m_data, addr), imm8); } /****************************************** @@ -3302,7 +3375,7 @@ void z8002_device::Z4C_ddN0_0010_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, NEGB(RDMEM_B(AS_DATA, addr))); + WRMEM_B(*m_data, addr, NEGB(RDMEM_B(*m_data, addr))); } /****************************************** @@ -3314,7 +3387,7 @@ void z8002_device::Z4C_ddN0_0100_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - TESTB(RDMEM_B(AS_DATA, addr)); + TESTB(RDMEM_B(*m_data, addr)); } /****************************************** @@ -3327,7 +3400,7 @@ void z8002_device::Z4C_ddN0_0101_addr_imm8() GET_ADDR(OP1); GET_IMM8(OP2); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, imm8); + WRMEM_B(*m_data, addr, imm8); } /****************************************** @@ -3339,8 +3412,8 @@ void z8002_device::Z4C_ddN0_0110_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - if (RDMEM_B(AS_DATA, addr) & S08) SET_S; else CLR_S; - WRMEM_B(AS_DATA, addr, 0xff); + if (RDMEM_B(*m_data, addr) & S08) SET_S; else CLR_S; + WRMEM_B(*m_data, addr, 0xff); } /****************************************** @@ -3352,7 +3425,7 @@ void z8002_device::Z4C_ddN0_1000_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, 0); + WRMEM_B(*m_data, addr, 0); } /****************************************** @@ -3362,7 +3435,7 @@ void z8002_device::Z4C_ddN0_1000_addr() void z8002_device::Z4D_0000_0000_addr() { GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, COMW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(*m_data, addr, COMW(RDMEM_W(*m_data, addr))); } /****************************************** @@ -3373,7 +3446,7 @@ void z8002_device::Z4D_0000_0001_addr_imm16() { GET_ADDR(OP1); GET_IMM16(OP2); - CPW(RDMEM_W(AS_DATA, addr), imm16); + CPW(RDMEM_W(*m_data, addr), imm16); } /****************************************** @@ -3383,7 +3456,7 @@ void z8002_device::Z4D_0000_0001_addr_imm16() void z8002_device::Z4D_0000_0010_addr() { GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, NEGW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(*m_data, addr, NEGW(RDMEM_W(*m_data, addr))); } /****************************************** @@ -3393,7 +3466,7 @@ void z8002_device::Z4D_0000_0010_addr() void z8002_device::Z4D_0000_0100_addr() { GET_ADDR(OP1); - TESTW(RDMEM_W(AS_DATA, addr)); + TESTW(RDMEM_W(*m_data, addr)); } /****************************************** @@ -3404,7 +3477,7 @@ void z8002_device::Z4D_0000_0101_addr_imm16() { GET_ADDR(OP1); GET_IMM16(OP2); - WRMEM_W(AS_DATA, addr, imm16); + WRMEM_W(*m_data, addr, imm16); } /****************************************** @@ -3414,8 +3487,8 @@ void z8002_device::Z4D_0000_0101_addr_imm16() void z8002_device::Z4D_0000_0110_addr() { GET_ADDR(OP1); - if (RDMEM_W(AS_DATA, addr) & S16) SET_S; else CLR_S; - WRMEM_W(AS_DATA, addr, 0xffff); + if (RDMEM_W(*m_data, addr) & S16) SET_S; else CLR_S; + WRMEM_W(*m_data, addr, 0xffff); } /****************************************** @@ -3425,7 +3498,7 @@ void z8002_device::Z4D_0000_0110_addr() void z8002_device::Z4D_0000_1000_addr() { GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, 0); + WRMEM_W(*m_data, addr, 0); } /****************************************** @@ -3437,7 +3510,7 @@ void z8002_device::Z4D_ddN0_0000_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, COMW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(*m_data, addr, COMW(RDMEM_W(*m_data, addr))); } /****************************************** @@ -3450,7 +3523,7 @@ void z8002_device::Z4D_ddN0_0001_addr_imm16() GET_ADDR(OP1); GET_IMM16(OP2); addr = addr_add(addr, RW(dst)); - CPW(RDMEM_W(AS_DATA, addr), imm16); + CPW(RDMEM_W(*m_data, addr), imm16); } /****************************************** @@ -3462,7 +3535,7 @@ void z8002_device::Z4D_ddN0_0010_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, NEGW(RDMEM_W(AS_DATA, addr))); + WRMEM_W(*m_data, addr, NEGW(RDMEM_W(*m_data, addr))); } /****************************************** @@ -3474,7 +3547,7 @@ void z8002_device::Z4D_ddN0_0100_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - TESTW(RDMEM_W(AS_DATA, addr)); + TESTW(RDMEM_W(*m_data, addr)); } /****************************************** @@ -3487,7 +3560,7 @@ void z8002_device::Z4D_ddN0_0101_addr_imm16() GET_ADDR(OP1); GET_IMM16(OP2); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, imm16); + WRMEM_W(*m_data, addr, imm16); } /****************************************** @@ -3499,8 +3572,8 @@ void z8002_device::Z4D_ddN0_0110_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - if (RDMEM_W(AS_DATA, addr) & S16) SET_S; else CLR_S; - WRMEM_W(AS_DATA, addr, 0xffff); + if (RDMEM_W(*m_data, addr) & S16) SET_S; else CLR_S; + WRMEM_W(*m_data, addr, 0xffff); } /****************************************** @@ -3512,7 +3585,7 @@ void z8002_device::Z4D_ddN0_1000_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, 0); + WRMEM_W(*m_data, addr, 0); } /****************************************** @@ -3525,7 +3598,7 @@ void z8002_device::Z4E_ddN0_ssN0_addr() GET_SRC(OP0,NIB3); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, RB(src)); + WRMEM_B(*m_data, addr, RB(src)); } /****************************************** @@ -3536,7 +3609,7 @@ void z8002_device::Z50_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - CPL(RL(dst), RDMEM_L(AS_DATA, addr)); + CPL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3549,7 +3622,7 @@ void z8002_device::Z50_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - CPL(RL(dst), RDMEM_L(AS_DATA, addr)); + CPL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3560,7 +3633,7 @@ void z8002_device::Z51_ddN0_0000_addr() { GET_DST(OP0,NIB2); GET_ADDR(OP1); - PUSHL(dst, RDMEM_L(AS_DATA, addr)); + PUSHL(dst, RDMEM_L(*m_data, addr)); } /****************************************** @@ -3573,7 +3646,7 @@ void z8002_device::Z51_ddN0_ssN0_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - PUSHL(dst, RDMEM_L(AS_DATA, addr)); + PUSHL(dst, RDMEM_L(*m_data, addr)); } /****************************************** @@ -3584,7 +3657,7 @@ void z8002_device::Z52_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RL(dst) = SUBL(RL(dst), RDMEM_L(AS_DATA, addr)); + RL(dst) = SUBL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3597,7 +3670,7 @@ void z8002_device::Z52_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RL(dst) = SUBL(RL(dst), RDMEM_L(AS_DATA, addr)); + RL(dst) = SUBL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3608,7 +3681,7 @@ void z8002_device::Z53_ddN0_0000_addr() { GET_DST(OP0,NIB2); GET_ADDR(OP1); - PUSHW(dst, RDMEM_W(AS_DATA, addr)); + PUSHW(dst, RDMEM_W(*m_data, addr)); } /****************************************** @@ -3621,7 +3694,7 @@ void z8002_device::Z53_ddN0_ssN0_addr() GET_SRC(OP0,NIB3); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - PUSHW(dst, RDMEM_W(AS_DATA, addr)); + PUSHW(dst, RDMEM_W(*m_data, addr)); } /****************************************** @@ -3632,7 +3705,7 @@ void z8002_device::Z54_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RL(dst) = RDMEM_L(AS_DATA, addr); + RL(dst) = RDMEM_L(*m_data, addr); } /****************************************** @@ -3645,7 +3718,7 @@ void z8002_device::Z54_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RL(dst) = RDMEM_L(AS_DATA, addr); + RL(dst) = RDMEM_L(*m_data, addr); } /****************************************** @@ -3656,7 +3729,7 @@ void z8002_device::Z55_ssN0_0000_addr() { GET_SRC(OP0,NIB2); GET_ADDR(OP1); - WRMEM_L(AS_DATA, addr, POPL(src)); + WRMEM_L(*m_data, addr, POPL(src)); } /****************************************** @@ -3669,7 +3742,7 @@ void z8002_device::Z55_ssN0_ddN0_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_L(AS_DATA, addr, POPL(src)); + WRMEM_L(*m_data, addr, POPL(src)); } /****************************************** @@ -3680,7 +3753,7 @@ void z8002_device::Z56_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RL(dst) = ADDL(RL(dst), RDMEM_L(AS_DATA, addr)); + RL(dst) = ADDL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3693,7 +3766,7 @@ void z8002_device::Z56_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RL(dst) = ADDL(RL(dst), RDMEM_L(AS_DATA, addr)); + RL(dst) = ADDL(RL(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3704,7 +3777,7 @@ void z8002_device::Z57_ssN0_0000_addr() { GET_SRC(OP0,NIB2); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, POPW(src)); + WRMEM_W(*m_data, addr, POPW(src)); } /****************************************** @@ -3717,7 +3790,7 @@ void z8002_device::Z57_ssN0_ddN0_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, POPW(src)); + WRMEM_W(*m_data, addr, POPW(src)); } /****************************************** @@ -3728,7 +3801,7 @@ void z8002_device::Z58_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RQ(dst) = MULTL(RQ(dst), RDMEM_L(AS_DATA, addr)); + RQ(dst) = MULTL(RQ(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3741,7 +3814,7 @@ void z8002_device::Z58_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RQ(dst) = MULTL(RQ(dst), RDMEM_L(AS_DATA, addr)); + RQ(dst) = MULTL(RQ(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3752,7 +3825,7 @@ void z8002_device::Z59_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RL(dst) = MULTW(RL(dst), RDMEM_W(AS_DATA, addr)); + RL(dst) = MULTW(RL(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3765,7 +3838,7 @@ void z8002_device::Z59_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RL(dst) = MULTW(RL(dst), RDMEM_W(AS_DATA, addr)); + RL(dst) = MULTW(RL(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3776,7 +3849,7 @@ void z8002_device::Z5A_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RQ(dst) = DIVL(RQ(dst), RDMEM_L(AS_DATA, addr)); + RQ(dst) = DIVL(RQ(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3789,7 +3862,7 @@ void z8002_device::Z5A_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RQ(dst) = DIVL(RQ(dst), RDMEM_L(AS_DATA, addr)); + RQ(dst) = DIVL(RQ(dst), RDMEM_L(*m_data, addr)); } /****************************************** @@ -3800,7 +3873,7 @@ void z8002_device::Z5B_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RL(dst) = DIVW(RL(dst), RDMEM_W(AS_DATA, addr)); + RL(dst) = DIVW(RL(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3813,7 +3886,7 @@ void z8002_device::Z5B_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RL(dst) = DIVW(RL(dst), RDMEM_W(AS_DATA, addr)); + RL(dst) = DIVW(RL(dst), RDMEM_W(*m_data, addr)); } /****************************************** @@ -3826,7 +3899,7 @@ void z8002_device::Z5C_0000_0001_0000_dddd_0000_nmin1_addr() GET_CNT(OP1,NIB3); GET_ADDR(OP2); while (cnt-- >= 0) { - RW(dst) = RDMEM_W(AS_DATA, addr); + RW(dst) = RDMEM_W(*m_data, addr); dst = (dst+1) & 15; addr = addr_add (addr, 2); } @@ -3839,7 +3912,7 @@ void z8002_device::Z5C_0000_0001_0000_dddd_0000_nmin1_addr() void z8002_device::Z5C_0000_1000_addr() { GET_ADDR(OP1); - TESTL(RDMEM_L(AS_DATA, addr)); + TESTL(RDMEM_L(*m_data, addr)); } /****************************************** @@ -3852,7 +3925,7 @@ void z8002_device::Z5C_0000_1001_0000_ssss_0000_nmin1_addr() GET_CNT(OP1,NIB3); GET_ADDR(OP2); while (cnt-- >= 0) { - WRMEM_W(AS_DATA, addr, RW(src)); + WRMEM_W(*m_data, addr, RW(src)); src = (src+1) & 15; addr = addr_add (addr, 2); } @@ -3867,7 +3940,7 @@ void z8002_device::Z5C_ddN0_1000_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - TESTL(RDMEM_L(AS_DATA, addr)); + TESTL(RDMEM_L(*m_data, addr)); } /****************************************** @@ -3882,7 +3955,7 @@ void z8002_device::Z5C_ddN0_1001_0000_ssN0_0000_nmin1_addr() GET_ADDR(OP2); addr = addr_add(addr, RW(dst)); while (cnt-- >= 0) { - WRMEM_W(AS_DATA, addr, RW(src)); + WRMEM_W(*m_data, addr, RW(src)); src = (src+1) & 15; addr = addr_add(addr, 2); } @@ -3900,7 +3973,7 @@ void z8002_device::Z5C_ssN0_0001_0000_dddd_0000_nmin1_addr() GET_ADDR(OP2); addr = addr_add(addr, RW(src)); while (cnt-- >= 0) { - RW(dst) = RDMEM_W(AS_DATA, addr); + RW(dst) = RDMEM_W(*m_data, addr); dst = (dst+1) & 15; addr = addr_add(addr, 2); } @@ -3914,7 +3987,7 @@ void z8002_device::Z5D_0000_ssss_addr() { GET_SRC(OP0,NIB3); GET_ADDR(OP1); - WRMEM_L(AS_DATA, addr, RL(src)); + WRMEM_L(*m_data, addr, RL(src)); } /****************************************** @@ -3927,7 +4000,7 @@ void z8002_device::Z5D_ddN0_ssss_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_L(AS_DATA, addr, RL(src)); + WRMEM_L(*m_data, addr, RL(src)); } /****************************************** @@ -4026,7 +4099,7 @@ void z8002_device::Z60_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RB(dst) = RDMEM_B(AS_DATA, addr); + RB(dst) = RDMEM_B(*m_data, addr); } /****************************************** @@ -4039,7 +4112,7 @@ void z8002_device::Z60_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RB(dst) = RDMEM_B(AS_DATA, addr); + RB(dst) = RDMEM_B(*m_data, addr); } /****************************************** @@ -4050,7 +4123,7 @@ void z8002_device::Z61_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - RW(dst) = RDMEM_W(AS_DATA, addr); + RW(dst) = RDMEM_W(*m_data, addr); } /****************************************** @@ -4063,7 +4136,7 @@ void z8002_device::Z61_ssN0_dddd_addr() GET_SRC(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(src)); - RW(dst) = RDMEM_W(AS_DATA, addr); + RW(dst) = RDMEM_W(*m_data, addr); } /****************************************** @@ -4074,7 +4147,7 @@ void z8002_device::Z62_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) & ~bit); + WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) & ~bit); } /****************************************** @@ -4087,7 +4160,7 @@ void z8002_device::Z62_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) & ~bit); + WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) & ~bit); } /****************************************** @@ -4098,7 +4171,7 @@ void z8002_device::Z63_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) & ~bit); + WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) & ~bit); } /****************************************** @@ -4111,7 +4184,7 @@ void z8002_device::Z63_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) & ~bit); + WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) & ~bit); } /****************************************** @@ -4122,7 +4195,7 @@ void z8002_device::Z64_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) | bit); + WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) | bit); } /****************************************** @@ -4135,7 +4208,7 @@ void z8002_device::Z64_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, RDMEM_B(AS_DATA, addr) | bit); + WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) | bit); } /****************************************** @@ -4146,7 +4219,7 @@ void z8002_device::Z65_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) | bit); + WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) | bit); } /****************************************** @@ -4159,7 +4232,7 @@ void z8002_device::Z65_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, RDMEM_W(AS_DATA, addr) | bit); + WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) | bit); } /****************************************** @@ -4170,7 +4243,7 @@ void z8002_device::Z66_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - if (RDMEM_B(AS_DATA, addr) & bit) CLR_Z; else SET_Z; + if (RDMEM_B(*m_data, addr) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -4183,7 +4256,7 @@ void z8002_device::Z66_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - if (RDMEM_B(AS_DATA, addr) & bit) CLR_Z; else SET_Z; + if (RDMEM_B(*m_data, addr) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -4194,7 +4267,7 @@ void z8002_device::Z67_0000_imm4_addr() { GET_BIT(OP0); GET_ADDR(OP1); - if (RDMEM_W(AS_DATA, addr) & bit) CLR_Z; else SET_Z; + if (RDMEM_W(*m_data, addr) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -4207,7 +4280,7 @@ void z8002_device::Z67_ddN0_imm4_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - if (RDMEM_W(AS_DATA, addr) & bit) CLR_Z; else SET_Z; + if (RDMEM_W(*m_data, addr) & bit) CLR_Z; else SET_Z; } /****************************************** @@ -4218,7 +4291,7 @@ void z8002_device::Z68_0000_imm4m1_addr() { GET_I4M1(OP0,NIB3); GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, INCB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(*m_data, addr, INCB(RDMEM_B(*m_data, addr), i4p1)); } /****************************************** @@ -4231,7 +4304,7 @@ void z8002_device::Z68_ddN0_imm4m1_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, INCB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(*m_data, addr, INCB(RDMEM_B(*m_data, addr), i4p1)); } /****************************************** @@ -4242,7 +4315,7 @@ void z8002_device::Z69_0000_imm4m1_addr() { GET_I4M1(OP0,NIB3); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, INCW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(*m_data, addr, INCW(RDMEM_W(*m_data, addr), i4p1)); } /****************************************** @@ -4255,7 +4328,7 @@ void z8002_device::Z69_ddN0_imm4m1_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, INCW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(*m_data, addr, INCW(RDMEM_W(*m_data, addr), i4p1)); } /****************************************** @@ -4266,7 +4339,7 @@ void z8002_device::Z6A_0000_imm4m1_addr() { GET_I4M1(OP0,NIB3); GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, DECB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(*m_data, addr, DECB(RDMEM_B(*m_data, addr), i4p1)); } /****************************************** @@ -4279,7 +4352,7 @@ void z8002_device::Z6A_ddN0_imm4m1_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, DECB(RDMEM_B(AS_DATA, addr), i4p1)); + WRMEM_B(*m_data, addr, DECB(RDMEM_B(*m_data, addr), i4p1)); } /****************************************** @@ -4290,7 +4363,7 @@ void z8002_device::Z6B_0000_imm4m1_addr() { GET_I4M1(OP0,NIB3); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, DECW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(*m_data, addr, DECW(RDMEM_W(*m_data, addr), i4p1)); } /****************************************** @@ -4303,7 +4376,7 @@ void z8002_device::Z6B_ddN0_imm4m1_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, DECW(RDMEM_W(AS_DATA, addr), i4p1)); + WRMEM_W(*m_data, addr, DECW(RDMEM_W(*m_data, addr), i4p1)); } /****************************************** @@ -4314,8 +4387,8 @@ void z8002_device::Z6C_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - uint8_t tmp = RDMEM_B(AS_DATA, addr); - WRMEM_B(AS_DATA, addr, RB(dst)); + uint8_t tmp = RDMEM_B(*m_data, addr); + WRMEM_B(*m_data, addr, RB(dst)); RB(dst) = tmp; } @@ -4330,8 +4403,8 @@ void z8002_device::Z6C_ssN0_dddd_addr() GET_ADDR(OP1); uint8_t tmp; addr = addr_add(addr, RW(src)); - tmp = RDMEM_B(AS_DATA, addr); - WRMEM_B(AS_DATA, addr, RB(dst)); + tmp = RDMEM_B(*m_data, addr); + WRMEM_B(*m_data, addr, RB(dst)); RB(dst) = tmp; } @@ -4343,8 +4416,8 @@ void z8002_device::Z6D_0000_dddd_addr() { GET_DST(OP0,NIB3); GET_ADDR(OP1); - uint16_t tmp = RDMEM_W(AS_DATA, addr); - WRMEM_W(AS_DATA, addr, RW(dst)); + uint16_t tmp = RDMEM_W(*m_data, addr); + WRMEM_W(*m_data, addr, RW(dst)); RW(dst) = tmp; } @@ -4359,8 +4432,8 @@ void z8002_device::Z6D_ssN0_dddd_addr() GET_ADDR(OP1); uint16_t tmp; addr = addr_add(addr, RW(src)); - tmp = RDMEM_W(AS_DATA, addr); - WRMEM_W(AS_DATA, addr, RW(dst)); + tmp = RDMEM_W(*m_data, addr); + WRMEM_W(*m_data, addr, RW(dst)); RW(dst) = tmp; } @@ -4372,7 +4445,7 @@ void z8002_device::Z6E_0000_ssss_addr() { GET_SRC(OP0,NIB3); GET_ADDR(OP1); - WRMEM_B(AS_DATA, addr, RB(src)); + WRMEM_B(*m_data, addr, RB(src)); } /****************************************** @@ -4385,7 +4458,7 @@ void z8002_device::Z6E_ddN0_ssss_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_B(AS_DATA, addr, RB(src)); + WRMEM_B(*m_data, addr, RB(src)); } /****************************************** @@ -4396,7 +4469,7 @@ void z8002_device::Z6F_0000_ssss_addr() { GET_SRC(OP0,NIB3); GET_ADDR(OP1); - WRMEM_W(AS_DATA, addr, RW(src)); + WRMEM_W(*m_data, addr, RW(src)); } /****************************************** @@ -4409,7 +4482,7 @@ void z8002_device::Z6F_ddN0_ssss_addr() GET_DST(OP0,NIB2); GET_ADDR(OP1); addr = addr_add(addr, RW(dst)); - WRMEM_W(AS_DATA, addr, RW(src)); + WRMEM_W(*m_data, addr, RW(src)); } /****************************************** @@ -4421,7 +4494,7 @@ void z8002_device::Z70_ssN0_dddd_0000_xxxx_0000_0000() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX(OP1,NIB1); - RB(dst) = RDMEM_B(AS_DATA, addr_add(addr_from_reg(src), RW(idx))); + RB(dst) = RDBX_B(src, RW(idx)); } /****************************************** @@ -4433,7 +4506,7 @@ void z8002_device::Z71_ssN0_dddd_0000_xxxx_0000_0000() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX(OP1,NIB1); - RW(dst) = RDMEM_W(AS_DATA, addr_add(addr_from_reg(src), RW(idx))); + RW(dst) = RDBX_W(src, RW(idx)); } /****************************************** @@ -4445,7 +4518,7 @@ void z8002_device::Z72_ddN0_ssss_0000_xxxx_0000_0000() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX(OP1,NIB1); - WRMEM_B(AS_DATA, addr_add(addr_from_reg(dst), RW(idx)), RB(src)); + WRBX_B(dst, RW(idx), RB(src)); } /****************************************** @@ -4457,7 +4530,7 @@ void z8002_device::Z73_ddN0_ssss_0000_xxxx_0000_0000() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX(OP1,NIB1); - WRMEM_W(AS_DATA, addr_add(addr_from_reg(dst), RW(idx)), RW(src)); + WRBX_W(dst, RW(idx), RW(src)); } /****************************************** @@ -4487,7 +4560,7 @@ void z8002_device::Z75_ssN0_dddd_0000_xxxx_0000_0000() GET_DST(OP0,NIB3); GET_SRC(OP0,NIB2); GET_IDX(OP1,NIB1); - RL(dst) = RDMEM_L(AS_DATA, addr_add(addr_from_reg(src), RW(idx))); + RL(dst) = RDBX_L(src, RW(idx)); } /****************************************** @@ -4534,7 +4607,7 @@ void z8002_device::Z77_ddN0_ssss_0000_xxxx_0000_0000() GET_SRC(OP0,NIB3); GET_DST(OP0,NIB2); GET_IDX(OP1,NIB1); - WRMEM_L(AS_DATA, addr_add(addr_from_reg(dst), RW(idx)), RL(src)); + WRBX_L(dst, RW(idx), RL(src)); } /****************************************** @@ -4561,12 +4634,12 @@ void z8002_device::Z79_0000_0000_addr() GET_ADDR(OP1); uint16_t fcw; if (get_segmented_mode()) { - fcw = RDMEM_W(AS_DATA, addr + 2); - set_pc(segmented_addr(RDMEM_L(AS_DATA, addr + 4))); + fcw = RDMEM_W(*m_data, addr + 2); + set_pc(segmented_addr(RDMEM_L(*m_data, addr + 4))); } else { - fcw = RDMEM_W(AS_DATA, addr); - set_pc(RDMEM_W(AS_DATA, (uint16_t)(addr + 2))); + fcw = RDMEM_W(*m_data, addr); + set_pc(RDMEM_W(*m_data, (uint16_t)(addr + 2))); } CHANGE_FCW(fcw); /* check for user/system mode change */ } @@ -4583,12 +4656,12 @@ void z8002_device::Z79_ssN0_0000_addr() uint16_t fcw; addr = addr_add(addr, RW(src)); if (get_segmented_mode()) { - fcw = RDMEM_W(AS_DATA, addr + 2); - set_pc(segmented_addr(RDMEM_L(AS_DATA, addr + 4))); + fcw = RDMEM_W(*m_data, addr + 2); + set_pc(segmented_addr(RDMEM_L(*m_data, addr + 4))); } else { - fcw = RDMEM_W(AS_DATA, addr); - m_pc = RDMEM_W(AS_DATA, (uint16_t)(addr + 2)); + fcw = RDMEM_W(*m_data, addr); + m_pc = RDMEM_W(*m_data, (uint16_t)(addr + 2)); } if ((fcw ^ m_fcw) & F_SEG) printf("ldps 3 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", m_pc, (fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-"); CHANGE_FCW(fcw); /* check for user/system mode change */ @@ -5915,7 +5988,7 @@ void z8002_device::ZB8_ddN0_0010_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); + uint8_t xlt = RDBX_B(src, RDIR_B(dst)); RB(1) = xlt; /* load RH1 */ if (xlt) CLR_Z; else SET_Z; add_to_addr_reg(dst, 1); @@ -5931,7 +6004,7 @@ void z8002_device::ZB8_ddN0_0110_0000_rrrr_ssN0_1110() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); + uint8_t xlt = RDBX_B(src, RDIR_B(dst)); RB(1) = xlt; /* load RH1 */ if (xlt) CLR_Z; else SET_Z; add_to_addr_reg(dst, 1); @@ -5952,7 +6025,7 @@ void z8002_device::ZB8_ddN0_1010_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); + uint8_t xlt = RDBX_B(src, RDIR_B(dst)); RB(1) = xlt; /* load RH1 */ if (xlt) CLR_Z; else SET_Z; sub_from_addr_reg(dst, 1); @@ -5968,7 +6041,7 @@ void z8002_device::ZB8_ddN0_1110_0000_rrrr_ssN0_1110() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); + uint8_t xlt = RDBX_B(src, RDIR_B(dst)); RB(1) = xlt; /* load RH1 */ if (xlt) CLR_Z; else SET_Z; sub_from_addr_reg(dst, 1); @@ -5989,8 +6062,10 @@ void z8002_device::ZB8_ddN0_0000_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); - WRMEM_B(AS_DATA, addr_from_reg(dst), xlt); + address_space &dstspace = dst == SP ? *m_stack : *m_data; + uint32_t dstaddr = addr_from_reg(dst); + uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr)); + WRMEM_B(dstspace, dstaddr, xlt); RB(1) = xlt; /* destroy RH1 */ add_to_addr_reg(dst, 1); if (--RW(cnt)) CLR_V; else SET_V; @@ -6005,8 +6080,10 @@ void z8002_device::ZB8_ddN0_0100_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); - WRMEM_B(AS_DATA, addr_from_reg(dst), xlt); + address_space &dstspace = dst == SP ? *m_stack : *m_data; + uint32_t dstaddr = addr_from_reg(dst); + uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr)); + WRMEM_B(dstspace, dstaddr, xlt); RB(1) = xlt; /* destroy RH1 */ add_to_addr_reg(dst, 1); if (--RW(cnt)) { CLR_V; m_pc -= 4; } else SET_V; @@ -6021,8 +6098,10 @@ void z8002_device::ZB8_ddN0_1000_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); - WRMEM_B(AS_DATA, addr_from_reg(dst), xlt); + address_space &dstspace = dst == SP ? *m_stack : *m_data; + uint32_t dstaddr = addr_from_reg(dst); + uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr)); + WRMEM_B(dstspace, dstaddr, xlt); RB(1) = xlt; /* destroy RH1 */ sub_from_addr_reg(dst, 1); if (--RW(cnt)) CLR_V; else SET_V; @@ -6037,8 +6116,10 @@ void z8002_device::ZB8_ddN0_1100_0000_rrrr_ssN0_0000() GET_DST(OP0,NIB2); GET_SRC(OP1,NIB2); GET_CNT(OP1,NIB1); - uint8_t xlt = RDMEM_B(AS_DATA, addr_from_reg(src) + RDMEM_B(AS_DATA, addr_from_reg(dst))); - WRMEM_B(AS_DATA, addr_from_reg(dst), xlt); + address_space &dstspace = dst == SP ? *m_stack : *m_data; + uint32_t dstaddr = addr_from_reg(dst); + uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr)); + WRMEM_B(dstspace, dstaddr, xlt); RB(1) = xlt; /* destroy RH1 */ sub_from_addr_reg(dst, 1); if (--RW(cnt)) { CLR_V; m_pc -= 4; } else SET_V; @@ -6069,7 +6150,7 @@ void z8002_device::ZBA_ssN0_0000_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RB(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6103,7 +6184,7 @@ void z8002_device::ZBA_ssN0_0001_0000_rrrr_ddN0_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); /* repeat? */ - WRMEM_B(AS_DATA, addr_from_reg(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + WRIR_B(dst, RDIR_B(src)); add_to_addr_reg(src, 1); add_to_addr_reg(dst, 1); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -6119,7 +6200,7 @@ void z8002_device::ZBA_ssN0_0010_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RDMEM_B(AS_DATA, addr_from_reg(dst)), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RDIR_B(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6153,7 +6234,7 @@ void z8002_device::ZBA_ssN0_0100_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RB(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6186,7 +6267,7 @@ void z8002_device::ZBA_ssN0_0110_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RDMEM_B(AS_DATA, addr_from_reg(dst)), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RDIR_B(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6220,7 +6301,7 @@ void z8002_device::ZBA_ssN0_1000_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RB(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6254,7 +6335,7 @@ void z8002_device::ZBA_ssN0_1001_0000_rrrr_ddN0_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_B(AS_DATA, addr_from_reg(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + WRIR_B(dst, RDIR_B(src)); sub_from_addr_reg(src, 1); sub_from_addr_reg(dst, 1); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -6270,7 +6351,7 @@ void z8002_device::ZBA_ssN0_1010_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RDMEM_B(AS_DATA, addr_from_reg(dst)), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RDIR_B(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6304,7 +6385,7 @@ void z8002_device::ZBA_ssN0_1100_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RB(dst), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RB(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6337,7 +6418,7 @@ void z8002_device::ZBA_ssN0_1110_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPB(RDMEM_B(AS_DATA, addr_from_reg(dst)), RDMEM_B(AS_DATA, addr_from_reg(src))); + CPB(RDIR_B(dst), RDIR_B(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6371,7 +6452,7 @@ void z8002_device::ZBB_ssN0_0000_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RW(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6405,7 +6486,7 @@ void z8002_device::ZBB_ssN0_0001_0000_rrrr_ddN0_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, addr_from_reg(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + WRIR_W(dst, RDIR_W(src)); add_to_addr_reg(src, 2); add_to_addr_reg(dst, 2); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -6421,7 +6502,7 @@ void z8002_device::ZBB_ssN0_0010_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RDMEM_W(AS_DATA, addr_from_reg(dst)), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RDIR_W(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6455,7 +6536,7 @@ void z8002_device::ZBB_ssN0_0100_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RW(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6488,7 +6569,7 @@ void z8002_device::ZBB_ssN0_0110_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RDMEM_W(AS_DATA, addr_from_reg(dst)), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RDIR_W(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6522,7 +6603,7 @@ void z8002_device::ZBB_ssN0_1000_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RW(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6556,7 +6637,7 @@ void z8002_device::ZBB_ssN0_1001_0000_rrrr_ddN0_x000() GET_CNT(OP1,NIB1); GET_DST(OP1,NIB2); GET_CCC(OP1,NIB3); - WRMEM_W(AS_DATA, addr_from_reg(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + WRIR_W(dst, RDIR_W(src)); sub_from_addr_reg(src, 2); sub_from_addr_reg(dst, 2); if (--RW(cnt)) { CLR_V; if (cc == 0) m_pc -= 4; } else SET_V; @@ -6572,7 +6653,7 @@ void z8002_device::ZBB_ssN0_1010_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RDMEM_W(AS_DATA, addr_from_reg(dst)), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RDIR_W(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6606,7 +6687,7 @@ void z8002_device::ZBB_ssN0_1100_0000_rrrr_dddd_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RW(dst), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RW(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; @@ -6639,7 +6720,7 @@ void z8002_device::ZBB_ssN0_1110_0000_rrrr_ddN0_cccc() GET_CCC(OP1,NIB3); GET_DST(OP1,NIB2); GET_CNT(OP1,NIB1); - CPW(RDMEM_W(AS_DATA, addr_from_reg(dst)), RDMEM_W(AS_DATA, addr_from_reg(src))); + CPW(RDIR_W(dst), RDIR_W(src)); switch (cc) { case 0: if (CC0) SET_Z; else CLR_Z; break; case 1: if (CC1) SET_Z; else CLR_Z; break; diff --git a/src/mame/drivers/c900.cpp b/src/mame/drivers/c900.cpp index bec1220521e..d2073d1efe6 100644 --- a/src/mame/drivers/c900.cpp +++ b/src/mame/drivers/c900.cpp @@ -56,6 +56,7 @@ private: void data_map(address_map &map); void io_map(address_map &map); + void special_io_map(address_map &map); void mem_map(address_map &map); required_device m_maincpu; required_device m_spkrdev; @@ -84,6 +85,11 @@ void c900_state::io_map(address_map &map) map(0x0100, 0x013f).rw("scc", FUNC(scc8030_device::zbus_r), FUNC(scc8030_device::zbus_w)).umask16(0x00ff); } +void c900_state::special_io_map(address_map &map) +{ + // TODO: Z8010 MMU +} + static INPUT_PORTS_START( c900 ) INPUT_PORTS_END @@ -112,6 +118,7 @@ void c900_state::c900(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &c900_state::mem_map); m_maincpu->set_addrmap(AS_DATA, &c900_state::data_map); m_maincpu->set_addrmap(AS_IO, &c900_state::io_map); + m_maincpu->set_addrmap(z8001_device::AS_SIO, &c900_state::special_io_map); GFXDECODE(config, "gfxdecode", "palette", gfx_c900); PALETTE(config, "palette", palette_device::MONOCHROME); -- cgit v1.2.3