summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/z8000/z8000ops.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/z8000/z8000ops.hxx')
-rw-r--r--src/devices/cpu/z8000/z8000ops.hxx627
1 files changed, 354 insertions, 273 deletions
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;