summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/cpu/z80/z80.cpp1031
-rw-r--r--src/devices/cpu/z80/z80.h41
-rw-r--r--src/mame/drivers/pentagon.cpp5
-rw-r--r--src/mame/drivers/spec128.cpp20
-rw-r--r--src/mame/drivers/spectrum.cpp52
-rw-r--r--src/mame/drivers/system1.cpp137
-rw-r--r--src/mame/drivers/tsconf.cpp2
-rw-r--r--src/mame/includes/spectrum.h21
-rw-r--r--src/mame/includes/tsconf.h2
-rw-r--r--src/mame/machine/amstrad.cpp177
-rw-r--r--src/mame/machine/msx.cpp130
-rw-r--r--src/mame/video/spectrum.cpp86
12 files changed, 955 insertions, 749 deletions
diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp
index df1bd7befbc..a7265c454ad 100644
--- a/src/devices/cpu/z80/z80.cpp
+++ b/src/devices/cpu/z80/z80.cpp
@@ -22,6 +22,23 @@
* behaviour on NEC Z80 is still unknown.
* This Z80 emulator assumes a ZiLOG NMOS model.
*
+ * Changes in 0.243:
+ * Fundation for M cycles emulation. Currently we preserve cc_* tables with total timings.
+ * execute_run() behavior (simplified) ...
+ * Before:
+ * + fetch opcode
+ * + call EXEC()
+ * + adjust icount base on cc_* (all T are used after M1 == wrong)
+ * + execute instruction
+ * Now:
+ * + fetch opcode
+ * + call EXEC()
+ * + read cc_* value to m_icount_executing
+ * + execute instruction adjusting icount per each Read (arg(), recursive rop())
+ * + before M*Write use rest of m_icount_executing except count required for write
+ * + adjust write icount
+ * Next:
+ * If gracefully adjust icount for each operation after read and before write we can receive precise M timings without cc_* tables.
* Changes in 3.9:
* - Fixed cycle counts for LD IYL/IXL/IYH/IXH,n [Marshmellow]
* - Fixed X/Y flags in CCF/SCF/BIT, ZEXALL is happy now [hap]
@@ -206,87 +223,87 @@ static const uint8_t cc_op[0x100] = {
4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4,
4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4,
4, 4, 4, 4, 4, 4, 7, 4, 4, 4, 4, 4, 4, 4, 7, 4,
- 5,10,10,10,10,11, 7,11, 5,10,10, 0,10,17, 7,11, /* cb -> cc_cb */
- 5,10,10,11,10,11, 7,11, 5, 4,10,11,10, 0, 7,11, /* dd -> cc_xy */
- 5,10,10,19,10,11, 7,11, 5, 4,10, 4,10, 0, 7,11, /* ed -> cc_ed */
- 5,10,10, 4,10,11, 7,11, 5, 6,10, 4,10, 0, 7,11 /* fd -> cc_xy */
+ 5,10,10,10,10,11, 7,11, 5,10,10, 4,10,17, 7,11, /* cb -> cc_cb */
+ 5,10,10,11,10,11, 7,11, 5, 4,10,11,10, 4, 7,11, /* dd -> cc_xy */
+ 5,10,10,19,10,11, 7,11, 5, 4,10, 4,10, 4, 7,11, /* ed -> cc_ed */
+ 5,10,10, 4,10,11, 7,11, 5, 6,10, 4,10, 4, 7,11 /* fd -> cc_xy */
};
-static const uint8_t cc_cb[0x100] = {
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8,
- 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8,
- 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8,
- 8, 8, 8, 8, 8, 8,12, 8, 8, 8, 8, 8, 8, 8,12, 8,
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8, 8, 8, 8,15, 8, 8, 8, 8, 8, 8, 8,15, 8,
- 8, 8, 8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 4, 4,
+ 8, 8,11,16, 4,10, 4, 5, 8, 8,11,16, 4,10, 4, 5,
+ 8, 8,11,16, 4,10, 4, 5, 8, 8,11,16, 4,10, 4, 5,
+ 8, 8,11,16, 4,10, 4,14, 8, 8,11,16, 4,10, 4,14,
+ 8, 8,11,16, 4,10, 4, 4, 8, 8,11,16, 4,10, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 12,12,12,12,4, 4, 4, 4,12,12,12,12, 4, 4, 4, 4,
+ 12,12,12,12,4, 4, 4, 4,12,12,12,12, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
-/* ix/iy: with the exception of (i+offset) opcodes, t-states are main_opcode_table + 4 */
+/* ix/iy: with the exception of (i+offset) opcodes, for total add t-states from main_opcode_table[DD/FD] == 4 */
static const uint8_t cc_xy[0x100] = {
- 4+4,10+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4, 4+4,11+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,
- 8+4,10+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,12+4,11+4, 7+4, 6+4, 4+4, 4+4, 7+4, 4+4,
- 7+4,10+4,16+4, 6+4, 4+4, 4+4, 7+4, 4+4, 7+4,11+4,16+4, 6+4, 4+4, 4+4, 7+4, 4+4,
- 7+4,10+4,13+4, 6+4,23 ,23 ,19 , 4+4, 7+4,11+4,13+4, 6+4, 4+4, 4+4, 7+4, 4+4,
- 4+4, 4+4, 4+4, 4+4,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, 7, 4,
+ 7,10,16, 6, 4, 4, 7, 4, 7,11,16, 6, 4, 4, 7, 4,
+ 7,10,13, 6,19,19,15, 4, 7,11,13, 6, 4, 4, 7, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 15,15,15,15,15,15, 4,15, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 4, 4, 4, 4, 4, 4,15, 4, 4, 4, 4, 4, 4, 4,15, 4,
+ 5,10,10,10,10,11, 7,11, 5,10,10, 7,10,17, 7,11, /* cb -> cc_xycb */
+ 5,10,10,11,10,11, 7,11, 5, 4,10,11,10, 4, 7,11, /* dd -> cc_xy again */
+ 5,10,10,19,10,11, 7,11, 5, 4,10, 4,10, 4, 7,11, /* ed -> cc_ed */
+ 5,10,10, 4,10,11, 7,11, 5, 6,10, 4,10, 4, 7,11 /* fd -> cc_xy again */
};
static const uint8_t cc_xycb[0x100] = {
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
- 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
- 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
- 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
- 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12
};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
@@ -320,7 +337,15 @@ static const uint8_t cc_ex[0x100] = {
/***************************************************************
* adjust cycle count by n T-states
***************************************************************/
-#define CC(prefix,opcode) do { m_icount -= m_cc_##prefix[opcode]; } while (0)
+#define CC(prefix,opcode) do { m_icount_executing += m_cc_##prefix[opcode]; } while (0)
+
+#define T(icount) do { \
+ m_icount -= icount; \
+ m_icount_executing -= icount; \
+} while (0)
+
+// T Memory Address
+#define MTM (m_cc_op[0]-1)
#define EXEC(prefix,opcode) do { \
unsigned op = opcode; \
@@ -392,6 +417,7 @@ static const uint8_t cc_ex[0x100] = {
case 0xf8:prefix##_##f8();break; case 0xf9:prefix##_##f9();break; case 0xfa:prefix##_##fa();break; case 0xfb:prefix##_##fb();break; \
case 0xfc:prefix##_##fc();break; case 0xfd:prefix##_##fd();break; case 0xfe:prefix##_##fe();break; case 0xff:prefix##_##ff();break; \
} \
+ if(m_icount_executing) { T(m_icount_executing); } \
} while (0)
/***************************************************************
@@ -423,7 +449,9 @@ inline void z80_device::leave_halt()
***************************************************************/
inline uint8_t z80_device::in(uint16_t port)
{
- return m_io.read_byte(port);
+ u8 res = m_io.read_byte(port);
+ T(4);
+ return res;
}
/***************************************************************
@@ -432,6 +460,7 @@ inline uint8_t z80_device::in(uint16_t port)
inline void z80_device::out(uint16_t port, uint8_t value)
{
m_io.write_byte(port, value);
+ T(4);
}
/***************************************************************
@@ -439,7 +468,16 @@ inline void z80_device::out(uint16_t port, uint8_t value)
***************************************************************/
uint8_t z80_device::rm(uint16_t addr)
{
- return m_data.read_byte(addr);
+ u8 res = m_data.read_byte(addr);
+ T(MTM);
+ return res;
+}
+
+uint8_t z80_device::rm_reg(uint16_t addr)
+{
+ u8 res = rm(addr);
+ nomreq_addr(addr, 1);
+ return res;
}
/***************************************************************
@@ -448,7 +486,7 @@ uint8_t z80_device::rm(uint16_t addr)
inline void z80_device::rm16(uint16_t addr, PAIR &r)
{
r.b.l = rm(addr);
- r.b.h = rm((addr+1));
+ r.b.h = rm(addr+1);
}
/***************************************************************
@@ -456,7 +494,10 @@ inline void z80_device::rm16(uint16_t addr, PAIR &r)
***************************************************************/
void z80_device::wm(uint16_t addr, uint8_t value)
{
+ // As we don't count changes between read and write, simply adjust to the end of requested.
+ if(m_icount_executing != MTM) T(m_icount_executing - MTM);
m_data.write_byte(addr, value);
+ T(MTM);
}
/***************************************************************
@@ -464,8 +505,21 @@ void z80_device::wm(uint16_t addr, uint8_t value)
***************************************************************/
inline void z80_device::wm16(uint16_t addr, PAIR &r)
{
+ m_icount_executing -= MTM;
+ wm(addr, r.b.l);
+ m_icount_executing += MTM;
+ wm(addr+1, r.b.h);
+}
+
+/***************************************************************
+ * Write a word to given memory location (backword)
+ ***************************************************************/
+inline void z80_device::wm16back(uint16_t addr, PAIR &r)
+{
+ m_icount_executing -= MTM;
+ wm(addr+1, r.b.h);
+ m_icount_executing += MTM;
wm(addr, r.b.l);
- wm((addr+1), r.b.h);
}
/***************************************************************
@@ -475,12 +529,15 @@ inline void z80_device::wm16(uint16_t addr, PAIR &r)
***************************************************************/
uint8_t z80_device::rop()
{
- unsigned pc = PCD;
+ // Use leftovers from previous instruction. Mainly to support recursive EXEC(.., rop())
+ if(m_icount_executing) T(m_icount_executing);
+ uint8_t res = m_opcodes.read_byte(PCD);
+ T(execute_min_cycles());
+ m_refresh_cb((m_i << 8) | (m_r2 & 0x80) | (m_r & 0x7f), 0x00, 0xff);
+ T(execute_min_cycles());
PC++;
- uint8_t res = m_opcodes.read_byte(pc);
- m_icount -= 2;
- m_refresh_cb((m_i << 8) | (m_r2 & 0x80) | ((m_r-1) & 0x7f), 0x00, 0xff);
- m_icount += 2;
+ m_r++;
+
return res;
}
@@ -492,16 +549,16 @@ uint8_t z80_device::rop()
***************************************************************/
uint8_t z80_device::arg()
{
- unsigned pc = PCD;
+ u8 res = m_args.read_byte(PCD);
+ T(MTM);
PC++;
- return m_args.read_byte(pc);
+
+ return res;
}
uint16_t z80_device::arg16()
{
- unsigned pc = PCD;
- PC += 2;
- return m_args.read_word(pc);
+ return arg() | (arg() << 8);
}
/***************************************************************
@@ -534,8 +591,9 @@ inline void z80_device::pop(PAIR &r)
***************************************************************/
inline void z80_device::push(PAIR &r)
{
+ nomreq_ir(1);
SP -= 2;
- wm16(SPD, r);
+ wm16back(SPD, r);
}
/***************************************************************
@@ -558,9 +616,7 @@ inline void z80_device::jp_cond(bool cond)
WZ = PCD;
}
else
- {
WZ = arg16(); /* implicit do PC += 2 */
- }
}
/***************************************************************
@@ -569,6 +625,7 @@ inline void z80_device::jp_cond(bool cond)
inline void z80_device::jr()
{
int8_t a = (int8_t)arg(); /* arg() also increments PC */
+ nomreq_addr(PCD-1, 5);
PC += a; /* so don't do PC += arg() */
WZ = PC;
}
@@ -580,11 +637,15 @@ inline void z80_device::jr_cond(bool cond, uint8_t opcode)
{
if (cond)
{
- jr();
CC(ex, opcode);
+ jr();
}
else
- PC++;
+ {
+ WZ = arg();
+ //nomreq_addr(PCD, 3);
+ //PC++;
+ }
}
/***************************************************************
@@ -593,6 +654,7 @@ inline void z80_device::jr_cond(bool cond, uint8_t opcode)
inline void z80_device::call()
{
m_ea = arg16();
+ nomreq_addr(PCD-1, 1);
WZ = m_ea;
push(m_pc);
PCD = m_ea;
@@ -605,16 +667,15 @@ inline void z80_device::call_cond(bool cond, uint8_t opcode)
{
if (cond)
{
+ CC(ex, opcode);
m_ea = arg16();
+ nomreq_addr(PCD-1, 1);
WZ = m_ea;
push(m_pc);
PCD = m_ea;
- CC(ex, opcode);
}
else
- {
WZ = arg16(); /* implicit call PC+=2; */
- }
}
/***************************************************************
@@ -622,11 +683,12 @@ inline void z80_device::call_cond(bool cond, uint8_t opcode)
***************************************************************/
inline void z80_device::ret_cond(bool cond, uint8_t opcode)
{
+ nomreq_ir(1);
if (cond)
{
+ CC(ex, opcode);
pop(m_pc);
WZ = PC;
- CC(ex, opcode);
}
}
@@ -635,8 +697,7 @@ inline void z80_device::ret_cond(bool cond, uint8_t opcode)
***************************************************************/
inline void z80_device::retn()
{
- LOG(("Z80 RETN m_iff1:%d m_iff2:%d\n",
- m_iff1, m_iff2));
+ LOG(("Z80 RETN m_iff1:%d m_iff2:%d\n", m_iff1, m_iff2));
pop(m_pc);
WZ = PC;
m_iff1 = m_iff2;
@@ -658,6 +719,7 @@ inline void z80_device::reti()
***************************************************************/
inline void z80_device::ld_r_a()
{
+ nomreq_ir(1);
m_r = A;
m_r2 = A & 0x80; /* keep bit 7 of r */
}
@@ -667,6 +729,7 @@ inline void z80_device::ld_r_a()
***************************************************************/
inline void z80_device::ld_a_r()
{
+ nomreq_ir(1);
A = (m_r & 0x7f) | m_r2;
F = (F & CF) | SZ[A] | (m_iff2 << 2);
m_after_ldair = true;
@@ -677,6 +740,7 @@ inline void z80_device::ld_a_r()
***************************************************************/
inline void z80_device::ld_i_a()
{
+ nomreq_ir(1);
m_i = A;
}
@@ -685,6 +749,7 @@ inline void z80_device::ld_i_a()
***************************************************************/
inline void z80_device::ld_a_i()
{
+ nomreq_ir(1);
A = m_i;
F = (F & CF) | SZ[A] | (m_iff2 << 2);
m_after_ldair = true;
@@ -695,6 +760,7 @@ inline void z80_device::ld_a_i()
***************************************************************/
inline void z80_device::rst(uint16_t addr)
{
+ //nomreq_ir(1);
push(m_pc);
PCD = addr;
WZ = PC;
@@ -768,6 +834,7 @@ inline void z80_device::rrd()
{
uint8_t n = rm(HL);
WZ = HL+1;
+ nomreq_addr(HL, 4);
wm(HL, (n >> 4) | (A << 4));
A = (A & 0xf0) | (n & 0x0f);
F = (F & CF) | SZP[A];
@@ -780,6 +847,7 @@ inline void z80_device::rld()
{
uint8_t n = rm(HL);
WZ = HL+1;
+ nomreq_addr(HL, 4);
wm(HL, (n << 4) | (A & 0x0f));
A = (A & 0xf0) | (n >> 4);
F = (F & CF) | SZP[A];
@@ -845,11 +913,13 @@ inline void z80_device::neg()
inline void z80_device::daa()
{
uint8_t a = A;
- if (F & NF) {
+ if (F & NF)
+ {
if ((F&HF) | ((A&0xf)>9)) a-=6;
if ((F&CF) | (A>0x99)) a-=0x60;
}
- else {
+ else
+ {
if ((F&HF) | ((A&0xf)>9)) a+=6;
if ((F&CF) | (A>0x99)) a+=0x60;
}
@@ -933,7 +1003,11 @@ inline void z80_device::ex_sp(PAIR &r)
{
PAIR tmp = { { 0, 0, 0, 0 } };
rm16(SPD, tmp);
- wm16(SPD, r);
+ nomreq_addr(SPD + 1, 1);
+ m_icount_executing -= 2;
+ wm16back(SPD, r);
+ m_icount_executing += 2;
+ nomreq_addr(SPD, 2);
r = tmp;
WZ = r.d;
}
@@ -943,6 +1017,7 @@ inline void z80_device::ex_sp(PAIR &r)
***************************************************************/
inline void z80_device::add16(PAIR &dr, PAIR &sr)
{
+ nomreq_ir(7);
uint32_t res = dr.d + sr.d;
WZ = dr.d + 1;
F = (F & (SF | ZF | VF)) |
@@ -956,6 +1031,7 @@ inline void z80_device::add16(PAIR &dr, PAIR &sr)
***************************************************************/
inline void z80_device::adc_hl(PAIR &r)
{
+ nomreq_ir(7);
uint32_t res = HLD + r.d + (F & CF);
WZ = HL + 1;
F = (((HLD ^ res ^ r.d) >> 8) & HF) |
@@ -971,6 +1047,7 @@ inline void z80_device::adc_hl(PAIR &r)
***************************************************************/
inline void z80_device::sbc_hl(PAIR &r)
{
+ nomreq_ir(7);
uint32_t res = HLD - r.d - (F & CF);
WZ = HL + 1;
F = (((HLD ^ res ^ r.d) >> 8) & HF) | NF |
@@ -1123,7 +1200,10 @@ inline uint8_t z80_device::set(int bit, uint8_t value)
inline void z80_device::ldi()
{
uint8_t io = rm(HL);
+ m_icount_executing -= 2;
wm(DE, io);
+ m_icount_executing += 2;
+ nomreq_addr(DE, 2);
F &= SF | ZF | CF;
if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */
if ((A + io) & 0x08) F |= XF; /* bit 3 -> flag 3 */
@@ -1137,6 +1217,7 @@ inline void z80_device::ldi()
inline void z80_device::cpi()
{
uint8_t val = rm(HL);
+ nomreq_addr(HL, 5);
uint8_t res = A - val;
WZ++;
HL++; BC--;
@@ -1152,6 +1233,7 @@ inline void z80_device::cpi()
***************************************************************/
inline void z80_device::ini()
{
+ nomreq_ir(1);
unsigned t;
uint8_t io = in(BC);
WZ = BC + 1;
@@ -1170,6 +1252,7 @@ inline void z80_device::ini()
***************************************************************/
inline void z80_device::outi()
{
+ nomreq_ir(1);
unsigned t;
uint8_t io = rm(HL);
B--;
@@ -1189,7 +1272,10 @@ inline void z80_device::outi()
inline void z80_device::ldd()
{
uint8_t io = rm(HL);
+ m_icount_executing -= 2;
wm(DE, io);
+ m_icount_executing += 2;
+ nomreq_addr(DE, 2);
F &= SF | ZF | CF;
if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */
if ((A + io) & 0x08) F |= XF; /* bit 3 -> flag 3 */
@@ -1203,6 +1289,7 @@ inline void z80_device::ldd()
inline void z80_device::cpd()
{
uint8_t val = rm(HL);
+ nomreq_addr(HL, 5);
uint8_t res = A - val;
WZ--;
HL--; BC--;
@@ -1218,6 +1305,7 @@ inline void z80_device::cpd()
***************************************************************/
inline void z80_device::ind()
{
+ nomreq_ir(1);
unsigned t;
uint8_t io = in(BC);
WZ = BC - 1;
@@ -1236,6 +1324,7 @@ inline void z80_device::ind()
***************************************************************/
inline void z80_device::outd()
{
+ nomreq_ir(1);
unsigned t;
uint8_t io = rm(HL);
B--;
@@ -1257,9 +1346,10 @@ inline void z80_device::ldir()
ldi();
if (BC != 0)
{
+ CC(ex, 0xb0);
+ nomreq_addr(DE, 5);
PC -= 2;
WZ = PC + 1;
- CC(ex, 0xb0);
}
}
@@ -1271,9 +1361,10 @@ inline void z80_device::cpir()
cpi();
if (BC != 0 && !(F & ZF))
{
+ CC(ex, 0xb1);
+ nomreq_addr(HL, 5);
PC -= 2;
WZ = PC + 1;
- CC(ex, 0xb1);
}
}
@@ -1285,8 +1376,9 @@ inline void z80_device::inir()
ini();
if (B != 0)
{
- PC -= 2;
CC(ex, 0xb2);
+ nomreq_addr(HL, 5);
+ PC -= 2;
}
}
@@ -1298,8 +1390,9 @@ inline void z80_device::otir()
outi();
if (B != 0)
{
- PC -= 2;
CC(ex, 0xb3);
+ nomreq_addr(BC, 5);
+ PC -= 2;
}
}
@@ -1311,9 +1404,10 @@ inline void z80_device::lddr()
ldd();
if (BC != 0)
{
+ CC(ex, 0xb8);
+ nomreq_addr(DE, 5);
PC -= 2;
WZ = PC + 1;
- CC(ex, 0xb8);
}
}
@@ -1325,9 +1419,10 @@ inline void z80_device::cpdr()
cpd();
if (BC != 0 && !(F & ZF))
{
+ CC(ex, 0xb9);
+ nomreq_addr(HL, 5);
PC -= 2;
WZ = PC + 1;
- CC(ex, 0xb9);
}
}
@@ -1339,8 +1434,9 @@ inline void z80_device::indr()
ind();
if (B != 0)
{
- PC -= 2;
CC(ex, 0xba);
+ nomreq_addr(HL, 5);
+ PC -= 2;
}
}
@@ -1352,8 +1448,9 @@ inline void z80_device::otdr()
outd();
if (B != 0)
{
- PC -= 2;
CC(ex, 0xbb);
+ nomreq_addr(BC, 5);
+ PC -= 2;
}
}
@@ -1376,7 +1473,7 @@ OP(cb,02) { D = rlc(D); } /* RLC D */
OP(cb,03) { E = rlc(E); } /* RLC E */
OP(cb,04) { H = rlc(H); } /* RLC H */
OP(cb,05) { L = rlc(L); } /* RLC L */
-OP(cb,06) { wm(HL, rlc(rm(HL))); } /* RLC (HL) */
+OP(cb,06) { wm(HL, rlc(rm_reg(HL)));} /* RLC (HL) */
OP(cb,07) { A = rlc(A); } /* RLC A */
OP(cb,08) { B = rrc(B); } /* RRC B */
@@ -1385,7 +1482,7 @@ OP(cb,0a) { D = rrc(D); } /* RRC D */
OP(cb,0b) { E = rrc(E); } /* RRC E */
OP(cb,0c) { H = rrc(H); } /* RRC H */
OP(cb,0d) { L = rrc(L); } /* RRC L */
-OP(cb,0e) { wm(HL, rrc(rm(HL))); } /* RRC (HL) */
+OP(cb,0e) { wm(HL, rrc(rm_reg(HL)));} /* RRC (HL) */
OP(cb,0f) { A = rrc(A); } /* RRC A */
OP(cb,10) { B = rl(B); } /* RL B */
@@ -1394,7 +1491,7 @@ OP(cb,12) { D = rl(D); } /* RL D */
OP(cb,13) { E = rl(E); } /* RL E */
OP(cb,14) { H = rl(H); } /* RL H */
OP(cb,15) { L = rl(L); } /* RL L */
-OP(cb,16) { wm(HL, rl(rm(HL))); } /* RL (HL) */
+OP(cb,16) { wm(HL, rl(rm_reg(HL))); } /* RL (HL) */
OP(cb,17) { A = rl(A); } /* RL A */
OP(cb,18) { B = rr(B); } /* RR B */
@@ -1403,7 +1500,7 @@ OP(cb,1a) { D = rr(D); } /* RR D */
OP(cb,1b) { E = rr(E); } /* RR E */
OP(cb,1c) { H = rr(H); } /* RR H */
OP(cb,1d) { L = rr(L); } /* RR L */
-OP(cb,1e) { wm(HL, rr(rm(HL))); } /* RR (HL) */
+OP(cb,1e) { wm(HL, rr(rm_reg(HL))); } /* RR (HL) */
OP(cb,1f) { A = rr(A); } /* RR A */
OP(cb,20) { B = sla(B); } /* SLA B */
@@ -1412,7 +1509,7 @@ OP(cb,22) { D = sla(D); } /* SLA D */
OP(cb,23) { E = sla(E); } /* SLA E */
OP(cb,24) { H = sla(H); } /* SLA H */
OP(cb,25) { L = sla(L); } /* SLA L */
-OP(cb,26) { wm(HL, sla(rm(HL))); } /* SLA (HL) */
+OP(cb,26) { wm(HL, sla(rm_reg(HL)));} /* SLA (HL) */
OP(cb,27) { A = sla(A); } /* SLA A */
OP(cb,28) { B = sra(B); } /* SRA B */
@@ -1421,7 +1518,7 @@ OP(cb,2a) { D = sra(D); } /* SRA D */
OP(cb,2b) { E = sra(E); } /* SRA E */
OP(cb,2c) { H = sra(H); } /* SRA H */
OP(cb,2d) { L = sra(L); } /* SRA L */
-OP(cb,2e) { wm(HL, sra(rm(HL))); } /* SRA (HL) */
+OP(cb,2e) { wm(HL, sra(rm_reg(HL)));} /* SRA (HL) */
OP(cb,2f) { A = sra(A); } /* SRA A */
OP(cb,30) { B = sll(B); } /* SLL B */
@@ -1430,7 +1527,7 @@ OP(cb,32) { D = sll(D); } /* SLL D */
OP(cb,33) { E = sll(E); } /* SLL E */
OP(cb,34) { H = sll(H); } /* SLL H */
OP(cb,35) { L = sll(L); } /* SLL L */
-OP(cb,36) { wm(HL, sll(rm(HL))); } /* SLL (HL) */
+OP(cb,36) { wm(HL, sll(rm_reg(HL)));} /* SLL (HL) */
OP(cb,37) { A = sll(A); } /* SLL A */
OP(cb,38) { B = srl(B); } /* SRL B */
@@ -1439,7 +1536,7 @@ OP(cb,3a) { D = srl(D); } /* SRL D */
OP(cb,3b) { E = srl(E); } /* SRL E */
OP(cb,3c) { H = srl(H); } /* SRL H */
OP(cb,3d) { L = srl(L); } /* SRL L */
-OP(cb,3e) { wm(HL, srl(rm(HL))); } /* SRL (HL) */
+OP(cb,3e) { wm(HL, srl(rm_reg(HL)));} /* SRL (HL) */
OP(cb,3f) { A = srl(A); } /* SRL A */
OP(cb,40) { bit(0, B); } /* BIT 0,B */
@@ -1448,7 +1545,7 @@ OP(cb,42) { bit(0, D); } /* BIT 0,D */
OP(cb,43) { bit(0, E); } /* BIT 0,E */
OP(cb,44) { bit(0, H); } /* BIT 0,H */
OP(cb,45) { bit(0, L); } /* BIT 0,L */
-OP(cb,46) { bit_hl(0, rm(HL)); } /* BIT 0,(HL) */
+OP(cb,46) { bit_hl(0, rm_reg(HL)); } /* BIT 0,(HL) */
OP(cb,47) { bit(0, A); } /* BIT 0,A */
OP(cb,48) { bit(1, B); } /* BIT 1,B */
@@ -1457,7 +1554,7 @@ OP(cb,4a) { bit(1, D); } /* BIT 1,D */
OP(cb,4b) { bit(1, E); } /* BIT 1,E */
OP(cb,4c) { bit(1, H); } /* BIT 1,H */
OP(cb,4d) { bit(1, L); } /* BIT 1,L */
-OP(cb,4e) { bit_hl(1, rm(HL)); } /* BIT 1,(HL) */
+OP(cb,4e) { bit_hl(1, rm_reg(HL)); } /* BIT 1,(HL) */
OP(cb,4f) { bit(1, A); } /* BIT 1,A */
OP(cb,50) { bit(2, B); } /* BIT 2,B */
@@ -1466,7 +1563,7 @@ OP(cb,52) { bit(2, D); } /* BIT 2,D */
OP(cb,53) { bit(2, E); } /* BIT 2,E */
OP(cb,54) { bit(2, H); } /* BIT 2,H */
OP(cb,55) { bit(2, L); } /* BIT 2,L */
-OP(cb,56) { bit_hl(2, rm(HL)); } /* BIT 2,(HL) */
+OP(cb,56) { bit_hl(2, rm_reg(HL)); } /* BIT 2,(HL) */
OP(cb,57) { bit(2, A); } /* BIT 2,A */
OP(cb,58) { bit(3, B); } /* BIT 3,B */
@@ -1475,7 +1572,7 @@ OP(cb,5a) { bit(3, D); } /* BIT 3,D */
OP(cb,5b) { bit(3, E); } /* BIT 3,E */
OP(cb,5c) { bit(3, H); } /* BIT 3,H */
OP(cb,5d) { bit(3, L); } /* BIT 3,L */
-OP(cb,5e) { bit_hl(3, rm(HL)); } /* BIT 3,(HL) */
+OP(cb,5e) { bit_hl(3, rm_reg(HL)); } /* BIT 3,(HL) */
OP(cb,5f) { bit(3, A); } /* BIT 3,A */
OP(cb,60) { bit(4, B); } /* BIT 4,B */
@@ -1484,7 +1581,7 @@ OP(cb,62) { bit(4, D); } /* BIT 4,D */
OP(cb,63) { bit(4, E); } /* BIT 4,E */
OP(cb,64) { bit(4, H); } /* BIT 4,H */
OP(cb,65) { bit(4, L); } /* BIT 4,L */
-OP(cb,66) { bit_hl(4, rm(HL)); } /* BIT 4,(HL) */
+OP(cb,66) { bit_hl(4, rm_reg(HL)); } /* BIT 4,(HL) */
OP(cb,67) { bit(4, A); } /* BIT 4,A */
OP(cb,68) { bit(5, B); } /* BIT 5,B */
@@ -1493,7 +1590,7 @@ OP(cb,6a) { bit(5, D); } /* BIT 5,D */
OP(cb,6b) { bit(5, E); } /* BIT 5,E */
OP(cb,6c) { bit(5, H); } /* BIT 5,H */
OP(cb,6d) { bit(5, L); } /* BIT 5,L */
-OP(cb,6e) { bit_hl(5, rm(HL)); } /* BIT 5,(HL) */
+OP(cb,6e) { bit_hl(5, rm_reg(HL)); } /* BIT 5,(HL) */
OP(cb,6f) { bit(5, A); } /* BIT 5,A */
OP(cb,70) { bit(6, B); } /* BIT 6,B */
@@ -1502,7 +1599,7 @@ OP(cb,72) { bit(6, D); } /* BIT 6,D */
OP(cb,73) { bit(6, E); } /* BIT 6,E */
OP(cb,74) { bit(6, H); } /* BIT 6,H */
OP(cb,75) { bit(6, L); } /* BIT 6,L */
-OP(cb,76) { bit_hl(6, rm(HL)); } /* BIT 6,(HL) */
+OP(cb,76) { bit_hl(6, rm_reg(HL)); } /* BIT 6,(HL) */
OP(cb,77) { bit(6, A); } /* BIT 6,A */
OP(cb,78) { bit(7, B); } /* BIT 7,B */
@@ -1511,7 +1608,7 @@ OP(cb,7a) { bit(7, D); } /* BIT 7,D */
OP(cb,7b) { bit(7, E); } /* BIT 7,E */
OP(cb,7c) { bit(7, H); } /* BIT 7,H */
OP(cb,7d) { bit(7, L); } /* BIT 7,L */
-OP(cb,7e) { bit_hl(7, rm(HL)); } /* BIT 7,(HL) */
+OP(cb,7e) { bit_hl(7, rm_reg(HL)); } /* BIT 7,(HL) */
OP(cb,7f) { bit(7, A); } /* BIT 7,A */
OP(cb,80) { B = res(0, B); } /* RES 0,B */
@@ -1520,7 +1617,7 @@ OP(cb,82) { D = res(0, D); } /* RES 0,D */
OP(cb,83) { E = res(0, E); } /* RES 0,E */
OP(cb,84) { H = res(0, H); } /* RES 0,H */
OP(cb,85) { L = res(0, L); } /* RES 0,L */
-OP(cb,86) { wm(HL, res(0, rm(HL))); } /* RES 0,(HL) */
+OP(cb,86) { wm(HL, res(0, rm_reg(HL))); } /* RES 0,(HL) */
OP(cb,87) { A = res(0, A); } /* RES 0,A */
OP(cb,88) { B = res(1, B); } /* RES 1,B */
@@ -1529,7 +1626,7 @@ OP(cb,8a) { D = res(1, D); } /* RES 1,D */
OP(cb,8b) { E = res(1, E); } /* RES 1,E */
OP(cb,8c) { H = res(1, H); } /* RES 1,H */
OP(cb,8d) { L = res(1, L); } /* RES 1,L */
-OP(cb,8e) { wm(HL, res(1, rm(HL))); } /* RES 1,(HL) */
+OP(cb,8e) { wm(HL, res(1, rm_reg(HL))); } /* RES 1,(HL) */
OP(cb,8f) { A = res(1, A); } /* RES 1,A */
OP(cb,90) { B = res(2, B); } /* RES 2,B */
@@ -1538,7 +1635,7 @@ OP(cb,92) { D = res(2, D); } /* RES 2,D */
OP(cb,93) { E = res(2, E); } /* RES 2,E */
OP(cb,94) { H = res(2, H); } /* RES 2,H */
OP(cb,95) { L = res(2, L); } /* RES 2,L */
-OP(cb,96) { wm(HL, res(2, rm(HL))); } /* RES 2,(HL) */
+OP(cb,96) { wm(HL, res(2, rm_reg(HL))); } /* RES 2,(HL) */
OP(cb,97) { A = res(2, A); } /* RES 2,A */
OP(cb,98) { B = res(3, B); } /* RES 3,B */
@@ -1547,7 +1644,7 @@ OP(cb,9a) { D = res(3, D); } /* RES 3,D */
OP(cb,9b) { E = res(3, E); } /* RES 3,E */
OP(cb,9c) { H = res(3, H); } /* RES 3,H */
OP(cb,9d) { L = res(3, L); } /* RES 3,L */
-OP(cb,9e) { wm(HL, res(3, rm(HL))); } /* RES 3,(HL) */
+OP(cb,9e) { wm(HL, res(3, rm_reg(HL))); } /* RES 3,(HL) */
OP(cb,9f) { A = res(3, A); } /* RES 3,A */
OP(cb,a0) { B = res(4, B); } /* RES 4,B */
@@ -1556,7 +1653,7 @@ OP(cb,a2) { D = res(4, D); } /* RES 4,D */
OP(cb,a3) { E = res(4, E); } /* RES 4,E */
OP(cb,a4) { H = res(4, H); } /* RES 4,H */
OP(cb,a5) { L = res(4, L); } /* RES 4,L */
-OP(cb,a6) { wm(HL, res(4, rm(HL))); } /* RES 4,(HL) */
+OP(cb,a6) {wm(HL, res(4, rm_reg(HL))); } /* RES 4,(HL) */
OP(cb,a7) { A = res(4, A); } /* RES 4,A */
OP(cb,a8) { B = res(5, B); } /* RES 5,B */
@@ -1565,7 +1662,7 @@ OP(cb,aa) { D = res(5, D); } /* RES 5,D */
OP(cb,ab) { E = res(5, E); } /* RES 5,E */
OP(cb,ac) { H = res(5, H); } /* RES 5,H */
OP(cb,ad) { L = res(5, L); } /* RES 5,L */
-OP(cb,ae) { wm(HL, res(5, rm(HL))); } /* RES 5,(HL) */
+OP(cb,ae) { wm(HL, res(5, rm_reg(HL))); } /* RES 5,(HL) */
OP(cb,af) { A = res(5, A); } /* RES 5,A */
OP(cb,b0) { B = res(6, B); } /* RES 6,B */
@@ -1574,7 +1671,7 @@ OP(cb,b2) { D = res(6, D); } /* RES 6,D */
OP(cb,b3) { E = res(6, E); } /* RES 6,E */
OP(cb,b4) { H = res(6, H); } /* RES 6,H */
OP(cb,b5) { L = res(6, L); } /* RES 6,L */
-OP(cb,b6) { wm(HL, res(6, rm(HL))); } /* RES 6,(HL) */
+OP(cb,b6) { wm(HL, res(6, rm_reg(HL))); } /* RES 6,(HL) */
OP(cb,b7) { A = res(6, A); } /* RES 6,A */
OP(cb,b8) { B = res(7, B); } /* RES 7,B */
@@ -1583,7 +1680,7 @@ OP(cb,ba) { D = res(7, D); } /* RES 7,D */
OP(cb,bb) { E = res(7, E); } /* RES 7,E */
OP(cb,bc) { H = res(7, H); } /* RES 7,H */
OP(cb,bd) { L = res(7, L); } /* RES 7,L */
-OP(cb,be) { wm(HL, res(7, rm(HL))); } /* RES 7,(HL) */
+OP(cb,be) { wm(HL, res(7, rm_reg(HL))); } /* RES 7,(HL) */
OP(cb,bf) { A = res(7, A); } /* RES 7,A */
OP(cb,c0) { B = set(0, B); } /* SET 0,B */
@@ -1592,7 +1689,7 @@ OP(cb,c2) { D = set(0, D); } /* SET 0,D */
OP(cb,c3) { E = set(0, E); } /* SET 0,E */
OP(cb,c4) { H = set(0, H); } /* SET 0,H */
OP(cb,c5) { L = set(0, L); } /* SET 0,L */
-OP(cb,c6) { wm(HL, set(0, rm(HL))); } /* SET 0,(HL) */
+OP(cb,c6) { wm(HL, set(0, rm_reg(HL))); } /* SET 0,(HL) */
OP(cb,c7) { A = set(0, A); } /* SET 0,A */
OP(cb,c8) { B = set(1, B); } /* SET 1,B */
@@ -1601,7 +1698,7 @@ OP(cb,ca) { D = set(1, D); } /* SET 1,D */
OP(cb,cb) { E = set(1, E); } /* SET 1,E */
OP(cb,cc) { H = set(1, H); } /* SET 1,H */
OP(cb,cd) { L = set(1, L); } /* SET 1,L */
-OP(cb,ce) { wm(HL, set(1, rm(HL))); } /* SET 1,(HL) */
+OP(cb,ce) { wm(HL, set(1, rm_reg(HL))); } /* SET 1,(HL) */
OP(cb,cf) { A = set(1, A); } /* SET 1,A */
OP(cb,d0) { B = set(2, B); } /* SET 2,B */
@@ -1610,7 +1707,7 @@ OP(cb,d2) { D = set(2, D); } /* SET 2,D */
OP(cb,d3) { E = set(2, E); } /* SET 2,E */
OP(cb,d4) { H = set(2, H); } /* SET 2,H */
OP(cb,d5) { L = set(2, L); } /* SET 2,L */
-OP(cb,d6) { wm(HL, set(2, rm(HL))); } /* SET 2,(HL) */
+OP(cb,d6) { wm(HL, set(2, rm_reg(HL))); } /* SET 2,(HL) */
OP(cb,d7) { A = set(2, A); } /* SET 2,A */
OP(cb,d8) { B = set(3, B); } /* SET 3,B */
@@ -1619,7 +1716,7 @@ OP(cb,da) { D = set(3, D); } /* SET 3,D */
OP(cb,db) { E = set(3, E); } /* SET 3,E */
OP(cb,dc) { H = set(3, H); } /* SET 3,H */
OP(cb,dd) { L = set(3, L); } /* SET 3,L */
-OP(cb,de) { wm(HL, set(3, rm(HL))); } /* SET 3,(HL) */
+OP(cb,de) { wm(HL, set(3, rm_reg(HL))); } /* SET 3,(HL) */
OP(cb,df) { A = set(3, A); } /* SET 3,A */
OP(cb,e0) { B = set(4, B); } /* SET 4,B */
@@ -1628,7 +1725,7 @@ OP(cb,e2) { D = set(4, D); } /* SET 4,D */
OP(cb,e3) { E = set(4, E); } /* SET 4,E */
OP(cb,e4) { H = set(4, H); } /* SET 4,H */
OP(cb,e5) { L = set(4, L); } /* SET 4,L */
-OP(cb,e6) { wm(HL, set(4, rm(HL))); } /* SET 4,(HL) */
+OP(cb,e6) { wm(HL, set(4, rm_reg(HL))); } /* SET 4,(HL) */
OP(cb,e7) { A = set(4, A); } /* SET 4,A */
OP(cb,e8) { B = set(5, B); } /* SET 5,B */
@@ -1637,7 +1734,7 @@ OP(cb,ea) { D = set(5, D); } /* SET 5,D */
OP(cb,eb) { E = set(5, E); } /* SET 5,E */
OP(cb,ec) { H = set(5, H); } /* SET 5,H */
OP(cb,ed) { L = set(5, L); } /* SET 5,L */
-OP(cb,ee) { wm(HL, set(5, rm(HL))); } /* SET 5,(HL) */
+OP(cb,ee) { wm(HL, set(5, rm_reg(HL))); } /* SET 5,(HL) */
OP(cb,ef) { A = set(5, A); } /* SET 5,A */
OP(cb,f0) { B = set(6, B); } /* SET 6,B */
@@ -1646,7 +1743,7 @@ OP(cb,f2) { D = set(6, D); } /* SET 6,D */
OP(cb,f3) { E = set(6, E); } /* SET 6,E */
OP(cb,f4) { H = set(6, H); } /* SET 6,H */
OP(cb,f5) { L = set(6, L); } /* SET 6,L */
-OP(cb,f6) { wm(HL, set(6, rm(HL))); } /* SET 6,(HL) */
+OP(cb,f6) { wm(HL, set(6, rm_reg(HL))); } /* SET 6,(HL) */
OP(cb,f7) { A = set(6, A); } /* SET 6,A */
OP(cb,f8) { B = set(7, B); } /* SET 7,B */
@@ -1655,7 +1752,7 @@ OP(cb,fa) { D = set(7, D); } /* SET 7,D */
OP(cb,fb) { E = set(7, E); } /* SET 7,E */
OP(cb,fc) { H = set(7, H); } /* SET 7,H */
OP(cb,fd) { L = set(7, L); } /* SET 7,L */
-OP(cb,fe) { wm(HL, set(7, rm(HL))); } /* SET 7,(HL) */
+OP(cb,fe) { wm(HL, set(7, rm_reg(HL))); } /* SET 7,(HL) */
OP(cb,ff) { A = set(7, A); } /* SET 7,A */
@@ -1663,77 +1760,77 @@ OP(cb,ff) { A = set(7, A); } /* SET 7,A */
* opcodes with DD/FD CB prefix
* rotate, shift and bit operations with (IX+o)
**********************************************************/
-OP(xycb,00) { B = rlc(rm(m_ea)); wm(m_ea, B); } /* RLC B=(XY+o) */
-OP(xycb,01) { C = rlc(rm(m_ea)); wm(m_ea, C); } /* RLC C=(XY+o) */
-OP(xycb,02) { D = rlc(rm(m_ea)); wm(m_ea, D); } /* RLC D=(XY+o) */
-OP(xycb,03) { E = rlc(rm(m_ea)); wm(m_ea, E); } /* RLC E=(XY+o) */
-OP(xycb,04) { H = rlc(rm(m_ea)); wm(m_ea, H); } /* RLC H=(XY+o) */
-OP(xycb,05) { L = rlc(rm(m_ea)); wm(m_ea, L); } /* RLC L=(XY+o) */
-OP(xycb,06) { wm(m_ea, rlc(rm(m_ea))); } /* RLC (XY+o) */
-OP(xycb,07) { A = rlc(rm(m_ea)); wm(m_ea, A); } /* RLC A=(XY+o) */
-
-OP(xycb,08) { B = rrc(rm(m_ea)); wm(m_ea, B); } /* RRC B=(XY+o) */
-OP(xycb,09) { C = rrc(rm(m_ea)); wm(m_ea, C); } /* RRC C=(XY+o) */
-OP(xycb,0a) { D = rrc(rm(m_ea)); wm(m_ea, D); } /* RRC D=(XY+o) */
-OP(xycb,0b) { E = rrc(rm(m_ea)); wm(m_ea, E); } /* RRC E=(XY+o) */
-OP(xycb,0c) { H = rrc(rm(m_ea)); wm(m_ea, H); } /* RRC H=(XY+o) */
-OP(xycb,0d) { L = rrc(rm(m_ea)); wm(m_ea, L); } /* RRC L=(XY+o) */
-OP(xycb,0e) { wm(m_ea,rrc(rm(m_ea))); } /* RRC (XY+o) */
-OP(xycb,0f) { A = rrc(rm(m_ea)); wm(m_ea, A); } /* RRC A=(XY+o) */
-
-OP(xycb,10) { B = rl(rm(m_ea)); wm(m_ea, B); } /* RL B=(XY+o) */
-OP(xycb,11) { C = rl(rm(m_ea)); wm(m_ea, C); } /* RL C=(XY+o) */
-OP(xycb,12) { D = rl(rm(m_ea)); wm(m_ea, D); } /* RL D=(XY+o) */
-OP(xycb,13) { E = rl(rm(m_ea)); wm(m_ea, E); } /* RL E=(XY+o) */
-OP(xycb,14) { H = rl(rm(m_ea)); wm(m_ea, H); } /* RL H=(XY+o) */
-OP(xycb,15) { L = rl(rm(m_ea)); wm(m_ea, L); } /* RL L=(XY+o) */
-OP(xycb,16) { wm(m_ea,rl(rm(m_ea))); } /* RL (XY+o) */
-OP(xycb,17) { A = rl(rm(m_ea)); wm(m_ea, A); } /* RL A=(XY+o) */
-
-OP(xycb,18) { B = rr(rm(m_ea)); wm(m_ea, B); } /* RR B=(XY+o) */
-OP(xycb,19) { C = rr(rm(m_ea)); wm(m_ea, C); } /* RR C=(XY+o) */
-OP(xycb,1a) { D = rr(rm(m_ea)); wm(m_ea, D); } /* RR D=(XY+o) */
-OP(xycb,1b) { E = rr(rm(m_ea)); wm(m_ea, E); } /* RR E=(XY+o) */
-OP(xycb,1c) { H = rr(rm(m_ea)); wm(m_ea, H); } /* RR H=(XY+o) */
-OP(xycb,1d) { L = rr(rm(m_ea)); wm(m_ea, L); } /* RR L=(XY+o) */
-OP(xycb,1e) { wm(m_ea, rr(rm(m_ea))); } /* RR (XY+o) */
-OP(xycb,1f) { A = rr(rm(m_ea)); wm(m_ea, A); } /* RR A=(XY+o) */
-
-OP(xycb,20) { B = sla(rm(m_ea)); wm(m_ea, B); } /* SLA B=(XY+o) */
-OP(xycb,21) { C = sla(rm(m_ea)); wm(m_ea, C); } /* SLA C=(XY+o) */
-OP(xycb,22) { D = sla(rm(m_ea)); wm(m_ea, D); } /* SLA D=(XY+o) */
-OP(xycb,23) { E = sla(rm(m_ea)); wm(m_ea, E); } /* SLA E=(XY+o) */
-OP(xycb,24) { H = sla(rm(m_ea)); wm(m_ea, H); } /* SLA H=(XY+o) */
-OP(xycb,25) { L = sla(rm(m_ea)); wm(m_ea, L); } /* SLA L=(XY+o) */
-OP(xycb,26) { wm(m_ea, sla(rm(m_ea))); } /* SLA (XY+o) */
-OP(xycb,27) { A = sla(rm(m_ea)); wm(m_ea, A); } /* SLA A=(XY+o) */
-
-OP(xycb,28) { B = sra(rm(m_ea)); wm(m_ea, B); } /* SRA B=(XY+o) */
-OP(xycb,29) { C = sra(rm(m_ea)); wm(m_ea, C); } /* SRA C=(XY+o) */
-OP(xycb,2a) { D = sra(rm(m_ea)); wm(m_ea, D); } /* SRA D=(XY+o) */
-OP(xycb,2b) { E = sra(rm(m_ea)); wm(m_ea, E); } /* SRA E=(XY+o) */
-OP(xycb,2c) { H = sra(rm(m_ea)); wm(m_ea, H); } /* SRA H=(XY+o) */
-OP(xycb,2d) { L = sra(rm(m_ea)); wm(m_ea, L); } /* SRA L=(XY+o) */
-OP(xycb,2e) { wm(m_ea, sra(rm(m_ea))); } /* SRA (XY+o) */
-OP(xycb,2f) { A = sra(rm(m_ea)); wm(m_ea, A); } /* SRA A=(XY+o) */
-
-OP(xycb,30) { B = sll(rm(m_ea)); wm(m_ea, B); } /* SLL B=(XY+o) */
-OP(xycb,31) { C = sll(rm(m_ea)); wm(m_ea, C); } /* SLL C=(XY+o) */
-OP(xycb,32) { D = sll(rm(m_ea)); wm(m_ea, D); } /* SLL D=(XY+o) */
-OP(xycb,33) { E = sll(rm(m_ea)); wm(m_ea, E); } /* SLL E=(XY+o) */
-OP(xycb,34) { H = sll(rm(m_ea)); wm(m_ea, H); } /* SLL H=(XY+o) */
-OP(xycb,35) { L = sll(rm(m_ea)); wm(m_ea, L); } /* SLL L=(XY+o) */
-OP(xycb,36) { wm(m_ea, sll(rm(m_ea))); } /* SLL (XY+o) */
-OP(xycb,37) { A = sll(rm(m_ea)); wm(m_ea, A); } /* SLL A=(XY+o) */
-
-OP(xycb,38) { B = srl(rm(m_ea)); wm(m_ea, B); } /* SRL B=(XY+o) */
-OP(xycb,39) { C = srl(rm(m_ea)); wm(m_ea, C); } /* SRL C=(XY+o) */
-OP(xycb,3a) { D = srl(rm(m_ea)); wm(m_ea, D); } /* SRL D=(XY+o) */
-OP(xycb,3b) { E = srl(rm(m_ea)); wm(m_ea, E); } /* SRL E=(XY+o) */
-OP(xycb,3c) { H = srl(rm(m_ea)); wm(m_ea, H); } /* SRL H=(XY+o) */
-OP(xycb,3d) { L = srl(rm(m_ea)); wm(m_ea, L); } /* SRL L=(XY+o) */
-OP(xycb,3e) { wm(m_ea, srl(rm(m_ea))); } /* SRL (XY+o) */
-OP(xycb,3f) { A = srl(rm(m_ea)); wm(m_ea, A); } /* SRL A=(XY+o) */
+OP(xycb,00) { B = rlc(rm_reg(m_ea)); wm(m_ea, B); } /* RLC B=(XY+o) */
+OP(xycb,01) { C = rlc(rm_reg(m_ea)); wm(m_ea, C); } /* RLC C=(XY+o) */
+OP(xycb,02) { D = rlc(rm_reg(m_ea)); wm(m_ea, D); } /* RLC D=(XY+o) */
+OP(xycb,03) { E = rlc(rm_reg(m_ea)); wm(m_ea, E); } /* RLC E=(XY+o) */
+OP(xycb,04) { H = rlc(rm_reg(m_ea)); wm(m_ea, H); } /* RLC H=(XY+o) */
+OP(xycb,05) { L = rlc(rm_reg(m_ea)); wm(m_ea, L); } /* RLC L=(XY+o) */
+OP(xycb,06) { wm(m_ea, rlc(rm_reg(m_ea))); } /* RLC (XY+o) */
+OP(xycb,07) { A = rlc(rm_reg(m_ea)); wm(m_ea, A); } /* RLC A=(XY+o) */
+
+OP(xycb,08) { B = rrc(rm_reg(m_ea)); wm(m_ea, B); } /* RRC B=(XY+o) */
+OP(xycb,09) { C = rrc(rm_reg(m_ea)); wm(m_ea, C); } /* RRC C=(XY+o) */
+OP(xycb,0a) { D = rrc(rm_reg(m_ea)); wm(m_ea, D); } /* RRC D=(XY+o) */
+OP(xycb,0b) { E = rrc(rm_reg(m_ea)); wm(m_ea, E); } /* RRC E=(XY+o) */
+OP(xycb,0c) { H = rrc(rm_reg(m_ea)); wm(m_ea, H); } /* RRC H=(XY+o) */
+OP(xycb,0d) { L = rrc(rm_reg(m_ea)); wm(m_ea, L); } /* RRC L=(XY+o) */
+OP(xycb,0e) { wm(m_ea,rrc(rm_reg(m_ea))); } /* RRC (XY+o) */
+OP(xycb,0f) { A = rrc(rm_reg(m_ea)); wm(m_ea, A); } /* RRC A=(XY+o) */
+
+OP(xycb,10) { B = rl(rm_reg(m_ea)); wm(m_ea, B); } /* RL B=(XY+o) */
+OP(xycb,11) { C = rl(rm_reg(m_ea)); wm(m_ea, C); } /* RL C=(XY+o) */
+OP(xycb,12) { D = rl(rm_reg(m_ea)); wm(m_ea, D); } /* RL D=(XY+o) */
+OP(xycb,13) { E = rl(rm_reg(m_ea)); wm(m_ea, E); } /* RL E=(XY+o) */
+OP(xycb,14) { H = rl(rm_reg(m_ea)); wm(m_ea, H); } /* RL H=(XY+o) */
+OP(xycb,15) { L = rl(rm_reg(m_ea)); wm(m_ea, L); } /* RL L=(XY+o) */
+OP(xycb,16) { wm(m_ea,rl(rm_reg(m_ea))); } /* RL (XY+o) */
+OP(xycb,17) { A = rl(rm_reg(m_ea)); wm(m_ea, A); } /* RL A=(XY+o) */
+
+OP(xycb,18) { B = rr(rm_reg(m_ea)); wm(m_ea, B); } /* RR B=(XY+o) */
+OP(xycb,19) { C = rr(rm_reg(m_ea)); wm(m_ea, C); } /* RR C=(XY+o) */
+OP(xycb,1a) { D = rr(rm_reg(m_ea)); wm(m_ea, D); } /* RR D=(XY+o) */
+OP(xycb,1b) { E = rr(rm_reg(m_ea)); wm(m_ea, E); } /* RR E=(XY+o) */
+OP(xycb,1c) { H = rr(rm_reg(m_ea)); wm(m_ea, H); } /* RR H=(XY+o) */
+OP(xycb,1d) { L = rr(rm_reg(m_ea)); wm(m_ea, L); } /* RR L=(XY+o) */
+OP(xycb,1e) { wm(m_ea, rr(rm_reg(m_ea))); } /* RR (XY+o) */
+OP(xycb,1f) { A = rr(rm_reg(m_ea)); wm(m_ea, A); } /* RR A=(XY+o) */
+
+OP(xycb,20) { B = sla(rm_reg(m_ea)); wm(m_ea, B); } /* SLA B=(XY+o) */
+OP(xycb,21) { C = sla(rm_reg(m_ea)); wm(m_ea, C); } /* SLA C=(XY+o) */
+OP(xycb,22) { D = sla(rm_reg(m_ea)); wm(m_ea, D); } /* SLA D=(XY+o) */
+OP(xycb,23) { E = sla(rm_reg(m_ea)); wm(m_ea, E); } /* SLA E=(XY+o) */
+OP(xycb,24) { H = sla(rm_reg(m_ea)); wm(m_ea, H); } /* SLA H=(XY+o) */
+OP(xycb,25) { L = sla(rm_reg(m_ea)); wm(m_ea, L); } /* SLA L=(XY+o) */
+OP(xycb,26) { wm(m_ea, sla(rm_reg(m_ea))); } /* SLA (XY+o) */
+OP(xycb,27) { A = sla(rm_reg(m_ea)); wm(m_ea, A); } /* SLA A=(XY+o) */
+
+OP(xycb,28) { B = sra(rm_reg(m_ea)); wm(m_ea, B); } /* SRA B=(XY+o) */
+OP(xycb,29) { C = sra(rm_reg(m_ea)); wm(m_ea, C); } /* SRA C=(XY+o) */
+OP(xycb,2a) { D = sra(rm_reg(m_ea)); wm(m_ea, D); } /* SRA D=(XY+o) */
+OP(xycb,2b) { E = sra(rm_reg(m_ea)); wm(m_ea, E); } /* SRA E=(XY+o) */
+OP(xycb,2c) { H = sra(rm_reg(m_ea)); wm(m_ea, H); } /* SRA H=(XY+o) */
+OP(xycb,2d) { L = sra(rm_reg(m_ea)); wm(m_ea, L); } /* SRA L=(XY+o) */
+OP(xycb,2e) { wm(m_ea, sra(rm_reg(m_ea))); } /* SRA (XY+o) */
+OP(xycb,2f) { A = sra(rm_reg(m_ea)); wm(m_ea, A); } /* SRA A=(XY+o) */
+
+OP(xycb,30) { B = sll(rm_reg(m_ea)); wm(m_ea, B); } /* SLL B=(XY+o) */
+OP(xycb,31) { C = sll(rm_reg(m_ea)); wm(m_ea, C); } /* SLL C=(XY+o) */
+OP(xycb,32) { D = sll(rm_reg(m_ea)); wm(m_ea, D); } /* SLL D=(XY+o) */
+OP(xycb,33) { E = sll(rm_reg(m_ea)); wm(m_ea, E); } /* SLL E=(XY+o) */
+OP(xycb,34) { H = sll(rm_reg(m_ea)); wm(m_ea, H); } /* SLL H=(XY+o) */
+OP(xycb,35) { L = sll(rm_reg(m_ea)); wm(m_ea, L); } /* SLL L=(XY+o) */
+OP(xycb,36) { wm(m_ea, sll(rm_reg(m_ea))); } /* SLL (XY+o) */
+OP(xycb,37) { A = sll(rm_reg(m_ea)); wm(m_ea, A); } /* SLL A=(XY+o) */
+
+OP(xycb,38) { B = srl(rm_reg(m_ea)); wm(m_ea, B); } /* SRL B=(XY+o) */
+OP(xycb,39) { C = srl(rm_reg(m_ea)); wm(m_ea, C); } /* SRL C=(XY+o) */
+OP(xycb,3a) { D = srl(rm_reg(m_ea)); wm(m_ea, D); } /* SRL D=(XY+o) */
+OP(xycb,3b) { E = srl(rm_reg(m_ea)); wm(m_ea, E); } /* SRL E=(XY+o) */
+OP(xycb,3c) { H = srl(rm_reg(m_ea)); wm(m_ea, H); } /* SRL H=(XY+o) */
+OP(xycb,3d) { L = srl(rm_reg(m_ea)); wm(m_ea, L); } /* SRL L=(XY+o) */
+OP(xycb,3e) { wm(m_ea, srl(rm_reg(m_ea))); } /* SRL (XY+o) */
+OP(xycb,3f) { A = srl(rm_reg(m_ea)); wm(m_ea, A); } /* SRL A=(XY+o) */
OP(xycb,40) { xycb_46(); } /* BIT 0,(XY+o) */
OP(xycb,41) { xycb_46(); } /* BIT 0,(XY+o) */
@@ -1741,7 +1838,7 @@ OP(xycb,42) { xycb_46(); } /* BIT 0,(XY+o) */
OP(xycb,43) { xycb_46(); } /* BIT 0,(XY+o) */
OP(xycb,44) { xycb_46(); } /* BIT 0,(XY+o) */
OP(xycb,45) { xycb_46(); } /* BIT 0,(XY+o) */
-OP(xycb,46) { bit_xy(0, rm(m_ea)); } /* BIT 0,(XY+o) */
+OP(xycb,46) { bit_xy(0, rm_reg(m_ea)); } /* BIT 0,(XY+o) */
OP(xycb,47) { xycb_46(); } /* BIT 0,(XY+o) */
OP(xycb,48) { xycb_4e(); } /* BIT 1,(XY+o) */
@@ -1750,7 +1847,7 @@ OP(xycb,4a) { xycb_4e(); } /* BIT 1,(XY+o) */
OP(xycb,4b) { xycb_4e(); } /* BIT 1,(XY+o) */
OP(xycb,4c) { xycb_4e(); } /* BIT 1,(XY+o) */
OP(xycb,4d) { xycb_4e(); } /* BIT 1,(XY+o) */
-OP(xycb,4e) { bit_xy(1, rm(m_ea)); } /* BIT 1,(XY+o) */
+OP(xycb,4e) { bit_xy(1, rm_reg(m_ea)); } /* BIT 1,(XY+o) */
OP(xycb,4f) { xycb_4e(); } /* BIT 1,(XY+o) */
OP(xycb,50) { xycb_56(); } /* BIT 2,(XY+o) */
@@ -1759,7 +1856,7 @@ OP(xycb,52) { xycb_56(); } /* BIT 2,(XY+o) */
OP(xycb,53) { xycb_56(); } /* BIT 2,(XY+o) */
OP(xycb,54) { xycb_56(); } /* BIT 2,(XY+o) */
OP(xycb,55) { xycb_56(); } /* BIT 2,(XY+o) */
-OP(xycb,56) { bit_xy(2, rm(m_ea)); } /* BIT 2,(XY+o) */
+OP(xycb,56) { bit_xy(2, rm_reg(m_ea)); } /* BIT 2,(XY+o) */
OP(xycb,57) { xycb_56(); } /* BIT 2,(XY+o) */
OP(xycb,58) { xycb_5e(); } /* BIT 3,(XY+o) */
@@ -1768,7 +1865,7 @@ OP(xycb,5a) { xycb_5e(); } /* BIT 3,(XY+o) */
OP(xycb,5b) { xycb_5e(); } /* BIT 3,(XY+o) */
OP(xycb,5c) { xycb_5e(); } /* BIT 3,(XY+o) */
OP(xycb,5d) { xycb_5e(); } /* BIT 3,(XY+o) */
-OP(xycb,5e) { bit_xy(3, rm(m_ea)); } /* BIT 3,(XY+o) */
+OP(xycb,5e) { bit_xy(3, rm_reg(m_ea)); } /* BIT 3,(XY+o) */
OP(xycb,5f) { xycb_5e(); } /* BIT 3,(XY+o) */
OP(xycb,60) { xycb_66(); } /* BIT 4,(XY+o) */
@@ -1777,7 +1874,7 @@ OP(xycb,62) { xycb_66(); } /* BIT 4,(XY+o) */
OP(xycb,63) { xycb_66(); } /* BIT 4,(XY+o) */
OP(xycb,64) { xycb_66(); } /* BIT 4,(XY+o) */
OP(xycb,65) { xycb_66(); } /* BIT 4,(XY+o) */
-OP(xycb,66) { bit_xy(4, rm(m_ea)); } /* BIT 4,(XY+o) */
+OP(xycb,66) { bit_xy(4, rm_reg(m_ea)); } /* BIT 4,(XY+o) */
OP(xycb,67) { xycb_66(); } /* BIT 4,(XY+o) */
OP(xycb,68) { xycb_6e(); } /* BIT 5,(XY+o) */
@@ -1786,7 +1883,7 @@ OP(xycb,6a) { xycb_6e(); } /* BIT 5,(XY+o) */
OP(xycb,6b) { xycb_6e(); } /* BIT 5,(XY+o) */
OP(xycb,6c) { xycb_6e(); } /* BIT 5,(XY+o) */
OP(xycb,6d) { xycb_6e(); } /* BIT 5,(XY+o) */
-OP(xycb,6e) { bit_xy(5, rm(m_ea)); } /* BIT 5,(XY+o) */
+OP(xycb,6e) { bit_xy(5, rm_reg(m_ea)); } /* BIT 5,(XY+o) */
OP(xycb,6f) { xycb_6e(); } /* BIT 5,(XY+o) */
OP(xycb,70) { xycb_76(); } /* BIT 6,(XY+o) */
@@ -1795,7 +1892,7 @@ OP(xycb,72) { xycb_76(); } /* BIT 6,(XY+o) */
OP(xycb,73) { xycb_76(); } /* BIT 6,(XY+o) */
OP(xycb,74) { xycb_76(); } /* BIT 6,(XY+o) */
OP(xycb,75) { xycb_76(); } /* BIT 6,(XY+o) */
-OP(xycb,76) { bit_xy(6, rm(m_ea)); } /* BIT 6,(XY+o) */
+OP(xycb,76) { bit_xy(6, rm_reg(m_ea)); } /* BIT 6,(XY+o) */
OP(xycb,77) { xycb_76(); } /* BIT 6,(XY+o) */
OP(xycb,78) { xycb_7e(); } /* BIT 7,(XY+o) */
@@ -1804,152 +1901,152 @@ OP(xycb,7a) { xycb_7e(); } /* BIT 7,(XY+o) */
OP(xycb,7b) { xycb_7e(); } /* BIT 7,(XY+o) */
OP(xycb,7c) { xycb_7e(); } /* BIT 7,(XY+o) */
OP(xycb,7d) { xycb_7e(); } /* BIT 7,(XY+o) */
-OP(xycb,7e) { bit_xy(7, rm(m_ea)); } /* BIT 7,(XY+o) */
+OP(xycb,7e) { bit_xy(7, rm_reg(m_ea)); } /* BIT 7,(XY+o) */
OP(xycb,7f) { xycb_7e(); } /* BIT 7,(XY+o) */
-OP(xycb,80) { B = res(0, rm(m_ea)); wm(m_ea, B); } /* RES 0,B=(XY+o) */
-OP(xycb,81) { C = res(0, rm(m_ea)); wm(m_ea, C); } /* RES 0,C=(XY+o) */
-OP(xycb,82) { D = res(0, rm(m_ea)); wm(m_ea, D); } /* RES 0,D=(XY+o) */
-OP(xycb,83) { E = res(0, rm(m_ea)); wm(m_ea, E); } /* RES 0,E=(XY+o) */
-OP(xycb,84) { H = res(0, rm(m_ea)); wm(m_ea, H); } /* RES 0,H=(XY+o) */
-OP(xycb,85) { L = res(0, rm(m_ea)); wm(m_ea, L); } /* RES 0,L=(XY+o) */
-OP(xycb,86) { wm(m_ea, res(0, rm(m_ea))); } /* RES 0,(XY+o) */
-OP(xycb,87) { A = res(0, rm(m_ea)); wm(m_ea, A); } /* RES 0,A=(XY+o) */
-
-OP(xycb,88) { B = res(1, rm(m_ea)); wm(m_ea, B); } /* RES 1,B=(XY+o) */
-OP(xycb,89) { C = res(1, rm(m_ea)); wm(m_ea, C); } /* RES 1,C=(XY+o) */
-OP(xycb,8a) { D = res(1, rm(m_ea)); wm(m_ea, D); } /* RES 1,D=(XY+o) */
-OP(xycb,8b) { E = res(1, rm(m_ea)); wm(m_ea, E); } /* RES 1,E=(XY+o) */
-OP(xycb,8c) { H = res(1, rm(m_ea)); wm(m_ea, H); } /* RES 1,H=(XY+o) */
-OP(xycb,8d) { L = res(1, rm(m_ea)); wm(m_ea, L); } /* RES 1,L=(XY+o) */
-OP(xycb,8e) { wm(m_ea, res(1, rm(m_ea))); } /* RES 1,(XY+o) */
-OP(xycb,8f) { A = res(1, rm(m_ea)); wm(m_ea, A); } /* RES 1,A=(XY+o) */
-
-OP(xycb,90) { B = res(2, rm(m_ea)); wm(m_ea, B); } /* RES 2,B=(XY+o) */
-OP(xycb,91) { C = res(2, rm(m_ea)); wm(m_ea, C); } /* RES 2,C=(XY+o) */
-OP(xycb,92) { D = res(2, rm(m_ea)); wm(m_ea, D); } /* RES 2,D=(XY+o) */
-OP(xycb,93) { E = res(2, rm(m_ea)); wm(m_ea, E); } /* RES 2,E=(XY+o) */
-OP(xycb,94) { H = res(2, rm(m_ea)); wm(m_ea, H); } /* RES 2,H=(XY+o) */
-OP(xycb,95) { L = res(2, rm(m_ea)); wm(m_ea, L); } /* RES 2,L=(XY+o) */
-OP(xycb,96) { wm(m_ea, res(2, rm(m_ea))); } /* RES 2,(XY+o) */
-OP(xycb,97) { A = res(2, rm(m_ea)); wm(m_ea, A); } /* RES 2,A=(XY+o) */
-
-OP(xycb,98) { B = res(3, rm(m_ea)); wm(m_ea, B); } /* RES 3,B=(XY+o) */
-OP(xycb,99) { C = res(3, rm(m_ea)); wm(m_ea, C); } /* RES 3,C=(XY+o) */
-OP(xycb,9a) { D = res(3, rm(m_ea)); wm(m_ea, D); } /* RES 3,D=(XY+o) */
-OP(xycb,9b) { E = res(3, rm(m_ea)); wm(m_ea, E); } /* RES 3,E=(XY+o) */
-OP(xycb,9c) { H = res(3, rm(m_ea)); wm(m_ea, H); } /* RES 3,H=(XY+o) */
-OP(xycb,9d) { L = res(3, rm(m_ea)); wm(m_ea, L); } /* RES 3,L=(XY+o) */
-OP(xycb,9e) { wm(m_ea, res(3, rm(m_ea))); } /* RES 3,(XY+o) */
-OP(xycb,9f) { A = res(3, rm(m_ea)); wm(m_ea, A); } /* RES 3,A=(XY+o) */
-
-OP(xycb,a0) { B = res(4, rm(m_ea)); wm(m_ea, B); } /* RES 4,B=(XY+o) */
-OP(xycb,a1) { C = res(4, rm(m_ea)); wm(m_ea, C); } /* RES 4,C=(XY+o) */
-OP(xycb,a2) { D = res(4, rm(m_ea)); wm(m_ea, D); } /* RES 4,D=(XY+o) */
-OP(xycb,a3) { E = res(4, rm(m_ea)); wm(m_ea, E); } /* RES 4,E=(XY+o) */
-OP(xycb,a4) { H = res(4, rm(m_ea)); wm(m_ea, H); } /* RES 4,H=(XY+o) */
-OP(xycb,a5) { L = res(4, rm(m_ea)); wm(m_ea, L); } /* RES 4,L=(XY+o) */
-OP(xycb,a6) { wm(m_ea, res(4, rm(m_ea))); } /* RES 4,(XY+o) */
-OP(xycb,a7) { A = res(4, rm(m_ea)); wm(m_ea, A); } /* RES 4,A=(XY+o) */
-
-OP(xycb,a8) { B = res(5, rm(m_ea)); wm(m_ea, B); } /* RES 5,B=(XY+o) */
-OP(xycb,a9) { C = res(5, rm(m_ea)); wm(m_ea, C); } /* RES 5,C=(XY+o) */
-OP(xycb,aa) { D = res(5, rm(m_ea)); wm(m_ea, D); } /* RES 5,D=(XY+o) */
-OP(xycb,ab) { E = res(5, rm(m_ea)); wm(m_ea, E); } /* RES 5,E=(XY+o) */
-OP(xycb,ac) { H = res(5, rm(m_ea)); wm(m_ea, H); } /* RES 5,H=(XY+o) */
-OP(xycb,ad) { L = res(5, rm(m_ea)); wm(m_ea, L); } /* RES 5,L=(XY+o) */
-OP(xycb,ae) { wm(m_ea, res(5, rm(m_ea))); } /* RES 5,(XY+o) */
-OP(xycb,af) { A = res(5, rm(m_ea)); wm(m_ea, A); } /* RES 5,A=(XY+o) */
-
-OP(xycb,b0) { B = res(6, rm(m_ea)); wm(m_ea, B); } /* RES 6,B=(XY+o) */
-OP(xycb,b1) { C = res(6, rm(m_ea)); wm(m_ea, C); } /* RES 6,C=(XY+o) */
-OP(xycb,b2) { D = res(6, rm(m_ea)); wm(m_ea, D); } /* RES 6,D=(XY+o) */
-OP(xycb,b3) { E = res(6, rm(m_ea)); wm(m_ea, E); } /* RES 6,E=(XY+o) */
-OP(xycb,b4) { H = res(6, rm(m_ea)); wm(m_ea, H); } /* RES 6,H=(XY+o) */
-OP(xycb,b5) { L = res(6, rm(m_ea)); wm(m_ea, L); } /* RES 6,L=(XY+o) */
-OP(xycb,b6) { wm(m_ea, res(6, rm(m_ea))); } /* RES 6,(XY+o) */
-OP(xycb,b7) { A = res(6, rm(m_ea)); wm(m_ea, A); } /* RES 6,A=(XY+o) */
-
-OP(xycb,b8) { B = res(7, rm(m_ea)); wm(m_ea, B); } /* RES 7,B=(XY+o) */
-OP(xycb,b9) { C = res(7, rm(m_ea)); wm(m_ea, C); } /* RES 7,C=(XY+o) */
-OP(xycb,ba) { D = res(7, rm(m_ea)); wm(m_ea, D); } /* RES 7,D=(XY+o) */
-OP(xycb,bb) { E = res(7, rm(m_ea)); wm(m_ea, E); } /* RES 7,E=(XY+o) */
-OP(xycb,bc) { H = res(7, rm(m_ea)); wm(m_ea, H); } /* RES 7,H=(XY+o) */
-OP(xycb,bd) { L = res(7, rm(m_ea)); wm(m_ea, L); } /* RES 7,L=(XY+o) */
-OP(xycb,be) { wm(m_ea, res(7, rm(m_ea))); } /* RES 7,(XY+o) */
-OP(xycb,bf) { A = res(7, rm(m_ea)); wm(m_ea, A); } /* RES 7,A=(XY+o) */
-
-OP(xycb,c0) { B = set(0, rm(m_ea)); wm(m_ea, B); } /* SET 0,B=(XY+o) */
-OP(xycb,c1) { C = set(0, rm(m_ea)); wm(m_ea, C); } /* SET 0,C=(XY+o) */
-OP(xycb,c2) { D = set(0, rm(m_ea)); wm(m_ea, D); } /* SET 0,D=(XY+o) */
-OP(xycb,c3) { E = set(0, rm(m_ea)); wm(m_ea, E); } /* SET 0,E=(XY+o) */
-OP(xycb,c4) { H = set(0, rm(m_ea)); wm(m_ea, H); } /* SET 0,H=(XY+o) */
-OP(xycb,c5) { L = set(0, rm(m_ea)); wm(m_ea, L); } /* SET 0,L=(XY+o) */
-OP(xycb,c6) { wm(m_ea, set(0, rm(m_ea))); } /* SET 0,(XY+o) */
-OP(xycb,c7) { A = set(0, rm(m_ea)); wm(m_ea, A); } /* SET 0,A=(XY+o) */
-
-OP(xycb,c8) { B = set(1, rm(m_ea)); wm(m_ea, B); } /* SET 1,B=(XY+o) */
-OP(xycb,c9) { C = set(1, rm(m_ea)); wm(m_ea, C); } /* SET 1,C=(XY+o) */
-OP(xycb,ca) { D = set(1, rm(m_ea)); wm(m_ea, D); } /* SET 1,D=(XY+o) */
-OP(xycb,cb) { E = set(1, rm(m_ea)); wm(m_ea, E); } /* SET 1,E=(XY+o) */
-OP(xycb,cc) { H = set(1, rm(m_ea)); wm(m_ea, H); } /* SET 1,H=(XY+o) */
-OP(xycb,cd) { L = set(1, rm(m_ea)); wm(m_ea, L); } /* SET 1,L=(XY+o) */
-OP(xycb,ce) { wm(m_ea, set(1, rm(m_ea))); } /* SET 1,(XY+o) */
-OP(xycb,cf) { A = set(1, rm(m_ea)); wm(m_ea, A); } /* SET 1,A=(XY+o) */
-
-OP(xycb,d0) { B = set(2, rm(m_ea)); wm(m_ea, B); } /* SET 2,B=(XY+o) */
-OP(xycb,d1) { C = set(2, rm(m_ea)); wm(m_ea, C); } /* SET 2,C=(XY+o) */
-OP(xycb,d2) { D = set(2, rm(m_ea)); wm(m_ea, D); } /* SET 2,D=(XY+o) */
-OP(xycb,d3) { E = set(2, rm(m_ea)); wm(m_ea, E); } /* SET 2,E=(XY+o) */
-OP(xycb,d4) { H = set(2, rm(m_ea)); wm(m_ea, H); } /* SET 2,H=(XY+o) */
-OP(xycb,d5) { L = set(2, rm(m_ea)); wm(m_ea, L); } /* SET 2,L=(XY+o) */
-OP(xycb,d6) { wm(m_ea, set(2, rm(m_ea))); } /* SET 2,(XY+o) */
-OP(xycb,d7) { A = set(2, rm(m_ea)); wm(m_ea, A); } /* SET 2,A=(XY+o) */
-
-OP(xycb,d8) { B = set(3, rm(m_ea)); wm(m_ea, B); } /* SET 3,B=(XY+o) */
-OP(xycb,d9) { C = set(3, rm(m_ea)); wm(m_ea, C); } /* SET 3,C=(XY+o) */
-OP(xycb,da) { D = set(3, rm(m_ea)); wm(m_ea, D); } /* SET 3,D=(XY+o) */
-OP(xycb,db) { E = set(3, rm(m_ea)); wm(m_ea, E); } /* SET 3,E=(XY+o) */
-OP(xycb,dc) { H = set(3, rm(m_ea)); wm(m_ea, H); } /* SET 3,H=(XY+o) */
-OP(xycb,dd) { L = set(3, rm(m_ea)); wm(m_ea, L); } /* SET 3,L=(XY+o) */
-OP(xycb,de) { wm(m_ea, set(3, rm(m_ea))); } /* SET 3,(XY+o) */
-OP(xycb,df) { A = set(3, rm(m_ea)); wm(m_ea, A); } /* SET 3,A=(XY+o) */
-
-OP(xycb,e0) { B = set(4, rm(m_ea)); wm(m_ea, B); } /* SET 4,B=(XY+o) */
-OP(xycb,e1) { C = set(4, rm(m_ea)); wm(m_ea, C); } /* SET 4,C=(XY+o) */
-OP(xycb,e2) { D = set(4, rm(m_ea)); wm(m_ea, D); } /* SET 4,D=(XY+o) */
-OP(xycb,e3) { E = set(4, rm(m_ea)); wm(m_ea, E); } /* SET 4,E=(XY+o) */
-OP(xycb,e4) { H = set(4, rm(m_ea)); wm(m_ea, H); } /* SET 4,H=(XY+o) */
-OP(xycb,e5) { L = set(4, rm(m_ea)); wm(m_ea, L); } /* SET 4,L=(XY+o) */
-OP(xycb,e6) { wm(m_ea, set(4, rm(m_ea))); } /* SET 4,(XY+o) */
-OP(xycb,e7) { A = set(4, rm(m_ea)); wm(m_ea, A); } /* SET 4,A=(XY+o) */
-
-OP(xycb,e8) { B = set(5, rm(m_ea)); wm(m_ea, B); } /* SET 5,B=(XY+o) */
-OP(xycb,e9) { C = set(5, rm(m_ea)); wm(m_ea, C); } /* SET 5,C=(XY+o) */
-OP(xycb,ea) { D = set(5, rm(m_ea)); wm(m_ea, D); } /* SET 5,D=(XY+o) */
-OP(xycb,eb) { E = set(5, rm(m_ea)); wm(m_ea, E); } /* SET 5,E=(XY+o) */
-OP(xycb,ec) { H = set(5, rm(m_ea)); wm(m_ea, H); } /* SET 5,H=(XY+o) */
-OP(xycb,ed) { L = set(5, rm(m_ea)); wm(m_ea, L); } /* SET 5,L=(XY+o) */
-OP(xycb,ee) { wm(m_ea, set(5, rm(m_ea))); } /* SET 5,(XY+o) */
-OP(xycb,ef) { A = set(5, rm(m_ea)); wm(m_ea, A); } /* SET 5,A=(XY+o) */
-
-OP(xycb,f0) { B = set(6, rm(m_ea)); wm(m_ea, B); } /* SET 6,B=(XY+o) */
-OP(xycb,f1) { C = set(6, rm(m_ea)); wm(m_ea, C); } /* SET 6,C=(XY+o) */
-OP(xycb,f2) { D = set(6, rm(m_ea)); wm(m_ea, D); } /* SET 6,D=(XY+o) */
-OP(xycb,f3) { E = set(6, rm(m_ea)); wm(m_ea, E); } /* SET 6,E=(XY+o) */
-OP(xycb,f4) { H = set(6, rm(m_ea)); wm(m_ea, H); } /* SET 6,H=(XY+o) */
-OP(xycb,f5) { L = set(6, rm(m_ea)); wm(m_ea, L); } /* SET 6,L=(XY+o) */
-OP(xycb,f6) { wm(m_ea, set(6, rm(m_ea))); } /* SET 6,(XY+o) */
-OP(xycb,f7) { A = set(6, rm(m_ea)); wm(m_ea, A); } /* SET 6,A=(XY+o) */
-
-OP(xycb,f8) { B = set(7, rm(m_ea)); wm(m_ea, B); } /* SET 7,B=(XY+o) */
-OP(xycb,f9) { C = set(7, rm(m_ea)); wm(m_ea, C); } /* SET 7,C=(XY+o) */
-OP(xycb,fa) { D = set(7, rm(m_ea)); wm(m_ea, D); } /* SET 7,D=(XY+o) */
-OP(xycb,fb) { E = set(7, rm(m_ea)); wm(m_ea, E); } /* SET 7,E=(XY+o) */
-OP(xycb,fc) { H = set(7, rm(m_ea)); wm(m_ea, H); } /* SET 7,H=(XY+o) */
-OP(xycb,fd) { L = set(7, rm(m_ea)); wm(m_ea, L); } /* SET 7,L=(XY+o) */
-OP(xycb,fe) { wm(m_ea, set(7, rm(m_ea))); } /* SET 7,(XY+o) */
-OP(xycb,ff) { A = set(7, rm(m_ea)); wm(m_ea, A); } /* SET 7,A=(XY+o) */
+OP(xycb,80) { B = res(0, rm_reg(m_ea)); wm(m_ea, B); } /* RES 0,B=(XY+o) */
+OP(xycb,81) { C = res(0, rm_reg(m_ea)); wm(m_ea, C); } /* RES 0,C=(XY+o) */
+OP(xycb,82) { D = res(0, rm_reg(m_ea)); wm(m_ea, D); } /* RES 0,D=(XY+o) */
+OP(xycb,83) { E = res(0, rm_reg(m_ea)); wm(m_ea, E); } /* RES 0,E=(XY+o) */
+OP(xycb,84) { H = res(0, rm_reg(m_ea)); wm(m_ea, H); } /* RES 0,H=(XY+o) */
+OP(xycb,85) { L = res(0, rm_reg(m_ea)); wm(m_ea, L); } /* RES 0,L=(XY+o) */
+OP(xycb,86) { wm(m_ea, res(0, rm_reg(m_ea))); } /* RES 0,(XY+o) */
+OP(xycb,87) { A = res(0, rm_reg(m_ea)); wm(m_ea, A); } /* RES 0,A=(XY+o) */
+
+OP(xycb,88) { B = res(1, rm_reg(m_ea)); wm(m_ea, B); } /* RES 1,B=(XY+o) */
+OP(xycb,89) { C = res(1, rm_reg(m_ea)); wm(m_ea, C); } /* RES 1,C=(XY+o) */
+OP(xycb,8a) { D = res(1, rm_reg(m_ea)); wm(m_ea, D); } /* RES 1,D=(XY+o) */
+OP(xycb,8b) { E = res(1, rm_reg(m_ea)); wm(m_ea, E); } /* RES 1,E=(XY+o) */
+OP(xycb,8c) { H = res(1, rm_reg(m_ea)); wm(m_ea, H); } /* RES 1,H=(XY+o) */
+OP(xycb,8d) { L = res(1, rm_reg(m_ea)); wm(m_ea, L); } /* RES 1,L=(XY+o) */
+OP(xycb,8e) { wm(m_ea, res(1, rm_reg(m_ea))); } /* RES 1,(XY+o) */
+OP(xycb,8f) { A = res(1, rm_reg(m_ea)); wm(m_ea, A); } /* RES 1,A=(XY+o) */
+
+OP(xycb,90) { B = res(2, rm_reg(m_ea)); wm(m_ea, B); } /* RES 2,B=(XY+o) */
+OP(xycb,91) { C = res(2, rm_reg(m_ea)); wm(m_ea, C); } /* RES 2,C=(XY+o) */
+OP(xycb,92) { D = res(2, rm_reg(m_ea)); wm(m_ea, D); } /* RES 2,D=(XY+o) */
+OP(xycb,93) { E = res(2, rm_reg(m_ea)); wm(m_ea, E); } /* RES 2,E=(XY+o) */
+OP(xycb,94) { H = res(2, rm_reg(m_ea)); wm(m_ea, H); } /* RES 2,H=(XY+o) */
+OP(xycb,95) { L = res(2, rm_reg(m_ea)); wm(m_ea, L); } /* RES 2,L=(XY+o) */
+OP(xycb,96) { wm(m_ea, res(2, rm_reg(m_ea))); } /* RES 2,(XY+o) */
+OP(xycb,97) { A = res(2, rm_reg(m_ea)); wm(m_ea, A); } /* RES 2,A=(XY+o) */
+
+OP(xycb,98) { B = res(3, rm_reg(m_ea)); wm(m_ea, B); } /* RES 3,B=(XY+o) */
+OP(xycb,99) { C = res(3, rm_reg(m_ea)); wm(m_ea, C); } /* RES 3,C=(XY+o) */
+OP(xycb,9a) { D = res(3, rm_reg(m_ea)); wm(m_ea, D); } /* RES 3,D=(XY+o) */
+OP(xycb,9b) { E = res(3, rm_reg(m_ea)); wm(m_ea, E); } /* RES 3,E=(XY+o) */
+OP(xycb,9c) { H = res(3, rm_reg(m_ea)); wm(m_ea, H); } /* RES 3,H=(XY+o) */
+OP(xycb,9d) { L = res(3, rm_reg(m_ea)); wm(m_ea, L); } /* RES 3,L=(XY+o) */
+OP(xycb,9e) { wm(m_ea, res(3, rm_reg(m_ea))); } /* RES 3,(XY+o) */
+OP(xycb,9f) { A = res(3, rm_reg(m_ea)); wm(m_ea, A); } /* RES 3,A=(XY+o) */
+
+OP(xycb,a0) { B = res(4, rm_reg(m_ea)); wm(m_ea, B); } /* RES 4,B=(XY+o) */
+OP(xycb,a1) { C = res(4, rm_reg(m_ea)); wm(m_ea, C); } /* RES 4,C=(XY+o) */
+OP(xycb,a2) { D = res(4, rm_reg(m_ea)); wm(m_ea, D); } /* RES 4,D=(XY+o) */
+OP(xycb,a3) { E = res(4, rm_reg(m_ea)); wm(m_ea, E); } /* RES 4,E=(XY+o) */
+OP(xycb,a4) { H = res(4, rm_reg(m_ea)); wm(m_ea, H); } /* RES 4,H=(XY+o) */
+OP(xycb,a5) { L = res(4, rm_reg(m_ea)); wm(m_ea, L); } /* RES 4,L=(XY+o) */
+OP(xycb,a6) { wm(m_ea, res(4, rm_reg(m_ea))); } /* RES 4,(XY+o) */
+OP(xycb,a7) { A = res(4, rm_reg(m_ea)); wm(m_ea, A); } /* RES 4,A=(XY+o) */
+
+OP(xycb,a8) { B = res(5, rm_reg(m_ea)); wm(m_ea, B); } /* RES 5,B=(XY+o) */
+OP(xycb,a9) { C = res(5, rm_reg(m_ea)); wm(m_ea, C); } /* RES 5,C=(XY+o) */
+OP(xycb,aa) { D = res(5, rm_reg(m_ea)); wm(m_ea, D); } /* RES 5,D=(XY+o) */
+OP(xycb,ab) { E = res(5, rm_reg(m_ea)); wm(m_ea, E); } /* RES 5,E=(XY+o) */
+OP(xycb,ac) { H = res(5, rm_reg(m_ea)); wm(m_ea, H); } /* RES 5,H=(XY+o) */
+OP(xycb,ad) { L = res(5, rm_reg(m_ea)); wm(m_ea, L); } /* RES 5,L=(XY+o) */
+OP(xycb,ae) { wm(m_ea, res(5, rm_reg(m_ea))); } /* RES 5,(XY+o) */
+OP(xycb,af) { A = res(5, rm_reg(m_ea)); wm(m_ea, A); } /* RES 5,A=(XY+o) */
+
+OP(xycb,b0) { B = res(6, rm_reg(m_ea)); wm(m_ea, B); } /* RES 6,B=(XY+o) */
+OP(xycb,b1) { C = res(6, rm_reg(m_ea)); wm(m_ea, C); } /* RES 6,C=(XY+o) */
+OP(xycb,b2) { D = res(6, rm_reg(m_ea)); wm(m_ea, D); } /* RES 6,D=(XY+o) */
+OP(xycb,b3) { E = res(6, rm_reg(m_ea)); wm(m_ea, E); } /* RES 6,E=(XY+o) */
+OP(xycb,b4) { H = res(6, rm_reg(m_ea)); wm(m_ea, H); } /* RES 6,H=(XY+o) */
+OP(xycb,b5) { L = res(6, rm_reg(m_ea)); wm(m_ea, L); } /* RES 6,L=(XY+o) */
+OP(xycb,b6) { wm(m_ea, res(6, rm_reg(m_ea))); } /* RES 6,(XY+o) */
+OP(xycb,b7) { A = res(6, rm_reg(m_ea)); wm(m_ea, A); } /* RES 6,A=(XY+o) */
+
+OP(xycb,b8) { B = res(7, rm_reg(m_ea)); wm(m_ea, B); } /* RES 7,B=(XY+o) */
+OP(xycb,b9) { C = res(7, rm_reg(m_ea)); wm(m_ea, C); } /* RES 7,C=(XY+o) */
+OP(xycb,ba) { D = res(7, rm_reg(m_ea)); wm(m_ea, D); } /* RES 7,D=(XY+o) */
+OP(xycb,bb) { E = res(7, rm_reg(m_ea)); wm(m_ea, E); } /* RES 7,E=(XY+o) */
+OP(xycb,bc) { H = res(7, rm_reg(m_ea)); wm(m_ea, H); } /* RES 7,H=(XY+o) */
+OP(xycb,bd) { L = res(7, rm_reg(m_ea)); wm(m_ea, L); } /* RES 7,L=(XY+o) */
+OP(xycb,be) { wm(m_ea, res(7, rm_reg(m_ea))); } /* RES 7,(XY+o) */
+OP(xycb,bf) { A = res(7, rm_reg(m_ea)); wm(m_ea, A); } /* RES 7,A=(XY+o) */
+
+OP(xycb,c0) { B = set(0, rm_reg(m_ea)); wm(m_ea, B); } /* SET 0,B=(XY+o) */
+OP(xycb,c1) { C = set(0, rm_reg(m_ea)); wm(m_ea, C); } /* SET 0,C=(XY+o) */
+OP(xycb,c2) { D = set(0, rm_reg(m_ea)); wm(m_ea, D); } /* SET 0,D=(XY+o) */
+OP(xycb,c3) { E = set(0, rm_reg(m_ea)); wm(m_ea, E); } /* SET 0,E=(XY+o) */
+OP(xycb,c4) { H = set(0, rm_reg(m_ea)); wm(m_ea, H); } /* SET 0,H=(XY+o) */
+OP(xycb,c5) { L = set(0, rm_reg(m_ea)); wm(m_ea, L); } /* SET 0,L=(XY+o) */
+OP(xycb,c6) { wm(m_ea, set(0, rm_reg(m_ea))); } /* SET 0,(XY+o) */
+OP(xycb,c7) { A = set(0, rm_reg(m_ea)); wm(m_ea, A); } /* SET 0,A=(XY+o) */
+
+OP(xycb,c8) { B = set(1, rm_reg(m_ea)); wm(m_ea, B); } /* SET 1,B=(XY+o) */
+OP(xycb,c9) { C = set(1, rm_reg(m_ea)); wm(m_ea, C); } /* SET 1,C=(XY+o) */
+OP(xycb,ca) { D = set(1, rm_reg(m_ea)); wm(m_ea, D); } /* SET 1,D=(XY+o) */
+OP(xycb,cb) { E = set(1, rm_reg(m_ea)); wm(m_ea, E); } /* SET 1,E=(XY+o) */
+OP(xycb,cc) { H = set(1, rm_reg(m_ea)); wm(m_ea, H); } /* SET 1,H=(XY+o) */
+OP(xycb,cd) { L = set(1, rm_reg(m_ea)); wm(m_ea, L); } /* SET 1,L=(XY+o) */
+OP(xycb,ce) { wm(m_ea, set(1, rm_reg(m_ea))); } /* SET 1,(XY+o) */
+OP(xycb,cf) { A = set(1, rm_reg(m_ea)); wm(m_ea, A); } /* SET 1,A=(XY+o) */
+
+OP(xycb,d0) { B = set(2, rm_reg(m_ea)); wm(m_ea, B); } /* SET 2,B=(XY+o) */
+OP(xycb,d1) { C = set(2, rm_reg(m_ea)); wm(m_ea, C); } /* SET 2,C=(XY+o) */
+OP(xycb,d2) { D = set(2, rm_reg(m_ea)); wm(m_ea, D); } /* SET 2,D=(XY+o) */
+OP(xycb,d3) { E = set(2, rm_reg(m_ea)); wm(m_ea, E); } /* SET 2,E=(XY+o) */
+OP(xycb,d4) { H = set(2, rm_reg(m_ea)); wm(m_ea, H); } /* SET 2,H=(XY+o) */
+OP(xycb,d5) { L = set(2, rm_reg(m_ea)); wm(m_ea, L); } /* SET 2,L=(XY+o) */
+OP(xycb,d6) { wm(m_ea, set(2, rm_reg(m_ea))); } /* SET 2,(XY+o) */
+OP(xycb,d7) { A = set(2, rm_reg(m_ea)); wm(m_ea, A); } /* SET 2,A=(XY+o) */
+
+OP(xycb,d8) { B = set(3, rm_reg(m_ea)); wm(m_ea, B); } /* SET 3,B=(XY+o) */
+OP(xycb,d9) { C = set(3, rm_reg(m_ea)); wm(m_ea, C); } /* SET 3,C=(XY+o) */
+OP(xycb,da) { D = set(3, rm_reg(m_ea)); wm(m_ea, D); } /* SET 3,D=(XY+o) */
+OP(xycb,db) { E = set(3, rm_reg(m_ea)); wm(m_ea, E); } /* SET 3,E=(XY+o) */
+OP(xycb,dc) { H = set(3, rm_reg(m_ea)); wm(m_ea, H); } /* SET 3,H=(XY+o) */
+OP(xycb,dd) { L = set(3, rm_reg(m_ea)); wm(m_ea, L); } /* SET 3,L=(XY+o) */
+OP(xycb,de) { wm(m_ea, set(3, rm_reg(m_ea))); } /* SET 3,(XY+o) */
+OP(xycb,df) { A = set(3, rm_reg(m_ea)); wm(m_ea, A); } /* SET 3,A=(XY+o) */
+
+OP(xycb,e0) { B = set(4, rm_reg(m_ea)); wm(m_ea, B); } /* SET 4,B=(XY+o) */
+OP(xycb,e1) { C = set(4, rm_reg(m_ea)); wm(m_ea, C); } /* SET 4,C=(XY+o) */
+OP(xycb,e2) { D = set(4, rm_reg(m_ea)); wm(m_ea, D); } /* SET 4,D=(XY+o) */
+OP(xycb,e3) { E = set(4, rm_reg(m_ea)); wm(m_ea, E); } /* SET 4,E=(XY+o) */
+OP(xycb,e4) { H = set(4, rm_reg(m_ea)); wm(m_ea, H); } /* SET 4,H=(XY+o) */
+OP(xycb,e5) { L = set(4, rm_reg(m_ea)); wm(m_ea, L); } /* SET 4,L=(XY+o) */
+OP(xycb,e6) { wm(m_ea, set(4, rm_reg(m_ea))); } /* SET 4,(XY+o) */
+OP(xycb,e7) { A = set(4, rm_reg(m_ea)); wm(m_ea, A); } /* SET 4,A=(XY+o) */
+
+OP(xycb,e8) { B = set(5, rm_reg(m_ea)); wm(m_ea, B); } /* SET 5,B=(XY+o) */
+OP(xycb,e9) { C = set(5, rm_reg(m_ea)); wm(m_ea, C); } /* SET 5,C=(XY+o) */
+OP(xycb,ea) { D = set(5, rm_reg(m_ea)); wm(m_ea, D); } /* SET 5,D=(XY+o) */
+OP(xycb,eb) { E = set(5, rm_reg(m_ea)); wm(m_ea, E); } /* SET 5,E=(XY+o) */
+OP(xycb,ec) { H = set(5, rm_reg(m_ea)); wm(m_ea, H); } /* SET 5,H=(XY+o) */
+OP(xycb,ed) { L = set(5, rm_reg(m_ea)); wm(m_ea, L); } /* SET 5,L=(XY+o) */
+OP(xycb,ee) { wm(m_ea, set(5, rm_reg(m_ea))); } /* SET 5,(XY+o) */
+OP(xycb,ef) { A = set(5, rm_reg(m_ea)); wm(m_ea, A); } /* SET 5,A=(XY+o) */
+
+OP(xycb,f0) { B = set(6, rm_reg(m_ea)); wm(m_ea, B); } /* SET 6,B=(XY+o) */
+OP(xycb,f1) { C = set(6, rm_reg(m_ea)); wm(m_ea, C); } /* SET 6,C=(XY+o) */
+OP(xycb,f2) { D = set(6, rm_reg(m_ea)); wm(m_ea, D); } /* SET 6,D=(XY+o) */
+OP(xycb,f3) { E = set(6, rm_reg(m_ea)); wm(m_ea, E); } /* SET 6,E=(XY+o) */
+OP(xycb,f4) { H = set(6, rm_reg(m_ea)); wm(m_ea, H); } /* SET 6,H=(XY+o) */
+OP(xycb,f5) { L = set(6, rm_reg(m_ea)); wm(m_ea, L); } /* SET 6,L=(XY+o) */
+OP(xycb,f6) { wm(m_ea, set(6, rm_reg(m_ea))); } /* SET 6,(XY+o) */
+OP(xycb,f7) { A = set(6, rm_reg(m_ea)); wm(m_ea, A); } /* SET 6,A=(XY+o) */
+
+OP(xycb,f8) { B = set(7, rm_reg(m_ea)); wm(m_ea, B); } /* SET 7,B=(XY+o) */
+OP(xycb,f9) { C = set(7, rm_reg(m_ea)); wm(m_ea, C); } /* SET 7,C=(XY+o) */
+OP(xycb,fa) { D = set(7, rm_reg(m_ea)); wm(m_ea, D); } /* SET 7,D=(XY+o) */
+OP(xycb,fb) { E = set(7, rm_reg(m_ea)); wm(m_ea, E); } /* SET 7,E=(XY+o) */
+OP(xycb,fc) { H = set(7, rm_reg(m_ea)); wm(m_ea, H); } /* SET 7,H=(XY+o) */
+OP(xycb,fd) { L = set(7, rm_reg(m_ea)); wm(m_ea, L); } /* SET 7,L=(XY+o) */
+OP(xycb,fe) { wm(m_ea, set(7, rm_reg(m_ea))); } /* SET 7,(XY+o) */
+OP(xycb,ff) { A = set(7, rm_reg(m_ea)); wm(m_ea, A); } /* SET 7,A=(XY+o) */
OP(illegal,1) {
logerror("Z80 ill. opcode $%02x $%02x ($%04x)\n",
@@ -1998,7 +2095,7 @@ OP(dd,1f) { illegal_1(); op_1f(); } /* DB DD
OP(dd,20) { illegal_1(); op_20(); } /* DB DD */
OP(dd,21) { IX = arg16(); } /* LD IX,w */
OP(dd,22) { m_ea = arg16(); wm16(m_ea, m_ix); WZ = m_ea + 1; } /* LD (w),IX */
-OP(dd,23) { IX++; } /* INC IX */
+OP(dd,23) { nomreq_ir(2); IX++; } /* INC IX */
OP(dd,24) { HX = inc(HX); } /* INC HX */
OP(dd,25) { HX = dec(HX); } /* DEC HX */
OP(dd,26) { HX = arg(); } /* LD HX,n */
@@ -2007,7 +2104,7 @@ OP(dd,27) { illegal_1(); op_27(); } /* DB DD
OP(dd,28) { illegal_1(); op_28(); } /* DB DD */
OP(dd,29) { add16(m_ix, m_ix); } /* ADD IX,IX */
OP(dd,2a) { m_ea = arg16(); rm16(m_ea, m_ix); WZ = m_ea + 1; } /* LD IX,(w) */
-OP(dd,2b) { IX--; } /* DEC IX */
+OP(dd,2b) { nomreq_ir(2); IX--; } /* DEC IX */
OP(dd,2c) { LX = inc(LX); } /* INC LX */
OP(dd,2d) { LX = dec(LX); } /* DEC LX */
OP(dd,2e) { LX = arg(); } /* LD LX,n */
@@ -2017,9 +2114,9 @@ OP(dd,30) { illegal_1(); op_30(); } /* DB DD
OP(dd,31) { illegal_1(); op_31(); } /* DB DD */
OP(dd,32) { illegal_1(); op_32(); } /* DB DD */
OP(dd,33) { illegal_1(); op_33(); } /* DB DD */
-OP(dd,34) { eax(); wm(m_ea, inc(rm(m_ea))); } /* INC (IX+o) */
-OP(dd,35) { eax(); wm(m_ea, dec(rm(m_ea))); } /* DEC (IX+o) */
-OP(dd,36) { eax(); wm(m_ea, arg()); } /* LD (IX+o),n */
+OP(dd,34) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, inc(rm_reg(m_ea))); } /* INC (IX+o) */
+OP(dd,35) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, dec(rm_reg(m_ea))); } /* DEC (IX+o) */
+OP(dd,36) { eax(); u8 a = arg(); nomreq_addr(PCD-1, 2); wm(m_ea, a); } /* LD (IX+o),n */
OP(dd,37) { illegal_1(); op_37(); } /* DB DD */
OP(dd,38) { illegal_1(); op_38(); } /* DB DD */
@@ -2037,7 +2134,7 @@ OP(dd,42) { illegal_1(); op_42(); } /* DB DD
OP(dd,43) { illegal_1(); op_43(); } /* DB DD */
OP(dd,44) { B = HX; } /* LD B,HX */
OP(dd,45) { B = LX; } /* LD B,LX */
-OP(dd,46) { eax(); B = rm(m_ea); } /* LD B,(IX+o) */
+OP(dd,46) { eax(); nomreq_addr(PCD-1, 5); B = rm(m_ea); } /* LD B,(IX+o) */
OP(dd,47) { illegal_1(); op_47(); } /* DB DD */
OP(dd,48) { illegal_1(); op_48(); } /* DB DD */
@@ -2046,7 +2143,7 @@ OP(dd,4a) { illegal_1(); op_4a(); } /* DB DD
OP(dd,4b) { illegal_1(); op_4b(); } /* DB DD */
OP(dd,4c) { C = HX; } /* LD C,HX */
OP(dd,4d) { C = LX; } /* LD C,LX */
-OP(dd,4e) { eax(); C = rm(m_ea); } /* LD C,(IX+o) */
+OP(dd,4e) { eax(); nomreq_addr(PCD-1, 5); C = rm(m_ea); } /* LD C,(IX+o) */
OP(dd,4f) { illegal_1(); op_4f(); } /* DB DD */
OP(dd,50) { illegal_1(); op_50(); } /* DB DD */
@@ -2055,7 +2152,7 @@ OP(dd,52) { illegal_1(); op_52(); } /* DB DD
OP(dd,53) { illegal_1(); op_53(); } /* DB DD */
OP(dd,54) { D = HX; } /* LD D,HX */
OP(dd,55) { D = LX; } /* LD D,LX */
-OP(dd,56) { eax(); D = rm(m_ea); } /* LD D,(IX+o) */
+OP(dd,56) { eax(); nomreq_addr(PCD-1, 5); D = rm(m_ea); } /* LD D,(IX+o) */
OP(dd,57) { illegal_1(); op_57(); } /* DB DD */
OP(dd,58) { illegal_1(); op_58(); } /* DB DD */
@@ -2064,7 +2161,7 @@ OP(dd,5a) { illegal_1(); op_5a(); } /* DB DD
OP(dd,5b) { illegal_1(); op_5b(); } /* DB DD */
OP(dd,5c) { E = HX; } /* LD E,HX */
OP(dd,5d) { E = LX; } /* LD E,LX */
-OP(dd,5e) { eax(); E = rm(m_ea); } /* LD E,(IX+o) */
+OP(dd,5e) { eax(); nomreq_addr(PCD-1, 5); E = rm(m_ea); } /* LD E,(IX+o) */
OP(dd,5f) { illegal_1(); op_5f(); } /* DB DD */
OP(dd,60) { HX = B; } /* LD HX,B */
@@ -2073,7 +2170,7 @@ OP(dd,62) { HX = D; } /* LD HX,D
OP(dd,63) { HX = E; } /* LD HX,E */
OP(dd,64) { } /* LD HX,HX */
OP(dd,65) { HX = LX; } /* LD HX,LX */
-OP(dd,66) { eax(); H = rm(m_ea); } /* LD H,(IX+o) */
+OP(dd,66) { eax(); nomreq_addr(PCD-1, 5); H = rm(m_ea); } /* LD H,(IX+o) */
OP(dd,67) { HX = A; } /* LD HX,A */
OP(dd,68) { LX = B; } /* LD LX,B */
@@ -2082,17 +2179,17 @@ OP(dd,6a) { LX = D; } /* LD LX,D
OP(dd,6b) { LX = E; } /* LD LX,E */
OP(dd,6c) { LX = HX; } /* LD LX,HX */
OP(dd,6d) { } /* LD LX,LX */
-OP(dd,6e) { eax(); L = rm(m_ea); } /* LD L,(IX+o) */
+OP(dd,6e) { eax(); nomreq_addr(PCD-1, 5); L = rm(m_ea); } /* LD L,(IX+o) */
OP(dd,6f) { LX = A; } /* LD LX,A */
-OP(dd,70) { eax(); wm(m_ea, B); } /* LD (IX+o),B */
-OP(dd,71) { eax(); wm(m_ea, C); } /* LD (IX+o),C */
-OP(dd,72) { eax(); wm(m_ea, D); } /* LD (IX+o),D */
-OP(dd,73) { eax(); wm(m_ea, E); } /* LD (IX+o),E */
-OP(dd,74) { eax(); wm(m_ea, H); } /* LD (IX+o),H */
-OP(dd,75) { eax(); wm(m_ea, L); } /* LD (IX+o),L */
+OP(dd,70) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, B); } /* LD (IX+o),B */
+OP(dd,71) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, C); } /* LD (IX+o),C */
+OP(dd,72) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, D); } /* LD (IX+o),D */
+OP(dd,73) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, E); } /* LD (IX+o),E */
+OP(dd,74) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, H); } /* LD (IX+o),H */
+OP(dd,75) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, L); } /* LD (IX+o),L */
OP(dd,76) { illegal_1(); op_76(); } /* DB DD */
-OP(dd,77) { eax(); wm(m_ea, A); } /* LD (IX+o),A */
+OP(dd,77) { eax(); nomreq_addr(PCD-1, 5); wm(m_ea, A); } /* LD (IX+o),A */
OP(dd,78) { illegal_1(); op_78(); } /* DB DD */
OP(dd,79) { illegal_1(); op_79(); } /* DB DD */
@@ -2100,7 +2197,7 @@ OP(dd,7a) { illegal_1(); op_7a(); } /* DB DD
OP(dd,7b) { illegal_1(); op_7b(); } /* DB DD */
OP(dd,7c) { A = HX; } /* LD A,HX */
OP(dd,7d) { A = LX; } /* LD A,LX */
-OP(dd,7e) { eax(); A = rm(m_ea); } /* LD A,(IX+o) */
+OP(dd,7e) { eax(); nomreq_addr(PCD-1, 5); A = rm(m_ea); } /* LD A,(IX+o) */
OP(dd,7f) { illegal_1(); op_7f(); } /* DB DD */
OP(dd,80) { illegal_1(); op_80(); } /* DB DD */
@@ -2109,7 +2206,7 @@ OP(dd,82) { illegal_1(); op_82(); } /* DB DD
OP(dd,83) { illegal_1(); op_83(); } /* DB DD */
OP(dd,84) { add_a(HX); } /* ADD A,HX */
OP(dd,85) { add_a(LX); } /* ADD A,LX */
-OP(dd,86) { eax(); add_a(rm(m_ea)); } /* ADD A,(IX+o) */
+OP(dd,86) { eax(); nomreq_addr(PCD-1, 5); add_a(rm(m_ea)); } /* ADD A,(IX+o) */
OP(dd,87) { illegal_1(); op_87(); } /* DB DD */
OP(dd,88) { illegal_1(); op_88(); } /* DB DD */
@@ -2118,7 +2215,7 @@ OP(dd,8a) { illegal_1(); op_8a(); } /* DB DD
OP(dd,8b) { illegal_1(); op_8b(); } /* DB DD */
OP(dd,8c) { adc_a(HX); } /* ADC A,HX */
OP(dd,8d) { adc_a(LX); } /* ADC A,LX */
-OP(dd,8e) { eax(); adc_a(rm(m_ea)); } /* ADC A,(IX+o) */
+OP(dd,8e) { eax(); nomreq_addr(PCD-1, 5); adc_a(rm(m_ea)); } /* ADC A,(IX+o) */
OP(dd,8f) { illegal_1(); op_8f(); } /* DB DD */
OP(dd,90) { illegal_1(); op_90(); } /* DB DD */
@@ -2127,7 +2224,7 @@ OP(dd,92) { illegal_1(); op_92(); } /* DB DD
OP(dd,93) { illegal_1(); op_93(); } /* DB DD */
OP(dd,94) { sub(HX); } /* SUB HX */
OP(dd,95) { sub(LX); } /* SUB LX */
-OP(dd,96) { eax(); sub(rm(m_ea)); } /* SUB (IX+o) */
+OP(dd,96) { eax(); nomreq_addr(PCD-1, 5); sub(rm(m_ea)); } /* SUB (IX+o) */
OP(dd,97) { illegal_1(); op_97(); } /* DB DD */
OP(dd,98) { illegal_1(); op_98(); } /* DB DD */
@@ -2136,7 +2233,7 @@ OP(dd,9a) { illegal_1(); op_9a(); } /* DB DD
OP(dd,9b) { illegal_1(); op_9b(); } /* DB DD */
OP(dd,9c) { sbc_a(HX); } /* SBC A,HX */
OP(dd,9d) { sbc_a(LX); } /* SBC A,LX */
-OP(dd,9e) { eax(); sbc_a(rm(m_ea)); } /* SBC A,(IX+o) */
+OP(dd,9e) { eax(); nomreq_addr(PCD-1, 5); sbc_a(rm(m_ea)); } /* SBC A,(IX+o) */
OP(dd,9f) { illegal_1(); op_9f(); } /* DB DD */
OP(dd,a0) { illegal_1(); op_a0(); } /* DB DD */
@@ -2145,7 +2242,7 @@ OP(dd,a2) { illegal_1(); op_a2(); } /* DB DD
OP(dd,a3) { illegal_1(); op_a3(); } /* DB DD */
OP(dd,a4) { and_a(HX); } /* AND HX */
OP(dd,a5) { and_a(LX); } /* AND LX */
-OP(dd,a6) { eax(); and_a(rm(m_ea)); } /* AND (IX+o) */
+OP(dd,a6) { eax(); nomreq_addr(PCD-1, 5); and_a(rm(m_ea)); } /* AND (IX+o) */
OP(dd,a7) { illegal_1(); op_a7(); } /* DB DD */
OP(dd,a8) { illegal_1(); op_a8(); } /* DB DD */
@@ -2154,7 +2251,7 @@ OP(dd,aa) { illegal_1(); op_aa(); } /* DB DD
OP(dd,ab) { illegal_1(); op_ab(); } /* DB DD */
OP(dd,ac) { xor_a(HX); } /* XOR HX */
OP(dd,ad) { xor_a(LX); } /* XOR LX */
-OP(dd,ae) { eax(); xor_a(rm(m_ea)); } /* XOR (IX+o) */
+OP(dd,ae) { eax(); nomreq_addr(PCD-1, 5); xor_a(rm(m_ea)); } /* XOR (IX+o) */
OP(dd,af) { illegal_1(); op_af(); } /* DB DD */
OP(dd,b0) { illegal_1(); op_b0(); } /* DB DD */
@@ -2163,7 +2260,7 @@ OP(dd,b2) { illegal_1(); op_b2(); } /* DB DD
OP(dd,b3) { illegal_1(); op_b3(); } /* DB DD */
OP(dd,b4) { or_a(HX); } /* OR HX */
OP(dd,b5) { or_a(LX); } /* OR LX */
-OP(dd,b6) { eax(); or_a(rm(m_ea)); } /* OR (IX+o) */
+OP(dd,b6) { eax(); nomreq_addr(PCD-1, 5); or_a(rm(m_ea)); } /* OR (IX+o) */
OP(dd,b7) { illegal_1(); op_b7(); } /* DB DD */
OP(dd,b8) { illegal_1(); op_b8(); } /* DB DD */
@@ -2172,7 +2269,7 @@ OP(dd,ba) { illegal_1(); op_ba(); } /* DB DD
OP(dd,bb) { illegal_1(); op_bb(); } /* DB DD */
OP(dd,bc) { cp(HX); } /* CP HX */
OP(dd,bd) { cp(LX); } /* CP LX */
-OP(dd,be) { eax(); cp(rm(m_ea)); } /* CP (IX+o) */
+OP(dd,be) { eax(); nomreq_addr(PCD-1, 5); cp(rm(m_ea)); } /* CP (IX+o) */
OP(dd,bf) { illegal_1(); op_bf(); } /* DB DD */
OP(dd,c0) { illegal_1(); op_c0(); } /* DB DD */
@@ -2187,7 +2284,7 @@ OP(dd,c7) { illegal_1(); op_c7(); } /* DB DD
OP(dd,c8) { illegal_1(); op_c8(); } /* DB DD */
OP(dd,c9) { illegal_1(); op_c9(); } /* DB DD */
OP(dd,ca) { illegal_1(); op_ca(); } /* DB DD */
-OP(dd,cb) { eax(); EXEC(xycb,arg()); } /* ** DD CB xx */
+OP(dd,cb) { eax(); u8 a = arg(); nomreq_addr(PCD-1, 2); EXEC(xycb, a); } /* ** DD CB xx */
OP(dd,cc) { illegal_1(); op_cc(); } /* DB DD */
OP(dd,cd) { illegal_1(); op_cd(); } /* DB DD */
OP(dd,ce) { illegal_1(); op_ce(); } /* DB DD */
@@ -2239,7 +2336,7 @@ OP(dd,f6) { illegal_1(); op_f6(); } /* DB DD
OP(dd,f7) { illegal_1(); op_f7(); } /* DB DD */
OP(dd,f8) { illegal_1(); op_f8(); } /* DB DD */
-OP(dd,f9) { SP = IX; } /* LD SP,IX */
+OP(dd,f9) { nomreq_ir(2); SP = IX; } /* LD SP,IX */
OP(dd,fa) { illegal_1(); op_fa(); } /* DB DD */
OP(dd,fb) { illegal_1(); op_fb(); } /* DB DD */
OP(dd,fc) { illegal_1(); op_fc(); } /* DB DD */
@@ -2289,7 +2386,7 @@ OP(fd,1f) { illegal_1(); op_1f(); } /* DB FD
OP(fd,20) { illegal_1(); op_20(); } /* DB FD */
OP(fd,21) { IY = arg16(); } /* LD IY,w */
OP(fd,22) { m_ea = arg16(); wm16(m_ea, m_iy); WZ = m_ea + 1; } /* LD (w),IY */
-OP(fd,23) { IY++; } /* INC IY */
+OP(fd,23) { nomreq_ir(2); IY++; } /* INC IY */
OP(fd,24) { HY = inc(HY); } /* INC HY */
OP(fd,25) { HY = dec(HY); } /* DEC HY */
OP(fd,26) { HY = arg(); } /* LD HY,n */
@@ -2298,7 +2395,7 @@ OP(fd,27) { illegal_1(); op_27(); } /* DB FD
OP(fd,28) { illegal_1(); op_28(); } /* DB FD */
OP(fd,29) { add16(m_iy, m_iy); } /* ADD IY,IY */
OP(fd,2a) { m_ea = arg16(); rm16(m_ea, m_iy); WZ = m_ea + 1; } /* LD IY,(w) */
-OP(fd,2b) { IY--; } /* DEC IY */
+OP(fd,2b) { nomreq_ir(2); IY--; } /* DEC IY */
OP(fd,2c) { LY = inc(LY); } /* INC LY */
OP(fd,2d) { LY = dec(LY); } /* DEC LY */
OP(fd,2e) { LY = arg(); } /* LD LY,n */
@@ -2308,9 +2405,9 @@ OP(fd,30) { illegal_1(); op_30(); } /* DB FD
OP(fd,31) { illegal_1(); op_31(); } /* DB FD */
OP(fd,32) { illegal_1(); op_32(); } /* DB FD */
OP(fd,33) { illegal_1(); op_33(); } /* DB FD */
-OP(fd,34) { eay(); wm(m_ea, inc(rm(m_ea))); } /* INC (IY+o) */
-OP(fd,35) { eay(); wm(m_ea, dec(rm(m_ea))); } /* DEC (IY+o) */
-OP(fd,36) { eay(); wm(m_ea, arg()); } /* LD (IY+o),n */
+OP(fd,34) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, inc(rm_reg(m_ea))); } /* INC (IY+o) */
+OP(fd,35) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, dec(rm_reg(m_ea))); } /* DEC (IY+o) */
+OP(fd,36) { eay(); u8 a = arg(); nomreq_addr(PCD-1, 2); wm(m_ea, a); } /* LD (IY+o),n */
OP(fd,37) { illegal_1(); op_37(); } /* DB FD */
OP(fd,38) { illegal_1(); op_38(); } /* DB FD */
@@ -2328,7 +2425,7 @@ OP(fd,42) { illegal_1(); op_42(); } /* DB FD
OP(fd,43) { illegal_1(); op_43(); } /* DB FD */
OP(fd,44) { B = HY; } /* LD B,HY */
OP(fd,45) { B = LY; } /* LD B,LY */
-OP(fd,46) { eay(); B = rm(m_ea); } /* LD B,(IY+o) */
+OP(fd,46) { eay(); nomreq_addr(PCD-1, 5); B = rm(m_ea); } /* LD B,(IY+o) */
OP(fd,47) { illegal_1(); op_47(); } /* DB FD */
OP(fd,48) { illegal_1(); op_48(); } /* DB FD */
@@ -2337,7 +2434,7 @@ OP(fd,4a) { illegal_1(); op_4a(); } /* DB FD
OP(fd,4b) { illegal_1(); op_4b(); } /* DB FD */
OP(fd,4c) { C = HY; } /* LD C,HY */
OP(fd,4d) { C = LY; } /* LD C,LY */
-OP(fd,4e) { eay(); C = rm(m_ea); } /* LD C,(IY+o) */
+OP(fd,4e) { eay(); nomreq_addr(PCD-1, 5); C = rm(m_ea); } /* LD C,(IY+o) */
OP(fd,4f) { illegal_1(); op_4f(); } /* DB FD */
OP(fd,50) { illegal_1(); op_50(); } /* DB FD */
@@ -2346,7 +2443,7 @@ OP(fd,52) { illegal_1(); op_52(); } /* DB FD
OP(fd,53) { illegal_1(); op_53(); } /* DB FD */
OP(fd,54) { D = HY; } /* LD D,HY */
OP(fd,55) { D = LY; } /* LD D,LY */
-OP(fd,56) { eay(); D = rm(m_ea); } /* LD D,(IY+o) */
+OP(fd,56) { eay(); nomreq_addr(PCD-1, 5); D = rm(m_ea); } /* LD D,(IY+o) */
OP(fd,57) { illegal_1(); op_57(); } /* DB FD */
OP(fd,58) { illegal_1(); op_58(); } /* DB FD */
@@ -2355,7 +2452,7 @@ OP(fd,5a) { illegal_1(); op_5a(); } /* DB FD
OP(fd,5b) { illegal_1(); op_5b(); } /* DB FD */
OP(fd,5c) { E = HY; } /* LD E,HY */
OP(fd,5d) { E = LY; } /* LD E,LY */
-OP(fd,5e) { eay(); E = rm(m_ea); } /* LD E,(IY+o) */
+OP(fd,5e) { eay(); nomreq_addr(PCD-1, 5); E = rm(m_ea); } /* LD E,(IY+o) */
OP(fd,5f) { illegal_1(); op_5f(); } /* DB FD */
OP(fd,60) { HY = B; } /* LD HY,B */
@@ -2364,7 +2461,7 @@ OP(fd,62) { HY = D; } /* LD HY,D
OP(fd,63) { HY = E; } /* LD HY,E */
OP(fd,64) { } /* LD HY,HY */
OP(fd,65) { HY = LY; } /* LD HY,LY */
-OP(fd,66) { eay(); H = rm(m_ea); } /* LD H,(IY+o) */
+OP(fd,66) { eay(); nomreq_addr(PCD-1, 5); H = rm(m_ea); } /* LD H,(IY+o) */
OP(fd,67) { HY = A; } /* LD HY,A */
OP(fd,68) { LY = B; } /* LD LY,B */
@@ -2373,17 +2470,17 @@ OP(fd,6a) { LY = D; } /* LD LY,D
OP(fd,6b) { LY = E; } /* LD LY,E */
OP(fd,6c) { LY = HY; } /* LD LY,HY */
OP(fd,6d) { } /* LD LY,LY */
-OP(fd,6e) { eay(); L = rm(m_ea); } /* LD L,(IY+o) */
+OP(fd,6e) { eay(); nomreq_addr(PCD-1, 5); L = rm(m_ea); } /* LD L,(IY+o) */
OP(fd,6f) { LY = A; } /* LD LY,A */
-OP(fd,70) { eay(); wm(m_ea, B); } /* LD (IY+o),B */
-OP(fd,71) { eay(); wm(m_ea, C); } /* LD (IY+o),C */
-OP(fd,72) { eay(); wm(m_ea, D); } /* LD (IY+o),D */
-OP(fd,73) { eay(); wm(m_ea, E); } /* LD (IY+o),E */
-OP(fd,74) { eay(); wm(m_ea, H); } /* LD (IY+o),H */
-OP(fd,75) { eay(); wm(m_ea, L); } /* LD (IY+o),L */
+OP(fd,70) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, B); } /* LD (IY+o),B */
+OP(fd,71) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, C); } /* LD (IY+o),C */
+OP(fd,72) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, D); } /* LD (IY+o),D */
+OP(fd,73) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, E); } /* LD (IY+o),E */
+OP(fd,74) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, H); } /* LD (IY+o),H */
+OP(fd,75) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, L); } /* LD (IY+o),L */
OP(fd,76) { illegal_1(); op_76(); } /* DB FD */
-OP(fd,77) { eay(); wm(m_ea, A); } /* LD (IY+o),A */
+OP(fd,77) { eay(); nomreq_addr(PCD-1, 5); wm(m_ea, A); } /* LD (IY+o),A */
OP(fd,78) { illegal_1(); op_78(); } /* DB FD */
OP(fd,79) { illegal_1(); op_79(); } /* DB FD */
@@ -2391,7 +2488,7 @@ OP(fd,7a) { illegal_1(); op_7a(); } /* DB FD
OP(fd,7b) { illegal_1(); op_7b(); } /* DB FD */
OP(fd,7c) { A = HY; } /* LD A,HY */
OP(fd,7d) { A = LY; } /* LD A,LY */
-OP(fd,7e) { eay(); A = rm(m_ea); } /* LD A,(IY+o) */
+OP(fd,7e) { eay(); nomreq_addr(PCD-1, 5); A = rm(m_ea); } /* LD A,(IY+o) */
OP(fd,7f) { illegal_1(); op_7f(); } /* DB FD */
OP(fd,80) { illegal_1(); op_80(); } /* DB FD */
@@ -2400,7 +2497,7 @@ OP(fd,82) { illegal_1(); op_82(); } /* DB FD
OP(fd,83) { illegal_1(); op_83(); } /* DB FD */
OP(fd,84) { add_a(HY); } /* ADD A,HY */
OP(fd,85) { add_a(LY); } /* ADD A,LY */
-OP(fd,86) { eay(); add_a(rm(m_ea)); } /* ADD A,(IY+o) */
+OP(fd,86) { eay(); nomreq_addr(PCD-1, 5); add_a(rm(m_ea)); } /* ADD A,(IY+o) */
OP(fd,87) { illegal_1(); op_87(); } /* DB FD */
OP(fd,88) { illegal_1(); op_88(); } /* DB FD */
@@ -2409,7 +2506,7 @@ OP(fd,8a) { illegal_1(); op_8a(); } /* DB FD
OP(fd,8b) { illegal_1(); op_8b(); } /* DB FD */
OP(fd,8c) { adc_a(HY); } /* ADC A,HY */
OP(fd,8d) { adc_a(LY); } /* ADC A,LY */
-OP(fd,8e) { eay(); adc_a(rm(m_ea)); } /* ADC A,(IY+o) */
+OP(fd,8e) { eay(); nomreq_addr(PCD-1, 5); adc_a(rm(m_ea)); } /* ADC A,(IY+o) */
OP(fd,8f) { illegal_1(); op_8f(); } /* DB FD */
OP(fd,90) { illegal_1(); op_90(); } /* DB FD */
@@ -2418,7 +2515,7 @@ OP(fd,92) { illegal_1(); op_92(); } /* DB FD
OP(fd,93) { illegal_1(); op_93(); } /* DB FD */
OP(fd,94) { sub(HY); } /* SUB HY */
OP(fd,95) { sub(LY); } /* SUB LY */
-OP(fd,96) { eay(); sub(rm(m_ea)); } /* SUB (IY+o) */
+OP(fd,96) { eay(); nomreq_addr(PCD-1, 5); sub(rm(m_ea)); } /* SUB (IY+o) */
OP(fd,97) { illegal_1(); op_97(); } /* DB FD */
OP(fd,98) { illegal_1(); op_98(); } /* DB FD */
@@ -2427,7 +2524,7 @@ OP(fd,9a) { illegal_1(); op_9a(); } /* DB FD
OP(fd,9b) { illegal_1(); op_9b(); } /* DB FD */
OP(fd,9c) { sbc_a(HY); } /* SBC A,HY */
OP(fd,9d) { sbc_a(LY); } /* SBC A,LY */
-OP(fd,9e) { eay(); sbc_a(rm(m_ea)); } /* SBC A,(IY+o) */
+OP(fd,9e) { eay(); nomreq_addr(PCD-1, 5); sbc_a(rm(m_ea)); } /* SBC A,(IY+o) */
OP(fd,9f) { illegal_1(); op_9f(); } /* DB FD */
OP(fd,a0) { illegal_1(); op_a0(); } /* DB FD */
@@ -2436,7 +2533,7 @@ OP(fd,a2) { illegal_1(); op_a2(); } /* DB FD
OP(fd,a3) { illegal_1(); op_a3(); } /* DB FD */
OP(fd,a4) { and_a(HY); } /* AND HY */
OP(fd,a5) { and_a(LY); } /* AND LY */
-OP(fd,a6) { eay(); and_a(rm(m_ea)); } /* AND (IY+o) */
+OP(fd,a6) { eay(); nomreq_addr(PCD-1, 5); and_a(rm(m_ea)); } /* AND (IY+o) */
OP(fd,a7) { illegal_1(); op_a7(); } /* DB FD */
OP(fd,a8) { illegal_1(); op_a8(); } /* DB FD */
@@ -2445,7 +2542,7 @@ OP(fd,aa) { illegal_1(); op_aa(); } /* DB FD
OP(fd,ab) { illegal_1(); op_ab(); } /* DB FD */
OP(fd,ac) { xor_a(HY); } /* XOR HY */
OP(fd,ad) { xor_a(LY); } /* XOR LY */
-OP(fd,ae) { eay(); xor_a(rm(m_ea)); } /* XOR (IY+o) */
+OP(fd,ae) { eay(); nomreq_addr(PCD-1, 5); xor_a(rm(m_ea)); } /* XOR (IY+o) */
OP(fd,af) { illegal_1(); op_af(); } /* DB FD */
OP(fd,b0) { illegal_1(); op_b0(); } /* DB FD */
@@ -2454,7 +2551,7 @@ OP(fd,b2) { illegal_1(); op_b2(); } /* DB FD
OP(fd,b3) { illegal_1(); op_b3(); } /* DB FD */
OP(fd,b4) { or_a(HY); } /* OR HY */
OP(fd,b5) { or_a(LY); } /* OR LY */
-OP(fd,b6) { eay(); or_a(rm(m_ea)); } /* OR (IY+o) */
+OP(fd,b6) { eay(); nomreq_addr(PCD-1, 5); or_a(rm(m_ea)); } /* OR (IY+o) */
OP(fd,b7) { illegal_1(); op_b7(); } /* DB FD */
OP(fd,b8) { illegal_1(); op_b8(); } /* DB FD */
@@ -2463,7 +2560,7 @@ OP(fd,ba) { illegal_1(); op_ba(); } /* DB FD
OP(fd,bb) { illegal_1(); op_bb(); } /* DB FD */
OP(fd,bc) { cp(HY); } /* CP HY */
OP(fd,bd) { cp(LY); } /* CP LY */
-OP(fd,be) { eay(); cp(rm(m_ea)); } /* CP (IY+o) */
+OP(fd,be) { eay(); nomreq_addr(PCD-1, 5); cp(rm(m_ea)); } /* CP (IY+o) */
OP(fd,bf) { illegal_1(); op_bf(); } /* DB FD */
OP(fd,c0) { illegal_1(); op_c0(); } /* DB FD */
@@ -2478,7 +2575,7 @@ OP(fd,c7) { illegal_1(); op_c7(); } /* DB FD
OP(fd,c8) { illegal_1(); op_c8(); } /* DB FD */
OP(fd,c9) { illegal_1(); op_c9(); } /* DB FD */
OP(fd,ca) { illegal_1(); op_ca(); } /* DB FD */
-OP(fd,cb) { eay(); EXEC(xycb,arg()); } /* ** FD CB xx */
+OP(fd,cb) { eay(); u8 a = arg(); nomreq_addr(PCD-1, 2); EXEC(xycb, a); } /* ** FD CB xx */
OP(fd,cc) { illegal_1(); op_cc(); } /* DB FD */
OP(fd,cd) { illegal_1(); op_cd(); } /* DB FD */
OP(fd,ce) { illegal_1(); op_ce(); } /* DB FD */
@@ -2530,7 +2627,7 @@ OP(fd,f6) { illegal_1(); op_f6(); } /* DB FD
OP(fd,f7) { illegal_1(); op_f7(); } /* DB FD */
OP(fd,f8) { illegal_1(); op_f8(); } /* DB FD */
-OP(fd,f9) { SP = IY; } /* LD SP,IY */
+OP(fd,f9) { nomreq_ir(2); SP = IY; } /* LD SP,IY */
OP(fd,fa) { illegal_1(); op_fa(); } /* DB FD */
OP(fd,fb) { illegal_1(); op_fb(); } /* DB FD */
OP(fd,fc) { illegal_1(); op_fc(); } /* DB FD */
@@ -2673,7 +2770,7 @@ OP(ed,6d) { reti(); } /* RETI
OP(ed,6e) { m_im = 0; } /* IM 0 */
OP(ed,6f) { rld(); } /* RLD (HL) */
-OP(ed,70) { uint8_t res = in(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */
+OP(ed,70) { uint8_t res = in(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */
OP(ed,71) { out(BC, 0); } /* OUT (C),0 */
OP(ed,72) { sbc_hl(m_sp); } /* SBC HL,SP */
OP(ed,73) { m_ea = arg16(); wm16(m_ea, m_sp); WZ = m_ea + 1; } /* LD (w),SP */
@@ -2842,34 +2939,34 @@ OP(ed,ff) { illegal_2(); } /* DB ED
OP(op,00) { } /* NOP */
OP(op,01) { BC = arg16(); } /* LD BC,w */
OP(op,02) { wm(BC,A); WZ_L = (BC + 1) & 0xFF; WZ_H = A; } /* LD (BC),A */
-OP(op,03) { BC++; } /* INC BC */
+OP(op,03) { nomreq_ir(2); BC++; } /* INC BC */
OP(op,04) { B = inc(B); } /* INC B */
OP(op,05) { B = dec(B); } /* DEC B */
OP(op,06) { B = arg(); } /* LD B,n */
OP(op,07) { rlca(); } /* RLCA */
OP(op,08) { ex_af(); } /* EX AF,AF' */
-OP(op,09) { add16(m_hl, m_bc); } /* ADD HL,BC */
+OP(op,09) { add16(m_hl, m_bc); } /* ADD HL,BC */
OP(op,0a) { A = rm(BC); WZ=BC+1; } /* LD A,(BC) */
-OP(op,0b) { BC--; } /* DEC BC */
+OP(op,0b) { nomreq_ir(2); BC--; } /* DEC BC */
OP(op,0c) { C = inc(C); } /* INC C */
OP(op,0d) { C = dec(C); } /* DEC C */
OP(op,0e) { C = arg(); } /* LD C,n */
OP(op,0f) { rrca(); } /* RRCA */
-OP(op,10) { B--; jr_cond(B, 0x10); } /* DJNZ o */
+OP(op,10) { nomreq_ir(1); B--; jr_cond(B, 0x10); } /* DJNZ o */
OP(op,11) { DE = arg16(); } /* LD DE,w */
OP(op,12) { wm(DE,A); WZ_L = (DE + 1) & 0xFF; WZ_H = A; } /* LD (DE),A */
-OP(op,13) { DE++; } /* INC DE */
+OP(op,13) { nomreq_ir(2); DE++; } /* INC DE */
OP(op,14) { D = inc(D); } /* INC D */
OP(op,15) { D = dec(D); } /* DEC D */
OP(op,16) { D = arg(); } /* LD D,n */
OP(op,17) { rla(); } /* RLA */
OP(op,18) { jr(); } /* JR o */
-OP(op,19) { add16(m_hl, m_de); } /* ADD HL,DE */
+OP(op,19) { add16(m_hl, m_de); } /* ADD HL,DE */
OP(op,1a) { A = rm(DE); WZ = DE + 1; } /* LD A,(DE) */
-OP(op,1b) { DE--; } /* DEC DE */
+OP(op,1b) { nomreq_ir(2); DE--; } /* DEC DE */
OP(op,1c) { E = inc(E); } /* INC E */
OP(op,1d) { E = dec(E); } /* DEC E */
OP(op,1e) { E = arg(); } /* LD E,n */
@@ -2878,16 +2975,16 @@ OP(op,1f) { rra();
OP(op,20) { jr_cond(!(F & ZF), 0x20); } /* JR NZ,o */
OP(op,21) { HL = arg16(); } /* LD HL,w */
OP(op,22) { m_ea = arg16(); wm16(m_ea, m_hl); WZ = m_ea + 1; } /* LD (w),HL */
-OP(op,23) { HL++; } /* INC HL */
+OP(op,23) { nomreq_ir(2); HL++; } /* INC HL */
OP(op,24) { H = inc(H); } /* INC H */
OP(op,25) { H = dec(H); } /* DEC H */
OP(op,26) { H = arg(); } /* LD H,n */
OP(op,27) { daa(); } /* DAA */
OP(op,28) { jr_cond(F & ZF, 0x28); } /* JR Z,o */
-OP(op,29) { add16(m_hl, m_hl); } /* ADD HL,HL */
-OP(op,2a) { m_ea = arg16(); rm16(m_ea, m_hl); WZ = m_ea+1; } /* LD HL,(w) */
-OP(op,2b) { HL--; } /* DEC HL */
+OP(op,29) { add16(m_hl, m_hl); } /* ADD HL,HL */
+OP(op,2a) { m_ea = arg16(); rm16(m_ea, m_hl); WZ = m_ea + 1; } /* LD HL,(w) */
+OP(op,2b) { nomreq_ir(2); HL--; } /* DEC HL */
OP(op,2c) { L = inc(L); } /* INC L */
OP(op,2d) { L = dec(L); } /* DEC L */
OP(op,2e) { L = arg(); } /* LD L,n */
@@ -2896,16 +2993,16 @@ OP(op,2f) { A ^= 0xff; F = (F & (SF | ZF | PF | CF)) | HF | NF | (A & (YF | XF))
OP(op,30) { jr_cond(!(F & CF), 0x30); } /* JR NC,o */
OP(op,31) { SP = arg16(); } /* LD SP,w */
OP(op,32) { m_ea = arg16(); wm(m_ea, A); WZ_L = (m_ea + 1) & 0xFF; WZ_H = A; } /* LD (w),A */
-OP(op,33) { SP++; } /* INC SP */
-OP(op,34) { wm(HL, inc(rm(HL))); } /* INC (HL) */
-OP(op,35) { wm(HL, dec(rm(HL))); } /* DEC (HL) */
+OP(op,33) { nomreq_ir(2); SP++; } /* INC SP */
+OP(op,34) { wm(HL, inc(rm_reg(HL))); } /* INC (HL) */
+OP(op,35) { wm(HL, dec(rm_reg(HL))); } /* DEC (HL) */
OP(op,36) { wm(HL, arg()); } /* LD (HL),n */
OP(op,37) { F = (F & (SF | ZF | YF | XF | PF)) | CF | (A & (YF | XF)); } /* SCF */
OP(op,38) { jr_cond(F & CF, 0x38); } /* JR C,o */
OP(op,39) { add16(m_hl, m_sp); } /* ADD HL,SP */
OP(op,3a) { m_ea = arg16(); A = rm(m_ea); WZ = m_ea + 1; } /* LD A,(w) */
-OP(op,3b) { SP--; } /* DEC SP */
+OP(op,3b) { nomreq_ir(2); SP--; } /* DEC SP */
OP(op,3c) { A = inc(A); } /* INC A */
OP(op,3d) { A = dec(A); } /* DEC A */
OP(op,3e) { A = arg(); } /* LD A,n */
@@ -3067,7 +3164,7 @@ OP(op,c7) { rst(0x00);
OP(op,c8) { ret_cond(F & ZF, 0xc8); } /* RET Z */
OP(op,c9) { pop(m_pc); WZ = PCD; } /* RET */
OP(op,ca) { jp_cond(F & ZF); } /* JP Z,a */
-OP(op,cb) { m_r++; EXEC(cb,rop()); } /* **** CB xx */
+OP(op,cb) { EXEC(cb, rop()); } /* **** CB xx */
OP(op,cc) { call_cond(F & ZF, 0xcc); } /* CALL Z,a */
OP(op,cd) { call(); } /* CALL a */
OP(op,ce) { adc_a(arg()); } /* ADC A,n */
@@ -3087,7 +3184,7 @@ OP(op,d9) { exx();
OP(op,da) { jp_cond(F & CF); } /* JP C,a */
OP(op,db) { unsigned n = arg() | (A << 8); A = in(n); WZ = n + 1; } /* IN A,(n) */
OP(op,dc) { call_cond(F & CF, 0xdc); } /* CALL C,a */
-OP(op,dd) { m_r++; EXEC(dd,rop()); } /* **** DD xx */
+OP(op,dd) { EXEC(dd, rop()); } /* **** DD xx */
OP(op,de) { sbc_a(arg()); } /* SBC A,n */
OP(op,df) { rst(0x18); } /* RST 3 */
@@ -3105,7 +3202,7 @@ OP(op,e9) { PC = HL;
OP(op,ea) { jp_cond(F & PF); } /* JP PE,a */
OP(op,eb) { ex_de_hl(); } /* EX DE,HL */
OP(op,ec) { call_cond(F & PF, 0xec); } /* CALL PE,a */
-OP(op,ed) { m_r++; EXEC(ed,rop()); } /* **** ED xx */
+OP(op,ed) { EXEC(ed, rop()); } /* **** ED xx */
OP(op,ee) { xor_a(arg()); } /* XOR n */
OP(op,ef) { rst(0x28); } /* RST 5 */
@@ -3119,11 +3216,11 @@ OP(op,f6) { or_a(arg());
OP(op,f7) { rst(0x30); } /* RST 6 */
OP(op,f8) { ret_cond(F & SF, 0xf8); } /* RET M */
-OP(op,f9) { SP = HL; } /* LD SP,HL */
+OP(op,f9) { nomreq_ir(2); SP = HL; } /* LD SP,HL */
OP(op,fa) { jp_cond(F & SF); } /* JP M,a */
OP(op,fb) { ei(); } /* EI */
OP(op,fc) { call_cond(F & SF, 0xfc); } /* CALL M,a */
-OP(op,fd) { m_r++; EXEC(fd,rop()); } /* **** FD xx */
+OP(op,fd) { EXEC(fd, rop()); } /* **** FD xx */
OP(op,fe) { cp(arg()); } /* CP n */
OP(op,ff) { rst(0x38); } /* RST 7 */
@@ -3139,10 +3236,12 @@ void z80_device::take_nmi()
#endif
m_iff1 = 0;
+ m_r++;
+
+ m_icount_executing = 11;
push(m_pc);
PCD = 0x0066;
WZ=PCD;
- m_icount -= 11;
m_nmi_pending = false;
}
@@ -3155,35 +3254,41 @@ void z80_device::take_interrupt()
m_iff1 = m_iff2 = 0;
// say hi
+ // Not precise in all cases. z80 must finish current instruction (NOP) to reach this state - in such case frame timings are shifter from cb event if calulated based on it.
m_irqack_cb(true);
+ m_r++;
// fetch the IRQ vector
device_z80daisy_interface *intf = daisy_get_irq_device();
int irq_vector = (intf != nullptr) ? intf->z80daisy_irq_ack() : standard_irq_callback_member(*this, 0);
LOG(("Z80 single int. irq_vector $%02x\n", irq_vector));
+ /* 'interrupt latency' cycles */
+ m_icount_executing = cc_ex[0xff];
+
/* Interrupt mode 2. Call [i:databyte] */
if( m_im == 2 )
{
// Zilog's datasheet claims that "the least-significant bit must be a zero."
// However, experiments have confirmed that IM 2 vectors do not have to be
// even, and all 8 bits will be used; even $FF is handled normally.
+ /* CALL opcode timing */
+ m_icount_executing += m_cc_op[0xcd];
irq_vector = (irq_vector & 0xff) | (m_i << 8);
- push(m_pc);
+ PAIR tmp = m_pc;
rm16(irq_vector, m_pc);
+ push(tmp);
LOG(("Z80 IM2 [$%04x] = $%04x\n", irq_vector, PCD));
- /* CALL opcode timing + 'interrupt latency' cycles */
- m_icount -= m_cc_op[0xcd] + m_cc_ex[0xff];
}
else
/* Interrupt mode 1. RST 38h */
if( m_im == 1 )
{
LOG(("Z80 '%s' IM1 $0038\n", tag()));
+ /* RST $38 */
+ m_icount_executing += m_cc_op[0xff];
push(m_pc);
PCD = 0x0038;
- /* RST $38 + 'interrupt latency' cycles */
- m_icount -= m_cc_op[0xff] + cc_ex[0xff];
}
else
{
@@ -3198,27 +3303,24 @@ void z80_device::take_interrupt()
switch (irq_vector & 0xff0000)
{
case 0xcd0000: /* call */
+ /* CALL $xxxx cycles */
+ m_icount_executing += m_cc_op[0xcd];
push(m_pc);
PCD = irq_vector & 0xffff;
- /* CALL $xxxx cycles */
- m_icount -= m_cc_op[0xcd];
break;
case 0xc30000: /* jump */
- PCD = irq_vector & 0xffff;
/* JP $xxxx cycles */
- m_icount -= m_cc_op[0xc3];
+ m_icount_executing += m_cc_op[0xc3];
+ PCD = irq_vector & 0xffff;
break;
default: /* rst (or other opcodes?) */
+ /* RST $xx cycles */
+ m_icount_executing += m_cc_op[0xff];
push(m_pc);
PCD = irq_vector & 0x0038;
- /* RST $xx cycles */
- m_icount -= m_cc_op[0xff];
break;
}
}
-
- /* 'interrupt latency' cycles */
- m_icount -= m_cc_ex[0xff];
}
WZ=PCD;
@@ -3228,6 +3330,20 @@ void z80_device::take_interrupt()
#endif
}
+void z80_device::nomreq_ir(s8 cycles)
+{
+ nomreq_addr((m_i << 8) | (m_r2 & 0x80) | (m_r & 0x7f), cycles);
+}
+
+void z80_device::nomreq_addr(u16 addr, s8 cycles)
+{
+ for (; cycles; cycles--)
+ {
+ m_nomreq_cb(addr, 0x00, 0xff);
+ T(1);
+ }
+}
+
void nsc800_device::take_interrupt_nsc800()
{
/* Check if processor was halted */
@@ -3443,6 +3559,7 @@ void z80_device::device_start()
// set our instruction counter
set_icountptr(m_icount);
+ m_icount_executing = 0;
/* setup cycle tables */
m_cc_op = cc_op;
@@ -3454,6 +3571,7 @@ void z80_device::device_start()
m_irqack_cb.resolve_safe();
m_refresh_cb.resolve_safe();
+ m_nomreq_cb.resolve_safe();
m_halt_cb.resolve_safe();
}
@@ -3506,6 +3624,7 @@ void z80_device::execute_run()
// check for interrupts before each instruction
check_interrupts();
+ T(m_icount_executing);
m_after_ei = false;
m_after_ldair = false;
@@ -3513,7 +3632,6 @@ void z80_device::execute_run()
PRVPC = PCD;
debugger_instruction_hook(PCD);
- m_r++;
uint8_t opcode = rop();
// when in HALT state, the fetched opcode is not dispatched (aka a NOP)
@@ -3698,6 +3816,7 @@ z80_device::z80_device(const machine_config &mconfig, device_type type, const ch
m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0),
m_irqack_cb(*this),
m_refresh_cb(*this),
+ m_nomreq_cb(*this),
m_halt_cb(*this)
{
}
diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h
index 8e82ccd3353..08eba4eb1d6 100644
--- a/src/devices/cpu/z80/z80.h
+++ b/src/devices/cpu/z80/z80.h
@@ -38,6 +38,7 @@ public:
template <typename... T> void set_io_map(T &&... args) { set_addrmap(AS_IO, std::forward<T>(args)...); }
auto irqack_cb() { return m_irqack_cb.bind(); }
auto refresh_cb() { return m_refresh_cb.bind(); }
+ auto nomreq_cb() { return m_nomreq_cb.bind(); }
auto halt_cb() { return m_halt_cb.bind(); }
protected:
@@ -149,9 +150,11 @@ protected:
uint8_t in(uint16_t port);
void out(uint16_t port, uint8_t value);
virtual uint8_t rm(uint16_t addr);
+ uint8_t rm_reg(uint16_t addr);
void rm16(uint16_t addr, PAIR &r);
virtual void wm(uint16_t addr, uint8_t value);
void wm16(uint16_t addr, PAIR &r);
+ void wm16back(uint16_t addr, PAIR &r);
virtual uint8_t rop();
virtual uint8_t arg();
virtual uint16_t arg16();
@@ -232,6 +235,8 @@ protected:
virtual void check_interrupts();
void take_interrupt();
void take_nmi();
+ void nomreq_ir(s8 cycles);
+ void nomreq_addr(u16 addr, s8 cycles);
// address spaces
const address_space_config m_program_config;
@@ -244,22 +249,23 @@ protected:
devcb_write_line m_irqack_cb;
devcb_write8 m_refresh_cb;
+ devcb_write8 m_nomreq_cb;
devcb_write_line m_halt_cb;
- PAIR m_prvpc;
- PAIR m_pc;
- PAIR m_sp;
- PAIR m_af;
- PAIR m_bc;
- PAIR m_de;
- PAIR m_hl;
- PAIR m_ix;
- PAIR m_iy;
- PAIR m_wz;
- PAIR m_af2;
- PAIR m_bc2;
- PAIR m_de2;
- PAIR m_hl2;
+ PAIR m_prvpc;
+ PAIR m_pc;
+ PAIR m_sp;
+ PAIR m_af;
+ PAIR m_bc;
+ PAIR m_de;
+ PAIR m_hl;
+ PAIR m_ix;
+ PAIR m_iy;
+ PAIR m_wz;
+ PAIR m_af2;
+ PAIR m_bc2;
+ PAIR m_de2;
+ PAIR m_hl2;
uint8_t m_r;
uint8_t m_r2;
uint8_t m_iff1;
@@ -270,13 +276,14 @@ protected:
uint8_t m_nmi_state; /* nmi line state */
uint8_t m_nmi_pending; /* nmi pending */
uint8_t m_irq_state; /* irq line state */
- int m_wait_state; // wait line state
- int m_busrq_state; // bus request line state
+ int m_wait_state; // wait line state
+ int m_busrq_state; // bus request line state
uint8_t m_after_ei; /* are we in the EI shadow? */
uint8_t m_after_ldair; /* same, but for LD A,I or LD A,R */
uint32_t m_ea;
- int m_icount;
+ int m_icount;
+ int m_icount_executing;
uint8_t m_rtemp;
const uint8_t * m_cc_op;
const uint8_t * m_cc_cb;
diff --git a/src/mame/drivers/pentagon.cpp b/src/mame/drivers/pentagon.cpp
index a98abb8b66b..9040db14f7f 100644
--- a/src/mame/drivers/pentagon.cpp
+++ b/src/mame/drivers/pentagon.cpp
@@ -118,13 +118,12 @@ void pentagon_state::pentagon_scr2_w(offs_t offset, uint8_t data)
rectangle pentagon_state::get_screen_area()
{
- //TODO Possible because of incorrect z80 we have to adjust x+1 to make AccrossTheEdge look nicer
- return rectangle{137, 137 + 255, 80, 80 + 191};
+ return rectangle{136, 136 + 255, 80, 80 + 191};
}
INTERRUPT_GEN_MEMBER(pentagon_state::pentagon_interrupt)
{
- timer_set(m_screen->time_until_pos(0) - m_maincpu->clocks_to_attotime(1), TIMER_IRQ_ON, 0);
+ timer_set(m_screen->time_until_pos(0) + /*???*/ m_maincpu->clocks_to_attotime(3), TIMER_IRQ_ON, 0);
}
uint8_t pentagon_state::beta_neutral_r(offs_t offset)
diff --git a/src/mame/drivers/spec128.cpp b/src/mame/drivers/spec128.cpp
index 00394d67a02..03990c326cd 100644
--- a/src/mame/drivers/spec128.cpp
+++ b/src/mame/drivers/spec128.cpp
@@ -165,6 +165,13 @@ resulting mess can be seen in the F4 viewer display.
/****************************************************************************************************/
/* Spectrum 128 specific functions */
+void spectrum_128_state::video_start()
+{
+ m_frame_invert_count = 16;
+ m_screen_location = m_ram->pointer() + (5 << 14);
+ m_contention_pattern = {1, 0, 7, 6, 5, 4, 3, 2};
+}
+
uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
{
/* this allows expansion devices to act upon opcode fetches from MEM addresses
@@ -172,6 +179,7 @@ uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
enable paged ROM and then fetches at 0700 to disable it
*/
m_exp->pre_opcode_fetch(offset);
+ if (is_contended(offset)) content_early();
uint8_t retval = m_maincpu->space(AS_PROGRAM).read_byte(offset);
m_exp->post_opcode_fetch(offset);
return retval;
@@ -291,6 +299,18 @@ void spectrum_128_state::machine_reset()
spectrum_128_update_memory();
}
+bool spectrum_128_state::is_vram_write(offs_t offset) {
+ // TODO respect banks 2,5 mapped to 0xc000
+ return (BIT(m_port_7ffd_data, 3))
+ ? offset >= 0x8000 && offset < 0x9b00
+ : spectrum_state::is_vram_write(offset);
+}
+
+bool spectrum_128_state::is_contended(offs_t offset) {
+ // TODO Unlike the base 128K machine, RAM banks 4, 5, 6 and 7 are contended.
+ return spectrum_state::is_contended(offset);// || (offset >= 0x8000 && offset < 0xc000);
+}
+
static const gfx_layout spectrum_charlayout =
{
8, 8, /* 8 x 8 characters */
diff --git a/src/mame/drivers/spectrum.cpp b/src/mame/drivers/spectrum.cpp
index 960f7a8c5d6..be73c2286bd 100644
--- a/src/mame/drivers/spectrum.cpp
+++ b/src/mame/drivers/spectrum.cpp
@@ -293,6 +293,8 @@ SamRam
uint8_t spectrum_state::pre_opcode_fetch_r(offs_t offset)
{
+ if (is_contended(offset)) content_early();
+
/* this allows expansion devices to act upon opcode fetches from MEM addresses
for example, interface1 detection fetches requires fetches at 0008 / 0708 to
enable paged ROM and then fetches at 0700 to disable it
@@ -305,6 +307,8 @@ uint8_t spectrum_state::pre_opcode_fetch_r(offs_t offset)
uint8_t spectrum_state::spectrum_data_r(offs_t offset)
{
+ if (is_contended(offset)) content_early();
+
m_exp->pre_data_fetch(offset);
uint8_t retval = m_specmem->space(AS_PROGRAM).read_byte(offset);
m_exp->post_data_fetch(offset);
@@ -313,6 +317,9 @@ uint8_t spectrum_state::spectrum_data_r(offs_t offset)
void spectrum_state::spectrum_data_w(offs_t offset, uint8_t data)
{
+ if (is_contended(offset)) content_early();
+ if (is_vram_write(offset)) m_screen->update_now();
+
m_specmem->space(AS_PROGRAM).write_byte(offset,data);
}
@@ -341,6 +348,9 @@ uint8_t spectrum_state::spectrum_rom_r(offs_t offset)
*/
void spectrum_state::spectrum_ula_w(offs_t offset, uint8_t data)
{
+ if (is_contended(offset)) content_early();
+ content_early(1);
+
unsigned char Changed = m_port_fe_data^data;
/* border colour changed? */
@@ -363,11 +373,13 @@ void spectrum_state::spectrum_ula_w(offs_t offset, uint8_t data)
m_port_fe_data = data;
}
-
/* KT: more accurate keyboard reading */
/* DJR: Spectrum+ keys added */
uint8_t spectrum_state::spectrum_ula_r(offs_t offset)
{
+ if (is_contended(offset)) content_early();
+ content_early(1);
+
int lines = offset >> 8;
int data = 0xff;
@@ -443,6 +455,12 @@ uint8_t spectrum_state::spectrum_ula_r(offs_t offset)
void spectrum_state::spectrum_port_w(offs_t offset, uint8_t data)
{
+ if (is_contended(offset))
+ {
+ content_early();
+ content_late();
+ }
+
// Pass through to expansion device if present
if (m_exp->get_card_device())
m_exp->iorq_w(offset | 1, data);
@@ -450,6 +468,12 @@ void spectrum_state::spectrum_port_w(offs_t offset, uint8_t data)
uint8_t spectrum_state::spectrum_port_r(offs_t offset)
{
+ if (is_contended(offset))
+ {
+ content_early();
+ content_late();
+ }
+
// Pass through to expansion device if present
if (m_exp->get_card_device())
return m_exp->iorq_r(offset | 1);
@@ -745,19 +769,11 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_IRQ_ON:
m_maincpu->set_input_line(0, HOLD_LINE);
timer_set(m_maincpu->clocks_to_attotime(32), TIMER_IRQ_OFF, 0);
+ m_irq_start_cycle = m_maincpu->total_cycles();
break;
case TIMER_IRQ_OFF:
m_maincpu->set_input_line(0, CLEAR_LINE);
break;
- case TIMER_SCANLINE:
- {
- auto vpos_next = m_screen->vpos() + 1;
- if(vpos_next <= get_screen_area().bottom()) {
- m_scanline_timer->adjust(m_screen->time_until_pos(vpos_next), get_screen_area().left());
- m_screen->update_now();
- }
- break;
- }
default:
throw emu_fatalerror("Unknown id in spectrum_state::device_timer");
}
@@ -765,14 +781,7 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
{
- timer_set(m_screen->time_until_pos(0), TIMER_IRQ_ON, 0);
-
- /* Default implementation performs screen updates per scanline. Some other
- clones e.g. pentagon do updates based on video_ram access, border updates,
- and full frame refresh (for attributes flashing). Such clones may define own
- *_interrupt config. */
- if (m_scanline_timer != nullptr)
- m_scanline_timer->adjust(m_screen->time_until_pos(get_screen_area().top() + 1));
+ timer_set(m_screen->time_until_pos(0, get_screen_area().left()), TIMER_IRQ_ON, 0);
}
void spectrum_state::spectrum_common(machine_config &config)
@@ -783,6 +792,7 @@ void spectrum_state::spectrum_common(machine_config &config)
m_maincpu->set_addrmap(AS_OPCODES, &spectrum_state::spectrum_data);
m_maincpu->set_addrmap(AS_IO, &spectrum_state::spectrum_io);
m_maincpu->set_vblank_int("screen", FUNC(spectrum_state::spec_interrupt));
+ m_maincpu->nomreq_cb().set(FUNC(spectrum_state::spectrum_nomreq));
ADDRESS_MAP_BANK(config, m_specmem).set_map(&spectrum_state::spectrum_map).set_options(ENDIANNESS_LITTLE, 8, 16, 0x10000);
@@ -911,8 +921,10 @@ ROM_START(spectrum)
ROMX_LOAD("diagrom.v50",0x0000,0x4000, CRC(054a2d6a) SHA1(2fa6f3b31d7bb610df78be5c4c80537cf6e5911d), ROM_BIOS(26))
ROM_SYSTEM_BIOS(27, "diagv51", "DiagROM v1.51")
ROMX_LOAD("diagrom.v51",0x0000,0x4000, CRC(83034df6) SHA1(e57b2c8a8e3563ea02a20eecd1d4cb6be9f9c2df), ROM_BIOS(27))
- ROM_SYSTEM_BIOS(28, "alford37", "Brian Alford's Test ROM v0.37")
- ROMX_LOAD("testromv037.bin", 0x0000,0x4000, CRC(a7ea3d1c) SHA1(f699b73abfb1ab53c063ac02ac6283705864c734), ROM_BIOS(28))
+ ROM_SYSTEM_BIOS(28, "diagv56", "DiagROM v1.56")
+ ROMX_LOAD("diagrom.v56",0x0000,0x4000, CRC(0ed22f7a) SHA1(37caf0bbc2d023ca5afaa12b3856ac90dbc83c51), ROM_BIOS(28))
+ ROM_SYSTEM_BIOS(29, "alford37", "Brian Alford's Test ROM v0.37")
+ ROMX_LOAD("testromv037.bin", 0x0000,0x4000, CRC(a7ea3d1c) SHA1(f699b73abfb1ab53c063ac02ac6283705864c734), ROM_BIOS(29))
ROM_END
ROM_START(specide)
diff --git a/src/mame/drivers/system1.cpp b/src/mame/drivers/system1.cpp
index 4031fc13116..d89ec4ec1a0 100644
--- a/src/mame/drivers/system1.cpp
+++ b/src/mame/drivers/system1.cpp
@@ -349,86 +349,86 @@ static const u8 cc_op[0x100] = {
4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 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,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
- 20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
- 20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
- 20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
- 23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
+ 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
+ 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
+ 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
+ 12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5
};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
@@ -451,7 +451,6 @@ static const u8 cc_ex[0x100] = {
6*5, 0*5, 0*5, 0*5, 7*5, 0*5, 0*5, 2*5, 6*5, 0*5, 0*5, 0*5, 7*5, 0*5, 0*5, 2*5
};
-
void system1_state::machine_start()
{
const u32 numbanks = (m_maincpu_region->bytes() - 0x10000) / 0x4000;
diff --git a/src/mame/drivers/tsconf.cpp b/src/mame/drivers/tsconf.cpp
index fd1b9115106..8e0abd86ae3 100644
--- a/src/mame/drivers/tsconf.cpp
+++ b/src/mame/drivers/tsconf.cpp
@@ -185,7 +185,7 @@ GFXDECODE_END
void tsconf_state::video_start()
{
spectrum_128_state::video_start();
- m_scanline_timer->reset();
+ m_contention_pattern = {}; // disable inherited contention
m_ts_tilemap[TM_TS_CHAR] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tsconf_state::get_tile_info_txt)), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
diff --git a/src/mame/includes/spectrum.h b/src/mame/includes/spectrum.h
index 5a52ae6e713..c967866810c 100644
--- a/src/mame/includes/spectrum.h
+++ b/src/mame/includes/spectrum.h
@@ -20,6 +20,7 @@
#include "sound/spkrdev.h"
#include "emupal.h"
#include "screen.h"
+#include "cpu/z80/z80.h"
/* Spectrum crystals */
@@ -98,8 +99,7 @@ protected:
enum
{
TIMER_IRQ_ON,
- TIMER_IRQ_OFF,
- TIMER_SCANLINE // tsconf assumes it last know. if need more add above or fix references in clones
+ TIMER_IRQ_OFF // tsconf assumes it last know. if need more add above or fix references in clones
};
int m_port_fe_data;
@@ -114,11 +114,7 @@ protected:
uint8_t *m_screen_location;
int m_ROMSelection;
-
- // Build up the screen bitmap line-by-line as the z80 uses CPU cycles.
- // Eliminates sprite flicker on various games (E.g. Marauder and
- // Stormlord) and makes Firefly playable.
- emu_timer *m_scanline_timer;
+ std::vector<u8> m_contention_pattern;
uint8_t m_ram_disabled_by_beta;
uint8_t pre_opcode_fetch_r(offs_t offset);
@@ -126,7 +122,12 @@ protected:
uint8_t spectrum_rom_r(offs_t offset);
uint8_t spectrum_data_r(offs_t offset);
void spectrum_data_w(offs_t offset, uint8_t data);
+ virtual bool is_contended(offs_t offset);
+ virtual bool is_vram_write(offs_t offset);
+ void content_early(s8 shift = 0);
+ void content_late();
+ void spectrum_nomreq(offs_t offset, uint8_t data);
void spectrum_ula_w(offs_t offset, uint8_t data);
uint8_t spectrum_ula_r(offs_t offset);
void spectrum_port_w(offs_t offset, uint8_t data);
@@ -141,7 +142,7 @@ protected:
DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
- required_device<cpu_device> m_maincpu;
+ required_device<z80_device> m_maincpu;
required_device<screen_device> m_screen;
void spectrum_io(address_map &map);
@@ -179,6 +180,7 @@ protected:
optional_ioport m_io_joy1;
optional_ioport m_io_joy2;
+ u64 m_irq_start_cycle;
virtual u8 get_border_color(u16 hpos = ~0, u16 vpos = ~0);
// Defines position of main screen excluding border
virtual rectangle get_screen_area();
@@ -226,6 +228,9 @@ protected:
virtual void spectrum_128_update_memory() override;
virtual rectangle get_screen_area() override;
+ virtual bool is_contended(offs_t offset) override;
+ virtual bool is_vram_write(offs_t offset) override;
+
private:
uint8_t spectrum_128_pre_opcode_fetch_r(offs_t offset);
void spectrum_128_bank1_w(offs_t offset, uint8_t data);
diff --git a/src/mame/includes/tsconf.h b/src/mame/includes/tsconf.h
index 051ddae38ec..5eaab848c05 100644
--- a/src/mame/includes/tsconf.h
+++ b/src/mame/includes/tsconf.h
@@ -51,7 +51,7 @@ protected:
private:
enum timer_id : u8
{
- TIMER_IRQ_FRAME = TIMER_SCANLINE + 1,
+ TIMER_IRQ_FRAME = TIMER_IRQ_OFF + 1,
TIMER_IRQ_SCANLINE
};
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp
index 696e824892a..07c3eb31352 100644
--- a/src/mame/machine/amstrad.cpp
+++ b/src/mame/machine/amstrad.cpp
@@ -2787,122 +2787,121 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int)
/* the following timings have been measured! */
static const uint8_t amstrad_cycle_table_op[256] = {
- 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
+ 4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4,
- 8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4,
- 8, 12, 16, 8, 12, 12, 12, 4, 8, 12, 16, 8, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 8, 8, 8, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
- 8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16,
- 8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
- 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16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8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
+ 8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16,
+ 8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16
};
-static const uint8_t amstrad_cycle_table_xycb[256]=
-{
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+static const uint8_t amstrad_cycle_table_xycb[0x100] = {
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+ 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
};
static const uint8_t amstrad_cycle_table_ex[256]=
{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
- 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0,
+ 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0,
+ 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0,
+ 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0
};
#define NEXT_ROM_SLOT m_rom_count++; \
diff --git a/src/mame/machine/msx.cpp b/src/mame/machine/msx.cpp
index 7a174aa98cc..8d9df9f7aa8 100644
--- a/src/mame/machine/msx.cpp
+++ b/src/mame/machine/msx.cpp
@@ -43,7 +43,9 @@ void msx2_state::machine_start()
save_item(NAME(m_rtc_latch));
}
-
+/* A hack to add 1 wait cycle in each opcode fetch.
+ Possibly worth not to use custom table at all but adjust desired icount
+ directly in m_opcodes.read_byte handler. */
static const uint8_t cc_op[0x100] = {
4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,
8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,
@@ -57,86 +59,67 @@ static const uint8_t cc_op[0x100] = {
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
- 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0 ,10+1,17+1, 7+1,11+1,
- 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0 , 7+1,11+1,
- 5+1,10+1,10+1,19+1,10+1,11+1,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+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2,
- 5+4+2,10+4+2,10+4+2, 4+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 6+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2
-};
-
-static const uint8_t cc_xycb[0x100] = {
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
-20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
-20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
-20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
-23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,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, 4+1, 4+1,15+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1,15+1, 4+1,
+ 4+1, 4+1, 4+1, 4+1, 4+1, 4+1,15+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1,15+1, 4+1,
+ 5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 7+1,10+1,17+1, 7+1,11+1,
+ 5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 4+1, 7+1,11+1,
+ 5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 4+1, 7+1,11+1,
+ 5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 4+1, 7+1,11+1
};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
@@ -159,14 +142,13 @@ static const uint8_t cc_ex[0x100] = {
6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1
};
-
void msx_state::driver_start()
{
m_maincpu->set_input_line_vector(0, 0xff); // Z80
msx_memory_init();
- m_maincpu->z80_set_cycle_tables( cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex );
+ m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, nullptr, cc_ex);
save_item(NAME(m_psg_b));
save_item(NAME(m_mouse));
diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp
index 971fa935c8c..af3abeb6a9d 100644
--- a/src/mame/video/spectrum.cpp
+++ b/src/mame/video/spectrum.cpp
@@ -26,14 +26,7 @@ void spectrum_state::video_start()
{
m_frame_invert_count = 16;
m_screen_location = m_video_ram;
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
-}
-
-void spectrum_128_state::video_start()
-{
- m_frame_invert_count = 16;
- m_screen_location = m_ram->pointer() + (5 << 14);
- m_scanline_timer = timer_alloc(TIMER_SCANLINE);
+ m_contention_pattern = {6, 5, 4, 3, 2, 1, 0, 0};
}
/***************************************************************************
@@ -124,11 +117,23 @@ u32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &
void spectrum_state::spectrum_update_border(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &border)
{
+ u8 mod = m_contention_pattern.empty() ? 1 : m_contention_pattern.size();
for (auto y = border.top(); y <= border.bottom(); y++)
{
u16 *pix = &(bitmap.pix(y, border.left()));
- for (auto x = border.left(); x <= border.right(); x++)
- *pix++ = get_border_color(y, x);
+ for (auto x = border.left(); x <= border.right(); )
+ {
+ if (x % mod == 0)
+ {
+ for (auto m = 0; m < mod; m++, x++)
+ *pix++ = get_border_color(y, x);
+ }
+ else
+ {
+ pix++;
+ x++;
+ }
+ }
}
}
@@ -140,6 +145,12 @@ void spectrum_state::spectrum_update_screen(screen_device &screen_d, bitmap_ind1
{
u16 hpos = screen.left();
u16 x = hpos - get_screen_area().left();
+ if (x % 8)
+ {
+ u8 shift = 8 - (x % 8);
+ x += shift;
+ hpos += shift;
+ }
u16 y = vpos - get_screen_area().top();
u8 *scr = &m_screen_location[((y & 7) << 8) | ((y & 0x38) << 2) | ((y & 0xc0) << 5) | (x >> 3)];
u8 *attr = &attrs_location[((y & 0xf8) << 2) | (x >> 3)];
@@ -150,10 +161,63 @@ void spectrum_state::spectrum_update_screen(screen_device &screen_d, bitmap_ind1
u16 pap = (*attr >> 3) & 0x0f;
u8 pix8 = (invert_attrs && (*attr & 0x80)) ? ~*scr : *scr;
- for (u8 b = 0x80 >> (x & 0x07); b != 0 && hpos <= screen.right(); b >>= 1, x++, hpos++)
+ for (u8 b = 0x80; b; b >>= 1, x++, hpos++)
*pix++ = (pix8 & b) ? ink : pap;
scr++;
attr++;
}
}
}
+
+bool spectrum_state::is_vram_write(offs_t offset) {
+ return offset >= 0x4000 && offset < 0x5b00;
+}
+
+bool spectrum_state::is_contended(offs_t offset) {
+ return offset >= 0x4000 && offset < 0x8000;
+}
+
+void spectrum_state::content_early(s8 shift)
+{
+ u64 vpos = m_screen->vpos();
+ if (m_contention_pattern.empty() || vpos < get_screen_area().top() || vpos > get_screen_area().bottom())
+ return;
+
+ u64 now = m_maincpu->total_cycles() - m_irq_start_cycle + shift;
+ u64 cf = vpos * m_screen->width() * m_maincpu->clock() / m_screen->clock() - 1;
+ u64 ct = cf + get_screen_area().width() * m_maincpu->clock() / m_screen->clock();
+
+ if(cf <= now && now < ct)
+ {
+ u64 clocks = now - cf;
+ u8 c = m_contention_pattern[clocks % m_contention_pattern.size()];
+ m_maincpu->adjust_icount(-c);
+ }
+}
+
+void spectrum_state::content_late()
+{
+ u64 vpos = m_screen->vpos();
+ if (m_contention_pattern.empty() || vpos < get_screen_area().top() || vpos > get_screen_area().bottom())
+ return;
+
+ u64 now = m_maincpu->total_cycles() - m_irq_start_cycle + 1;
+ u64 cf = vpos * m_screen->width() * m_maincpu->clock() / m_screen->clock() - 1;
+ u64 ct = cf + get_screen_area().width() * m_maincpu->clock() / m_screen->clock();
+ for(auto i = 0x04; i; i >>= 1)
+ {
+ if(cf <= now && now < ct)
+ {
+ u64 clocks = now - cf;
+ u8 c = m_contention_pattern[clocks % m_contention_pattern.size()];
+ m_maincpu->adjust_icount(-c);
+ now += c;
+ }
+ now++;
+ }
+}
+
+void spectrum_state::spectrum_nomreq(offs_t offset, uint8_t data)
+{
+ if (is_contended(offset)) content_early();
+}