summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Wilbert Pol <wilbert@jdg.info>2012-02-25 21:22:21 +0000
committer Wilbert Pol <wilbert@jdg.info>2012-02-25 21:22:21 +0000
commitd20fa161dfc4ecac8d14eb1ab8dc673dcf92a072 (patch)
treebfacb9c46bc417027c4018df0b90e31ba22e7046 /src
parent1ff793a4a83fd9b89f589d22418bcff8d7e215f1 (diff)
Sync with MESS
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/lr35902/lr35902.c299
-rw-r--r--src/emu/cpu/lr35902/opc_cb.h938
-rw-r--r--src/emu/cpu/lr35902/opc_main.h986
3 files changed, 1169 insertions, 1054 deletions
diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c
index af7239eb3fa..bc0885fb36d 100644
--- a/src/emu/cpu/lr35902/lr35902.c
+++ b/src/emu/cpu/lr35902/lr35902.c
@@ -46,16 +46,20 @@
#define FLAG_H 0x20
#define FLAG_C 0x10
-#define CYCLES_PASSED(X) cpustate->w.icount -= ((X) / (cpustate->w.gb_speed)); \
- if ( cpustate->w.timer_expired_func ) { \
- cpustate->w.timer_expired_func( cpustate->w.device, X ); \
+#define CYCLES_PASSED(X) cpustate->icount -= ((X) / (cpustate->gb_speed)); \
+ if ( cpustate->timer_expired_func ) { \
+ cpustate->timer_expired_func( cpustate->device, X ); \
}
-typedef struct {
- UINT16 AF;
- UINT16 BC;
- UINT16 DE;
- UINT16 HL;
+typedef struct _lr35902_state {
+ UINT8 A;
+ UINT8 F;
+ UINT8 B;
+ UINT8 C;
+ UINT8 D;
+ UINT8 E;
+ UINT8 H;
+ UINT8 L;
UINT16 SP;
UINT16 PC;
@@ -80,38 +84,7 @@ typedef struct {
int doHALTbug;
UINT8 features;
const lr35902_cpu_core *config;
-} lr35902_16BitRegs;
-
-#ifdef LSB_FIRST
-typedef struct {
- UINT8 F;
- UINT8 A;
- UINT8 C;
- UINT8 B;
- UINT8 E;
- UINT8 D;
- UINT8 L;
- UINT8 H;
-} lr35902_8BitRegs;
-#else
-typedef struct {
- UINT8 A;
- UINT8 F;
- UINT8 B;
- UINT8 C;
- UINT8 D;
- UINT8 E;
- UINT8 H;
- UINT8 L;
-} lr35902_8BitRegs;
-#endif
-
-
-typedef union _lr35902_state lr35902_state;
-union _lr35902_state {
- lr35902_16BitRegs w;
- lr35902_8BitRegs b;
-};
+} lr35902_state;
INLINE lr35902_state *get_safe_token(device_t *device)
{
@@ -129,8 +102,14 @@ typedef int (*OpcodeEmulator) (lr35902_state *cpustate);
/* Memory functions */
/****************************************************************************/
-#define mem_ReadByte(cs,A) ((UINT8)(cs)->w.program->read_byte(A)); CYCLES_PASSED(4);
-#define mem_WriteByte(cs,A,V) ((cs)->w.program->write_byte(A,V)); CYCLES_PASSED(4);
+#define mem_ReadByte(cs,A) ((UINT8)(cs)->program->read_byte(A)); CYCLES_PASSED(4);
+#define mem_WriteByte(cs,A,V) ((cs)->program->write_byte(A,V)); CYCLES_PASSED(4);
+
+INLINE UINT8 mem_ReadOp(lr35902_state *cpustate)
+{
+ UINT8 r = mem_ReadByte (cpustate, cpustate->PC++);
+ return r;
+}
INLINE UINT16 mem_ReadWord (lr35902_state *cpustate, UINT32 address)
{
@@ -150,10 +129,10 @@ static CPU_INIT( lr35902 )
{
lr35902_state *cpustate = get_safe_token(device);
- cpustate->w.config = (const lr35902_cpu_core *) device->static_config();
- cpustate->w.irq_callback = irqcallback;
- cpustate->w.device = device;
- cpustate->w.program = device->space(AS_PROGRAM);
+ cpustate->config = (const lr35902_cpu_core *) device->static_config();
+ cpustate->irq_callback = irqcallback;
+ cpustate->device = device;
+ cpustate->program = device->space(AS_PROGRAM);
}
/*** Reset lr353902 registers: ******************************/
@@ -165,52 +144,60 @@ static CPU_RESET( lr35902 )
{
lr35902_state *cpustate = get_safe_token(device);
- cpustate->w.AF = 0x0000;
- cpustate->w.BC = 0x0000;
- cpustate->w.DE = 0x0000;
- cpustate->w.HL = 0x0000;
- cpustate->w.SP = 0x0000;
- cpustate->w.PC = 0x0000;
- cpustate->w.timer_expired_func = NULL;
- cpustate->w.features = LR35902_FEATURE_HALT_BUG;
- if (cpustate->w.config)
+ cpustate->A = 0x00;
+ cpustate->F = 0x00;
+ cpustate->B = 0x00;
+ cpustate->C = 0x00;
+ cpustate->D = 0x00;
+ cpustate->E = 0x00;
+ cpustate->H = 0x00;
+ cpustate->L = 0x00;
+ cpustate->SP = 0x0000;
+ cpustate->PC = 0x0000;
+ cpustate->timer_expired_func = NULL;
+ cpustate->features = LR35902_FEATURE_HALT_BUG;
+ if (cpustate->config)
{
- if ( cpustate->w.config->regs ) {
- cpustate->w.AF = cpustate->w.config->regs[0];
- cpustate->w.BC = cpustate->w.config->regs[1];
- cpustate->w.DE = cpustate->w.config->regs[2];
- cpustate->w.HL = cpustate->w.config->regs[3];
- cpustate->w.SP = cpustate->w.config->regs[4];
- cpustate->w.PC = cpustate->w.config->regs[5];
+ if ( cpustate->config->regs ) {
+ cpustate->A = cpustate->config->regs[0] >> 8;
+ cpustate->F = cpustate->config->regs[0] & 0xFF;
+ cpustate->B = cpustate->config->regs[1] >> 8;
+ cpustate->C = cpustate->config->regs[1] & 0xFF;
+ cpustate->D = cpustate->config->regs[2] >> 8;
+ cpustate->E = cpustate->config->regs[2] & 0xFF;
+ cpustate->H = cpustate->config->regs[3] >> 8;
+ cpustate->L = cpustate->config->regs[3] & 0xFF;
+ cpustate->SP = cpustate->config->regs[4];
+ cpustate->PC = cpustate->config->regs[5];
}
- cpustate->w.timer_expired_func = cpustate->w.config->timer_expired_func;
- cpustate->w.features = cpustate->w.config->features;
+ cpustate->timer_expired_func = cpustate->config->timer_expired_func;
+ cpustate->features = cpustate->config->features;
}
- cpustate->w.enable = 0;
- cpustate->w.IE = 0;
- cpustate->w.IF = 0;
-
- cpustate->w.execution_state = 0;
- cpustate->w.doHALTbug = 0;
- cpustate->w.ei_delay = 0;
- cpustate->w.gb_speed_change_pending = 0;
- cpustate->w.gb_speed = 1;
+ cpustate->enable = 0;
+ cpustate->IE = 0;
+ cpustate->IF = 0;
+
+ cpustate->execution_state = 0;
+ cpustate->doHALTbug = 0;
+ cpustate->ei_delay = 0;
+ cpustate->gb_speed_change_pending = 0;
+ cpustate->gb_speed = 1;
}
INLINE void lr35902_ProcessInterrupts (lr35902_state *cpustate)
{
- UINT8 irq = cpustate->w.IE & cpustate->w.IF;
+ UINT8 irq = cpustate->IE & cpustate->IF;
/* Interrupts should be taken after the first instruction after an EI instruction */
- if (cpustate->w.ei_delay) {
- cpustate->w.ei_delay = 0;
+ if (cpustate->ei_delay) {
+ cpustate->ei_delay = 0;
return;
}
/*
logerror("Attempting to process LR35902 Interrupt IRQ $%02X\n", irq);
- logerror("Attempting to process LR35902 Interrupt IE $%02X\n", cpustate->w.IE);
- logerror("Attempting to process LR35902 Interrupt IF $%02X\n", cpustate->w.IF);
+ logerror("Attempting to process LR35902 Interrupt IE $%02X\n", cpustate->IE);
+ logerror("Attempting to process LR35902 Interrupt IF $%02X\n", cpustate->IF);
*/
if (irq)
{
@@ -223,14 +210,14 @@ INLINE void lr35902_ProcessInterrupts (lr35902_state *cpustate)
{
if( irq & (1<<irqline) )
{
- if (cpustate->w.enable & HALTED)
+ if (cpustate->enable & HALTED)
{
- cpustate->w.enable &= ~HALTED;
- cpustate->w.PC++;
- if ( cpustate->w.features & LR35902_FEATURE_HALT_BUG ) {
- if ( ! ( cpustate->w.enable & IME ) ) {
+ cpustate->enable &= ~HALTED;
+ cpustate->PC++;
+ if ( cpustate->features & LR35902_FEATURE_HALT_BUG ) {
+ if ( ! ( cpustate->enable & IME ) ) {
/* Old cpu core (dmg/mgb/sgb) */
- cpustate->w.doHALTbug = 1;
+ cpustate->doHALTbug = 1;
}
} else {
/* New cpu core (cgb/agb/ags) */
@@ -241,16 +228,16 @@ INLINE void lr35902_ProcessInterrupts (lr35902_state *cpustate)
}
}
}
- if ( cpustate->w.enable & IME ) {
- if ( cpustate->w.irq_callback )
- (*cpustate->w.irq_callback)(cpustate->w.device, irqline);
- cpustate->w.enable &= ~IME;
- cpustate->w.IF &= ~(1 << irqline);
+ if ( cpustate->enable & IME ) {
+ if ( cpustate->irq_callback )
+ (*cpustate->irq_callback)(cpustate->device, irqline);
+ cpustate->enable &= ~IME;
+ cpustate->IF &= ~(1 << irqline);
CYCLES_PASSED( 12 );
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x40 + irqline * 8;
- /*logerror("LR35902 Interrupt PC $%04X\n", cpustate->w.PC );*/
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x40 + irqline * 8;
+ /*logerror("LR35902 Interrupt PC $%04X\n", cpustate->PC );*/
return;
}
}
@@ -268,29 +255,29 @@ static CPU_EXECUTE( lr35902 )
do
{
- if ( cpustate->w.execution_state ) {
+ if ( cpustate->execution_state ) {
UINT8 x;
/* Execute instruction */
- switch( cpustate->w.op ) {
+ switch( cpustate->op ) {
#include "opc_main.h"
}
} else {
/* Fetch and count cycles */
lr35902_ProcessInterrupts (cpustate);
- debugger_instruction_hook(device, cpustate->w.PC);
- if ( cpustate->w.enable & HALTED ) {
+ debugger_instruction_hook(device, cpustate->PC);
+ if ( cpustate->enable & HALTED ) {
CYCLES_PASSED( 4 );
- cpustate->w.execution_state = 1;
+ cpustate->execution_state = 1;
} else {
- cpustate->w.op = mem_ReadByte (cpustate, cpustate->w.PC++);
- if ( cpustate->w.doHALTbug ) {
- cpustate->w.PC--;
- cpustate->w.doHALTbug = 0;
+ cpustate->op = mem_ReadOp (cpustate);
+ if ( cpustate->doHALTbug ) {
+ cpustate->PC--;
+ cpustate->doHALTbug = 0;
}
}
}
- cpustate->w.execution_state ^= 1;
- } while (cpustate->w.icount > 0);
+ cpustate->execution_state ^= 1;
+ } while (cpustate->icount > 0);
}
static CPU_BURN( lr35902 )
@@ -301,29 +288,29 @@ static CPU_BURN( lr35902 )
{
/* NOP takes 4 cycles per instruction */
int n = (cycles + 3) / 4;
- cpustate->w.icount -= 4 * n;
+ cpustate->icount -= 4 * n;
}
}
static void lr35902_set_irq_line (lr35902_state *cpustate, int irqline, int state)
{
/*logerror("setting irq line 0x%02x state 0x%08x\n", irqline, state);*/
- //if( cpustate->w.irq_state == state )
+ //if( cpustate->irq_state == state )
// return;
- cpustate->w.irq_state = state;
+ cpustate->irq_state = state;
if( state == ASSERT_LINE )
{
- cpustate->w.IF |= (0x01 << irqline);
- /*logerror("LR35902 assert irq line %d ($%02X)\n", irqline, cpustate->w.IF);*/
+ cpustate->IF |= (0x01 << irqline);
+ /*logerror("LR35902 assert irq line %d ($%02X)\n", irqline, cpustate->IF);*/
}
else
{
- cpustate->w.IF &= ~(0x01 << irqline);
- /*logerror("LR35902 clear irq line %d ($%02X)\n", irqline, cpustate->w.IF);*/
+ cpustate->IF &= ~(0x01 << irqline);
+ /*logerror("LR35902 clear irq line %d ($%02X)\n", irqline, cpustate->IF);*/
}
}
@@ -331,7 +318,7 @@ static void lr35902_set_irq_line (lr35902_state *cpustate, int irqline, int stat
#ifdef UNUSED_FUNCTION
static void lr35902_clear_pending_interrupts (lr35902_state *cpustate)
{
- cpustate->w.IF = 0;
+ cpustate->IF = 0;
}
#endif
@@ -348,18 +335,18 @@ static CPU_SET_INFO( lr35902 )
case CPUINFO_INT_INPUT_STATE + 3:
case CPUINFO_INT_INPUT_STATE + 4: lr35902_set_irq_line(cpustate, state-CPUINFO_INT_INPUT_STATE, info->i); break;
- case CPUINFO_INT_SP: cpustate->w.SP = info->i; break;
- case CPUINFO_INT_PC: cpustate->w.PC = info->i; break;
-
- case CPUINFO_INT_REGISTER + LR35902_PC: cpustate->w.PC = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_SP: cpustate->w.SP = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_AF: cpustate->w.AF = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_BC: cpustate->w.BC = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_DE: cpustate->w.DE = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_HL: cpustate->w.HL = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_IE: cpustate->w.IE = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_IF: cpustate->w.IF = info->i; break;
- case CPUINFO_INT_REGISTER + LR35902_SPEED: cpustate->w.gb_speed_change_pending = info->i & 0x01; break;
+ case CPUINFO_INT_SP: cpustate->SP = info->i; break;
+ case CPUINFO_INT_PC: cpustate->PC = info->i; break;
+
+ case CPUINFO_INT_REGISTER + LR35902_PC: cpustate->PC = info->i; break;
+ case CPUINFO_INT_REGISTER + LR35902_SP: cpustate->SP = info->i; break;
+ case CPUINFO_INT_REGISTER + LR35902_AF: cpustate->A = info->i >> 8; cpustate->F = info->i & 0xFF; break;
+ case CPUINFO_INT_REGISTER + LR35902_BC: cpustate->B = info->i >> 8; cpustate->C = info->i & 0xFF; break;
+ case CPUINFO_INT_REGISTER + LR35902_DE: cpustate->D = info->i >> 8; cpustate->E = info->i & 0xFF; break;
+ case CPUINFO_INT_REGISTER + LR35902_HL: cpustate->H = info->i >> 8; cpustate->L = info->i & 0xFF; break;
+ case CPUINFO_INT_REGISTER + LR35902_IE: cpustate->IE = info->i; break;
+ case CPUINFO_INT_REGISTER + LR35902_IF: cpustate->IF = info->i; break;
+ case CPUINFO_INT_REGISTER + LR35902_SPEED: cpustate->gb_speed_change_pending = info->i & 0x01; break;
}
}
@@ -391,25 +378,25 @@ CPU_GET_INFO( lr35902 )
case DEVINFO_INT_ADDRBUS_WIDTH + AS_IO: info->i = 16; break;
case DEVINFO_INT_ADDRBUS_SHIFT + AS_IO: info->i = 0; break;
- case CPUINFO_INT_SP: info->i = cpustate->w.SP; break;
- case CPUINFO_INT_PC: info->i = cpustate->w.PC; break;
+ case CPUINFO_INT_SP: info->i = cpustate->SP; break;
+ case CPUINFO_INT_PC: info->i = cpustate->PC; break;
case CPUINFO_INT_PREVIOUSPC: info->i = 0; /* TODO??? */ break;
case CPUINFO_INT_INPUT_STATE + 0:
case CPUINFO_INT_INPUT_STATE + 1:
case CPUINFO_INT_INPUT_STATE + 2:
case CPUINFO_INT_INPUT_STATE + 3:
- case CPUINFO_INT_INPUT_STATE + 4: info->i = cpustate->w.IF & (1 << (state-CPUINFO_INT_INPUT_STATE)); break;
-
- case CPUINFO_INT_REGISTER + LR35902_PC: info->i = cpustate->w.PC; break;
- case CPUINFO_INT_REGISTER + LR35902_SP: info->i = cpustate->w.SP; break;
- case CPUINFO_INT_REGISTER + LR35902_AF: info->i = cpustate->w.AF; break;
- case CPUINFO_INT_REGISTER + LR35902_BC: info->i = cpustate->w.BC; break;
- case CPUINFO_INT_REGISTER + LR35902_DE: info->i = cpustate->w.DE; break;
- case CPUINFO_INT_REGISTER + LR35902_HL: info->i = cpustate->w.HL; break;
- case CPUINFO_INT_REGISTER + LR35902_IE: info->i = cpustate->w.IE; break;
- case CPUINFO_INT_REGISTER + LR35902_IF: info->i = cpustate->w.IF; break;
- case CPUINFO_INT_REGISTER + LR35902_SPEED: info->i = 0x7E | ( ( cpustate->w.gb_speed - 1 ) << 7 ) | cpustate->w.gb_speed_change_pending; break;
+ case CPUINFO_INT_INPUT_STATE + 4: info->i = cpustate->IF & (1 << (state-CPUINFO_INT_INPUT_STATE)); break;
+
+ case CPUINFO_INT_REGISTER + LR35902_PC: info->i = cpustate->PC; break;
+ case CPUINFO_INT_REGISTER + LR35902_SP: info->i = cpustate->SP; break;
+ case CPUINFO_INT_REGISTER + LR35902_AF: info->i = ( cpustate->A << 8 ) | cpustate->F; break;
+ case CPUINFO_INT_REGISTER + LR35902_BC: info->i = ( cpustate->B << 8 ) | cpustate->C; break;
+ case CPUINFO_INT_REGISTER + LR35902_DE: info->i = ( cpustate->D << 8 ) | cpustate->E; break;
+ case CPUINFO_INT_REGISTER + LR35902_HL: info->i = ( cpustate->H << 8 ) | cpustate->L; break;
+ case CPUINFO_INT_REGISTER + LR35902_IE: info->i = cpustate->IE; break;
+ case CPUINFO_INT_REGISTER + LR35902_IF: info->i = cpustate->IF; break;
+ case CPUINFO_INT_REGISTER + LR35902_SPEED: info->i = 0x7E | ( ( cpustate->gb_speed - 1 ) << 7 ) | cpustate->gb_speed_change_pending; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case CPUINFO_FCT_SET_INFO: info->setinfo = CPU_SET_INFO_NAME(lr35902); break;
@@ -418,7 +405,7 @@ CPU_GET_INFO( lr35902 )
case CPUINFO_FCT_EXECUTE: info->execute = CPU_EXECUTE_NAME(lr35902); break;
case CPUINFO_FCT_BURN: info->burn = CPU_BURN_NAME(lr35902); break;
case CPUINFO_FCT_DISASSEMBLE: info->disassemble = CPU_DISASSEMBLE_NAME(lr35902); break;
- case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->w.icount; break;
+ case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &cpustate->icount; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case DEVINFO_STR_NAME: strcpy(info->s, "LR35902"); break;
@@ -429,26 +416,26 @@ CPU_GET_INFO( lr35902 )
case CPUINFO_STR_FLAGS:
sprintf(info->s, "%c%c%c%c%c%c%c%c",
- cpustate->b.F & 0x80 ? 'Z':'.',
- cpustate->b.F & 0x40 ? 'N':'.',
- cpustate->b.F & 0x20 ? 'H':'.',
- cpustate->b.F & 0x10 ? 'C':'.',
- cpustate->b.F & 0x08 ? '3':'.',
- cpustate->b.F & 0x04 ? '2':'.',
- cpustate->b.F & 0x02 ? '1':'.',
- cpustate->b.F & 0x01 ? '0':'.');
+ cpustate->F & 0x80 ? 'Z':'.',
+ cpustate->F & 0x40 ? 'N':'.',
+ cpustate->F & 0x20 ? 'H':'.',
+ cpustate->F & 0x10 ? 'C':'.',
+ cpustate->F & 0x08 ? '3':'.',
+ cpustate->F & 0x04 ? '2':'.',
+ cpustate->F & 0x02 ? '1':'.',
+ cpustate->F & 0x01 ? '0':'.');
break;
- case CPUINFO_STR_REGISTER + LR35902_PC: sprintf(info->s, "PC:%04X", cpustate->w.PC); break;
- case CPUINFO_STR_REGISTER + LR35902_SP: sprintf(info->s, "SP:%04X", cpustate->w.SP); break;
- case CPUINFO_STR_REGISTER + LR35902_AF: sprintf(info->s, "AF:%04X", cpustate->w.AF); break;
- case CPUINFO_STR_REGISTER + LR35902_BC: sprintf(info->s, "BC:%04X", cpustate->w.BC); break;
- case CPUINFO_STR_REGISTER + LR35902_DE: sprintf(info->s, "DE:%04X", cpustate->w.DE); break;
- case CPUINFO_STR_REGISTER + LR35902_HL: sprintf(info->s, "HL:%04X", cpustate->w.HL); break;
- case CPUINFO_STR_REGISTER + LR35902_IRQ_STATE: sprintf(info->s, "IRQ:%X", cpustate->w.enable & IME ); break;
- case CPUINFO_STR_REGISTER + LR35902_IE: sprintf(info->s, "IE:%02X", cpustate->w.IE); break;
- case CPUINFO_STR_REGISTER + LR35902_IF: sprintf(info->s, "IF:%02X", cpustate->w.IF); break;
- case CPUINFO_STR_REGISTER + LR35902_SPEED: sprintf(info->s, "SPD:%02x", 0x7E | ( ( cpustate->w.gb_speed - 1 ) << 7 ) | cpustate->w.gb_speed_change_pending ); break;
+ case CPUINFO_STR_REGISTER + LR35902_PC: sprintf(info->s, "PC:%04X", cpustate->PC); break;
+ case CPUINFO_STR_REGISTER + LR35902_SP: sprintf(info->s, "SP:%04X", cpustate->SP); break;
+ case CPUINFO_STR_REGISTER + LR35902_AF: sprintf(info->s, "AF:%02X%02X", cpustate->A, cpustate->F); break;
+ case CPUINFO_STR_REGISTER + LR35902_BC: sprintf(info->s, "BC:%02X%02X", cpustate->B, cpustate->C); break;
+ case CPUINFO_STR_REGISTER + LR35902_DE: sprintf(info->s, "DE:%02X%02X", cpustate->D, cpustate->E); break;
+ case CPUINFO_STR_REGISTER + LR35902_HL: sprintf(info->s, "HL:%02X%02X", cpustate->H, cpustate->L); break;
+ case CPUINFO_STR_REGISTER + LR35902_IRQ_STATE: sprintf(info->s, "IRQ:%X", cpustate->enable & IME ); break;
+ case CPUINFO_STR_REGISTER + LR35902_IE: sprintf(info->s, "IE:%02X", cpustate->IE); break;
+ case CPUINFO_STR_REGISTER + LR35902_IF: sprintf(info->s, "IF:%02X", cpustate->IF); break;
+ case CPUINFO_STR_REGISTER + LR35902_SPEED: sprintf(info->s, "SPD:%02x", 0x7E | ( ( cpustate->gb_speed - 1 ) << 7 ) | cpustate->gb_speed_change_pending ); break;
}
}
diff --git a/src/emu/cpu/lr35902/opc_cb.h b/src/emu/cpu/lr35902/opc_cb.h
index 080aeb5478b..e2b106a610a 100644
--- a/src/emu/cpu/lr35902/opc_cb.h
+++ b/src/emu/cpu/lr35902/opc_cb.h
@@ -8,17 +8,17 @@
f=0; \
if( (x)==0 ) \
f|=FLAG_Z; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define RL_8BIT(x) \
{ \
register UINT8 r; \
r=((x)&0x80)?FLAG_C:0; \
- (x)=(UINT8)(((x)<<1)|((cpustate->b.F&FLAG_C)?1:0)); \
+ (x)=(UINT8)(((x)<<1)|((cpustate->F&FLAG_C)?1:0)); \
if( (x)==0 ) \
r|=FLAG_Z; \
- cpustate->b.F=r; \
+ cpustate->F=r; \
}
#define RRC_8BIT(x) \
@@ -31,17 +31,17 @@
f=0; \
if( (x)==0 ) \
f|=FLAG_Z; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define RR_8BIT(x) \
{ \
register UINT8 r; \
r=((x)&1)?FLAG_C:0; \
- (x)=(UINT8)(((x)>>1)|((cpustate->b.F&FLAG_C)?0x80:0)); \
+ (x)=(UINT8)(((x)>>1)|((cpustate->F&FLAG_C)?0x80:0)); \
if( (x)==0 ) \
r|=FLAG_Z; \
- cpustate->b.F=r; \
+ cpustate->F=r; \
}
#define SLA_8BIT(x) \
@@ -54,7 +54,7 @@
(x)<<=1; \
if( (x)==0 ) \
f|=FLAG_Z; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define SRA_8BIT(x) \
@@ -67,15 +67,15 @@
(x)=(UINT8)(((char)(x))>>1); \
if( (x)==0 ) \
f|=FLAG_Z; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define SWAP_8BIT(x) \
(x)=(UINT8)(((x)>>4)|((x)<<4)); \
if( (x)==0 ) \
- cpustate->b.F=FLAG_Z; \
+ cpustate->F=FLAG_Z; \
else \
- cpustate->b.F=0;
+ cpustate->F=0;
#define SRL_8BIT(x) \
@@ -88,14 +88,14 @@
(x)>>=1; \
if( (x)==0 ) \
f|=FLAG_Z; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define BIT_8BIT(n,x) \
if( (x)&(1<<(n)) ) \
- cpustate->b.F=(UINT8)(FLAG_H|(cpustate->b.F&FLAG_C)); \
+ cpustate->F=(UINT8)(FLAG_H|(cpustate->F&FLAG_C)); \
else \
- cpustate->b.F=(UINT8)(FLAG_Z|FLAG_H|(cpustate->b.F&FLAG_C));
+ cpustate->F=(UINT8)(FLAG_Z|FLAG_H|(cpustate->F&FLAG_C));
#define RES_8BIT(n,x) (x)&=~(1<<(n));
@@ -105,1336 +105,1432 @@
case 0x00:
/* RLC B */
- RLC_8BIT (cpustate->b.B)
+ RLC_8BIT (cpustate->B)
break;
case 0x01:
/* RLC C */
- RLC_8BIT (cpustate->b.C)
+ RLC_8BIT (cpustate->C)
break;
case 0x02:
/* RLC D */
- RLC_8BIT (cpustate->b.D)
+ RLC_8BIT (cpustate->D)
break;
case 0x03:
/* RLC E */
- RLC_8BIT (cpustate->b.E)
+ RLC_8BIT (cpustate->E)
break;
case 0x04:
/* RLC H */
- RLC_8BIT (cpustate->b.H)
+ RLC_8BIT (cpustate->H)
break;
case 0x05:
/* RLC L */
- RLC_8BIT (cpustate->b.L)
+ RLC_8BIT (cpustate->L)
break;
case 0x06:
- /* RLC (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RLC_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RLC (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RLC_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x07:
/* RLC A */
- RLC_8BIT (cpustate->b.A)
+ RLC_8BIT (cpustate->A)
break;
case 0x08:
/* RRC B */
- RRC_8BIT (cpustate->b.B)
+ RRC_8BIT (cpustate->B)
break;
case 0x09:
/* RRC C */
- RRC_8BIT (cpustate->b.C)
+ RRC_8BIT (cpustate->C)
break;
case 0x0A:
/* RRC D */
- RRC_8BIT (cpustate->b.D)
+ RRC_8BIT (cpustate->D)
break;
case 0x0B:
/* RRC E */
- RRC_8BIT (cpustate->b.E)
+ RRC_8BIT (cpustate->E)
break;
case 0x0C:
/* RRC H */
- RRC_8BIT (cpustate->b.H)
+ RRC_8BIT (cpustate->H)
break;
case 0x0D:
/* RRC L */
- RRC_8BIT (cpustate->b.L)
+ RRC_8BIT (cpustate->L)
break;
case 0x0E:
- /* RRC (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RRC_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RRC (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RRC_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x0F:
/* RRC A */
- RRC_8BIT (cpustate->b.A)
+ RRC_8BIT (cpustate->A)
break;
case 0x10:
/* RL B */
- RL_8BIT (cpustate->b.B)
+ RL_8BIT (cpustate->B)
break;
case 0x11:
/* RL C */
- RL_8BIT (cpustate->b.C)
+ RL_8BIT (cpustate->C)
break;
case 0x12:
/* RL D */
- RL_8BIT (cpustate->b.D)
+ RL_8BIT (cpustate->D)
break;
case 0x13:
/* RL E */
- RL_8BIT (cpustate->b.E)
+ RL_8BIT (cpustate->E)
break;
case 0x14:
/* RL H */
- RL_8BIT (cpustate->b.H)
+ RL_8BIT (cpustate->H)
break;
case 0x15:
/* RL L */
- RL_8BIT (cpustate->b.L)
+ RL_8BIT (cpustate->L)
break;
case 0x16:
- /* RL (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RL_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RL (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RL_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x17:
/* RL A */
- RL_8BIT (cpustate->b.A)
+ RL_8BIT (cpustate->A)
break;
case 0x18:
/* RR B */
- RR_8BIT (cpustate->b.B)
+ RR_8BIT (cpustate->B)
break;
case 0x19:
/* RR C */
- RR_8BIT (cpustate->b.C)
+ RR_8BIT (cpustate->C)
break;
case 0x1A:
/* RR D */
- RR_8BIT (cpustate->b.D)
+ RR_8BIT (cpustate->D)
break;
case 0x1B:
/* RR E */
- RR_8BIT (cpustate->b.E)
+ RR_8BIT (cpustate->E)
break;
case 0x1C:
/* RR H */
- RR_8BIT (cpustate->b.H)
+ RR_8BIT (cpustate->H)
break;
case 0x1D:
/* RR L */
- RR_8BIT (cpustate->b.L)
+ RR_8BIT (cpustate->L)
break;
case 0x1E:
- /* RR (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RR_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RR (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RR_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x1F:
/* RR A */
- RR_8BIT (cpustate->b.A)
+ RR_8BIT (cpustate->A)
break;
case 0x20:
/* SLA B */
- SLA_8BIT (cpustate->b.B)
+ SLA_8BIT (cpustate->B)
break;
case 0x21:
/* SLA C */
- SLA_8BIT (cpustate->b.C)
+ SLA_8BIT (cpustate->C)
break;
case 0x22:
/* SLA D */
- SLA_8BIT (cpustate->b.D)
+ SLA_8BIT (cpustate->D)
break;
case 0x23:
/* SLA E */
- SLA_8BIT (cpustate->b.E)
+ SLA_8BIT (cpustate->E)
break;
case 0x24:
/* SLA H */
- SLA_8BIT (cpustate->b.H)
+ SLA_8BIT (cpustate->H)
break;
case 0x25:
/* SLA L */
- SLA_8BIT (cpustate->b.L)
+ SLA_8BIT (cpustate->L)
break;
case 0x26:
- /* SLA (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SLA_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SLA (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SLA_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x27:
/* SLA A */
- SLA_8BIT (cpustate->b.A)
+ SLA_8BIT (cpustate->A)
break;
case 0x28:
/* SRA B */
- SRA_8BIT (cpustate->b.B)
+ SRA_8BIT (cpustate->B)
break;
case 0x29:
/* SRA C */
- SRA_8BIT (cpustate->b.C)
+ SRA_8BIT (cpustate->C)
break;
case 0x2A:
/* SRA D */
- SRA_8BIT (cpustate->b.D)
+ SRA_8BIT (cpustate->D)
break;
case 0x2B:
/* SRA E */
- SRA_8BIT (cpustate->b.E)
+ SRA_8BIT (cpustate->E)
break;
case 0x2C:
/* SRA H */
- SRA_8BIT (cpustate->b.H)
+ SRA_8BIT (cpustate->H)
break;
case 0x2D:
/* SRA L */
- SRA_8BIT (cpustate->b.L)
+ SRA_8BIT (cpustate->L)
break;
case 0x2E:
- /* SRA (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SRA_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SRA (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SRA_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x2F:
/* SRA A */
- SRA_8BIT (cpustate->b.A)
+ SRA_8BIT (cpustate->A)
break;
case 0x30:
/* SWAP B */
- SWAP_8BIT (cpustate->b.B)
+ SWAP_8BIT (cpustate->B)
break;
case 0x31:
/* SWAP C */
- SWAP_8BIT (cpustate->b.C)
+ SWAP_8BIT (cpustate->C)
break;
case 0x32:
/* SWAP D */
- SWAP_8BIT (cpustate->b.D)
+ SWAP_8BIT (cpustate->D)
break;
case 0x33:
/* SWAP E */
- SWAP_8BIT (cpustate->b.E)
+ SWAP_8BIT (cpustate->E)
break;
case 0x34:
/* SWAP H */
- SWAP_8BIT (cpustate->b.H)
+ SWAP_8BIT (cpustate->H)
break;
case 0x35:
/* SWAP L */
- SWAP_8BIT (cpustate->b.L)
+ SWAP_8BIT (cpustate->L)
break;
case 0x36:
- /* SWAP (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SWAP_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SWAP (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SWAP_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x37:
/* SWAP A */
- SWAP_8BIT (cpustate->b.A)
+ SWAP_8BIT (cpustate->A)
break;
case 0x38:
/* SRL B */
- SRL_8BIT (cpustate->b.B)
+ SRL_8BIT (cpustate->B)
break;
case 0x39:
/* SRL C */
- SRL_8BIT (cpustate->b.C)
+ SRL_8BIT (cpustate->C)
break;
case 0x3A:
/* SRL D */
- SRL_8BIT (cpustate->b.D)
+ SRL_8BIT (cpustate->D)
break;
case 0x3B:
/* SRL E */
- SRL_8BIT (cpustate->b.E)
+ SRL_8BIT (cpustate->E)
break;
case 0x3C:
/* SRL H */
- SRL_8BIT (cpustate->b.H)
+ SRL_8BIT (cpustate->H)
break;
case 0x3D:
/* SRL L */
- SRL_8BIT (cpustate->b.L)
+ SRL_8BIT (cpustate->L)
break;
case 0x3E:
- /* SRL (HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SRL_8BIT (x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SRL (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SRL_8BIT (x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x3F:
/* SRL A */
- SRL_8BIT (cpustate->b.A)
+ SRL_8BIT (cpustate->A)
break;
case 0x40:
/* BIT 0,B */
- BIT_8BIT (0, cpustate->b.B)
+ BIT_8BIT (0, cpustate->B)
break;
case 0x41:
/* BIT 0,C */
- BIT_8BIT (0, cpustate->b.C)
+ BIT_8BIT (0, cpustate->C)
break;
case 0x42:
/* BIT 0,D */
- BIT_8BIT (0, cpustate->b.D)
+ BIT_8BIT (0, cpustate->D)
break;
case 0x43:
/* BIT 0,E */
- BIT_8BIT (0, cpustate->b.E)
+ BIT_8BIT (0, cpustate->E)
break;
case 0x44:
/* BIT 0,H */
- BIT_8BIT (0, cpustate->b.H)
+ BIT_8BIT (0, cpustate->H)
break;
case 0x45:
/* BIT 0,L */
- BIT_8BIT (0, cpustate->b.L)
+ BIT_8BIT (0, cpustate->L)
break;
case 0x46:
- /* BIT 0,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (0, x)
- break;
+ /* BIT 0,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (0, x)
+ }
+ break;
case 0x47:
/* BIT 0,A */
- BIT_8BIT (0, cpustate->b.A)
+ BIT_8BIT (0, cpustate->A)
break;
case 0x48:
/* BIT 1,B */
- BIT_8BIT (1, cpustate->b.B)
+ BIT_8BIT (1, cpustate->B)
break;
case 0x49:
/* BIT 1,C */
- BIT_8BIT (1, cpustate->b.C)
+ BIT_8BIT (1, cpustate->C)
break;
case 0x4A:
/* BIT 1,D */
- BIT_8BIT (1, cpustate->b.D)
+ BIT_8BIT (1, cpustate->D)
break;
case 0x4B:
/* BIT 1,E */
- BIT_8BIT (1, cpustate->b.E)
+ BIT_8BIT (1, cpustate->E)
break;
case 0x4C:
/* BIT 1,H */
- BIT_8BIT (1, cpustate->b.H)
+ BIT_8BIT (1, cpustate->H)
break;
case 0x4D:
/* BIT 1,L */
- BIT_8BIT (1, cpustate->b.L)
+ BIT_8BIT (1, cpustate->L)
break;
case 0x4E:
- /* BIT 1,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (1, x)
- break;
+ /* BIT 1,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (1, x)
+ }
+ break;
case 0x4F:
/* BIT 1,A */
- BIT_8BIT (1, cpustate->b.A)
+ BIT_8BIT (1, cpustate->A)
break;
case 0x50:
/* BIT 2,B */
- BIT_8BIT (2, cpustate->b.B)
+ BIT_8BIT (2, cpustate->B)
break;
case 0x51:
/* BIT 2,C */
- BIT_8BIT (2, cpustate->b.C)
+ BIT_8BIT (2, cpustate->C)
break;
case 0x52:
/* BIT 2,D */
- BIT_8BIT (2, cpustate->b.D)
+ BIT_8BIT (2, cpustate->D)
break;
case 0x53:
/* BIT 2,E */
- BIT_8BIT (2, cpustate->b.E)
+ BIT_8BIT (2, cpustate->E)
break;
case 0x54:
/* BIT 2,H */
- BIT_8BIT (2, cpustate->b.H)
+ BIT_8BIT (2, cpustate->H)
break;
case 0x55:
/* BIT 2,L */
- BIT_8BIT (2, cpustate->b.L)
+ BIT_8BIT (2, cpustate->L)
break;
case 0x56:
- /* BIT 2,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (2, x)
- break;
+ /* BIT 2,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (2, x)
+ }
+ break;
case 0x57:
/* BIT 2,A */
- BIT_8BIT (2, cpustate->b.A)
+ BIT_8BIT (2, cpustate->A)
break;
case 0x58:
/* BIT 3,B */
- BIT_8BIT (3, cpustate->b.B)
+ BIT_8BIT (3, cpustate->B)
break;
case 0x59:
/* BIT 3,C */
- BIT_8BIT (3, cpustate->b.C)
+ BIT_8BIT (3, cpustate->C)
break;
case 0x5A:
/* BIT 3,D */
- BIT_8BIT (3, cpustate->b.D)
+ BIT_8BIT (3, cpustate->D)
break;
case 0x5B:
/* BIT 3,E */
- BIT_8BIT (3, cpustate->b.E)
+ BIT_8BIT (3, cpustate->E)
break;
case 0x5C:
/* BIT 3,H */
- BIT_8BIT (3, cpustate->b.H)
+ BIT_8BIT (3, cpustate->H)
break;
case 0x5D:
/* BIT 3,L */
- BIT_8BIT (3, cpustate->b.L)
+ BIT_8BIT (3, cpustate->L)
break;
case 0x5E:
- /* BIT 3,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (3, x)
- break;
+ /* BIT 3,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (3, x)
+ }
+ break;
case 0x5F:
/* BIT 3,A */
- BIT_8BIT (3, cpustate->b.A)
+ BIT_8BIT (3, cpustate->A)
break;
case 0x60:
/* BIT 4,B */
- BIT_8BIT (4, cpustate->b.B)
+ BIT_8BIT (4, cpustate->B)
break;
case 0x61:
/* BIT 4,C */
- BIT_8BIT (4, cpustate->b.C)
+ BIT_8BIT (4, cpustate->C)
break;
case 0x62:
/* BIT 4,D */
- BIT_8BIT (4, cpustate->b.D)
+ BIT_8BIT (4, cpustate->D)
break;
case 0x63:
/* BIT 4,E */
- BIT_8BIT (4, cpustate->b.E)
+ BIT_8BIT (4, cpustate->E)
break;
case 0x64:
/* BIT 4,H */
- BIT_8BIT (4, cpustate->b.H)
+ BIT_8BIT (4, cpustate->H)
break;
case 0x65:
/* BIT 4,L */
- BIT_8BIT (4, cpustate->b.L)
+ BIT_8BIT (4, cpustate->L)
break;
case 0x66:
- /* BIT 4,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (4, x)
- break;
+ /* BIT 4,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (4, x)
+ }
+ break;
case 0x67:
/* BIT 4,A */
- BIT_8BIT (4, cpustate->b.A)
+ BIT_8BIT (4, cpustate->A)
break;
case 0x68:
/* BIT 5,B */
- BIT_8BIT (5, cpustate->b.B)
+ BIT_8BIT (5, cpustate->B)
break;
case 0x69:
/* BIT 5,C */
- BIT_8BIT (5, cpustate->b.C)
+ BIT_8BIT (5, cpustate->C)
break;
case 0x6A:
/* BIT 5,D */
- BIT_8BIT (5, cpustate->b.D)
+ BIT_8BIT (5, cpustate->D)
break;
case 0x6B:
/* BIT 5,E */
- BIT_8BIT (5, cpustate->b.E)
+ BIT_8BIT (5, cpustate->E)
break;
case 0x6C:
/* BIT 5,H */
- BIT_8BIT (5, cpustate->b.H)
+ BIT_8BIT (5, cpustate->H)
break;
case 0x6D:
/* BIT 5,L */
- BIT_8BIT (5, cpustate->b.L)
+ BIT_8BIT (5, cpustate->L)
break;
case 0x6E:
- /* BIT 5,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (5, x)
- break;
+ /* BIT 5,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (5, x)
+ }
+ break;
case 0x6F:
/* BIT 5,A */
- BIT_8BIT (5, cpustate->b.A)
+ BIT_8BIT (5, cpustate->A)
break;
case 0x70:
/* BIT 6,B */
- BIT_8BIT (6, cpustate->b.B)
+ BIT_8BIT (6, cpustate->B)
break;
case 0x71:
/* BIT 6,C */
- BIT_8BIT (6, cpustate->b.C)
+ BIT_8BIT (6, cpustate->C)
break;
case 0x72:
/* BIT 6,D */
- BIT_8BIT (6, cpustate->b.D)
+ BIT_8BIT (6, cpustate->D)
break;
case 0x73:
/* BIT 6,E */
- BIT_8BIT (6, cpustate->b.E)
+ BIT_8BIT (6, cpustate->E)
break;
case 0x74:
/* BIT 6,H */
- BIT_8BIT (6, cpustate->b.H)
+ BIT_8BIT (6, cpustate->H)
break;
case 0x75:
/* BIT 6,L */
- BIT_8BIT (6, cpustate->b.L)
+ BIT_8BIT (6, cpustate->L)
break;
case 0x76:
- /* BIT 6,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (6, x)
- break;
+ /* BIT 6,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (6, x)
+ }
+ break;
case 0x77:
/* BIT 6,A */
- BIT_8BIT (6, cpustate->b.A)
+ BIT_8BIT (6, cpustate->A)
break;
case 0x78:
/* BIT 7,B */
- BIT_8BIT (7, cpustate->b.B)
+ BIT_8BIT (7, cpustate->B)
break;
case 0x79:
/* BIT 7,C */
- BIT_8BIT (7, cpustate->b.C)
+ BIT_8BIT (7, cpustate->C)
break;
case 0x7A:
/* BIT 7,D */
- BIT_8BIT (7, cpustate->b.D)
+ BIT_8BIT (7, cpustate->D)
break;
case 0x7B:
/* BIT 7,E */
- BIT_8BIT (7, cpustate->b.E)
+ BIT_8BIT (7, cpustate->E)
break;
case 0x7C:
/* BIT 7,H */
- BIT_8BIT (7, cpustate->b.H)
+ BIT_8BIT (7, cpustate->H)
break;
case 0x7D:
/* BIT 7,L */
- BIT_8BIT (7, cpustate->b.L)
+ BIT_8BIT (7, cpustate->L)
break;
case 0x7E:
- /* BIT 7,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- BIT_8BIT (7, x)
- break;
+ /* BIT 7,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ BIT_8BIT (7, x)
+ }
+ break;
case 0x7F:
/* BIT 7,A */
- BIT_8BIT (7, cpustate->b.A)
+ BIT_8BIT (7, cpustate->A)
break;
case 0x80:
/* RES 0,B */
- RES_8BIT (0, cpustate->b.B)
+ RES_8BIT (0, cpustate->B)
break;
case 0x81:
/* RES 0,C */
- RES_8BIT (0, cpustate->b.C)
+ RES_8BIT (0, cpustate->C)
break;
case 0x82:
/* RES 0,D */
- RES_8BIT (0, cpustate->b.D)
+ RES_8BIT (0, cpustate->D)
break;
case 0x83:
/* RES 0,E */
- RES_8BIT (0, cpustate->b.E)
+ RES_8BIT (0, cpustate->E)
break;
case 0x84:
/* RES 0,H */
- RES_8BIT (0, cpustate->b.H)
+ RES_8BIT (0, cpustate->H)
break;
case 0x85:
/* RES 0,L */
- RES_8BIT (0, cpustate->b.L)
+ RES_8BIT (0, cpustate->L)
break;
case 0x86:
- /* RES 0,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (0, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 0,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (0, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x87:
/* RES 0,A */
- RES_8BIT (0, cpustate->b.A)
+ RES_8BIT (0, cpustate->A)
break;
case 0x88:
/* RES 1,B */
- RES_8BIT (1, cpustate->b.B)
+ RES_8BIT (1, cpustate->B)
break;
case 0x89:
/* RES 1,C */
- RES_8BIT (1, cpustate->b.C)
+ RES_8BIT (1, cpustate->C)
break;
case 0x8A:
/* RES 1,D */
- RES_8BIT (1, cpustate->b.D)
+ RES_8BIT (1, cpustate->D)
break;
case 0x8B:
/* RES 1,E */
- RES_8BIT (1, cpustate->b.E)
+ RES_8BIT (1, cpustate->E)
break;
case 0x8C:
/* RES 1,H */
- RES_8BIT (1, cpustate->b.H)
+ RES_8BIT (1, cpustate->H)
break;
case 0x8D:
/* RES 1,L */
- RES_8BIT (1, cpustate->b.L)
+ RES_8BIT (1, cpustate->L)
break;
case 0x8E:
- /* RES 1,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (1, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 1,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (1, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x8F:
/* RES 1,A */
- RES_8BIT (1, cpustate->b.A)
+ RES_8BIT (1, cpustate->A)
break;
case 0x90:
/* RES 2,B */
- RES_8BIT (2, cpustate->b.B)
+ RES_8BIT (2, cpustate->B)
break;
case 0x91:
/* RES 2,C */
- RES_8BIT (2, cpustate->b.C)
+ RES_8BIT (2, cpustate->C)
break;
case 0x92:
/* RES 2,D */
- RES_8BIT (2, cpustate->b.D)
+ RES_8BIT (2, cpustate->D)
break;
case 0x93:
/* RES 2,E */
- RES_8BIT (2, cpustate->b.E)
+ RES_8BIT (2, cpustate->E)
break;
case 0x94:
/* RES 2,H */
- RES_8BIT (2, cpustate->b.H)
+ RES_8BIT (2, cpustate->H)
break;
case 0x95:
/* RES 2,L */
- RES_8BIT (2, cpustate->b.L)
+ RES_8BIT (2, cpustate->L)
break;
case 0x96:
- /* RES 2,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (2, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 2,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (2, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x97:
/* RES 2,A */
- RES_8BIT (2, cpustate->b.A)
+ RES_8BIT (2, cpustate->A)
break;
case 0x98:
/* RES 3,B */
- RES_8BIT (3, cpustate->b.B)
+ RES_8BIT (3, cpustate->B)
break;
case 0x99:
/* RES 3,C */
- RES_8BIT (3, cpustate->b.C)
+ RES_8BIT (3, cpustate->C)
break;
case 0x9A:
/* RES 3,D */
- RES_8BIT (3, cpustate->b.D)
+ RES_8BIT (3, cpustate->D)
break;
case 0x9B:
/* RES 3,E */
- RES_8BIT (3, cpustate->b.E)
+ RES_8BIT (3, cpustate->E)
break;
case 0x9C:
/* RES 3,H */
- RES_8BIT (3, cpustate->b.H)
+ RES_8BIT (3, cpustate->H)
break;
case 0x9D:
/* RES 3,L */
- RES_8BIT (3, cpustate->b.L)
+ RES_8BIT (3, cpustate->L)
break;
case 0x9E:
- /* RES 3,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (3, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 3,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (3, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0x9F:
/* RES 3,A */
- RES_8BIT (3, cpustate->b.A)
+ RES_8BIT (3, cpustate->A)
break;
case 0xA0:
/* RES 4,B */
- RES_8BIT (4, cpustate->b.B)
+ RES_8BIT (4, cpustate->B)
break;
case 0xA1:
/* RES 4,C */
- RES_8BIT (4, cpustate->b.C)
+ RES_8BIT (4, cpustate->C)
break;
case 0xA2:
/* RES 4,D */
- RES_8BIT (4, cpustate->b.D)
+ RES_8BIT (4, cpustate->D)
break;
case 0xA3:
/* RES 4,E */
- RES_8BIT (4, cpustate->b.E)
+ RES_8BIT (4, cpustate->E)
break;
case 0xA4:
/* RES 4,H */
- RES_8BIT (4, cpustate->b.H)
+ RES_8BIT (4, cpustate->H)
break;
case 0xA5:
/* RES 4,L */
- RES_8BIT (4, cpustate->b.L)
+ RES_8BIT (4, cpustate->L)
break;
case 0xA6:
- /* RES 4,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (4, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 4,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (4, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xA7:
/* RES 4,A */
- RES_8BIT (4, cpustate->b.A)
+ RES_8BIT (4, cpustate->A)
break;
case 0xA8:
/* RES 5,B */
- RES_8BIT (5, cpustate->b.B)
+ RES_8BIT (5, cpustate->B)
break;
case 0xA9:
/* RES 5,C */
- RES_8BIT (5, cpustate->b.C)
+ RES_8BIT (5, cpustate->C)
break;
case 0xAA:
/* RES 5,D */
- RES_8BIT (5, cpustate->b.D)
+ RES_8BIT (5, cpustate->D)
break;
case 0xAB:
/* RES 5,E */
- RES_8BIT (5, cpustate->b.E)
+ RES_8BIT (5, cpustate->E)
break;
case 0xAC:
/* RES 5,H */
- RES_8BIT (5, cpustate->b.H)
+ RES_8BIT (5, cpustate->H)
break;
case 0xAD:
/* RES 5,L */
- RES_8BIT (5, cpustate->b.L)
+ RES_8BIT (5, cpustate->L)
break;
case 0xAE:
- /* RES 5,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (5, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 5,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (5, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xAF:
/* RES 5,A */
- RES_8BIT (5, cpustate->b.A)
+ RES_8BIT (5, cpustate->A)
break;
case 0xB0:
/* RES 6,B */
- RES_8BIT (6, cpustate->b.B)
+ RES_8BIT (6, cpustate->B)
break;
case 0xB1:
/* RES 6,C */
- RES_8BIT (6, cpustate->b.C)
+ RES_8BIT (6, cpustate->C)
break;
case 0xB2:
/* RES 6,D */
- RES_8BIT (6, cpustate->b.D)
+ RES_8BIT (6, cpustate->D)
break;
case 0xB3:
/* RES 6,E */
- RES_8BIT (6, cpustate->b.E)
+ RES_8BIT (6, cpustate->E)
break;
case 0xB4:
/* RES 6,H */
- RES_8BIT (6, cpustate->b.H)
+ RES_8BIT (6, cpustate->H)
break;
case 0xB5:
/* RES 6,L */
- RES_8BIT (6, cpustate->b.L)
+ RES_8BIT (6, cpustate->L)
break;
case 0xB6:
- /* RES 6,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (6, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 6,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (6, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xB7:
/* RES 6,A */
- RES_8BIT (6, cpustate->b.A)
+ RES_8BIT (6, cpustate->A)
break;
case 0xB8:
/* RES 7,B */
- RES_8BIT (7, cpustate->b.B)
+ RES_8BIT (7, cpustate->B)
break;
case 0xB9:
/* RES 7,C */
- RES_8BIT (7, cpustate->b.C)
+ RES_8BIT (7, cpustate->C)
break;
case 0xBA:
/* RES 7,D */
- RES_8BIT (7, cpustate->b.D)
+ RES_8BIT (7, cpustate->D)
break;
case 0xBB:
/* RES 7,E */
- RES_8BIT (7, cpustate->b.E)
+ RES_8BIT (7, cpustate->E)
break;
case 0xBC:
/* RES 7,H */
- RES_8BIT (7, cpustate->b.H)
+ RES_8BIT (7, cpustate->H)
break;
case 0xBD:
/* RES 7,L */
- RES_8BIT (7, cpustate->b.L)
+ RES_8BIT (7, cpustate->L)
break;
case 0xBE:
- /* RES 7,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- RES_8BIT (7, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* RES 7,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ RES_8BIT (7, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xBF:
/* RES 7,A */
- RES_8BIT (7, cpustate->b.A)
+ RES_8BIT (7, cpustate->A)
break;
case 0xC0:
/* SET 0,B */
- SET_8BIT (0, cpustate->b.B)
+ SET_8BIT (0, cpustate->B)
break;
case 0xC1:
/* SET 0,C */
- SET_8BIT (0, cpustate->b.C)
+ SET_8BIT (0, cpustate->C)
break;
case 0xC2:
/* SET 0,D */
- SET_8BIT (0, cpustate->b.D)
+ SET_8BIT (0, cpustate->D)
break;
case 0xC3:
/* SET 0,E */
- SET_8BIT (0, cpustate->b.E)
+ SET_8BIT (0, cpustate->E)
break;
case 0xC4:
/* SET 0,H */
- SET_8BIT (0, cpustate->b.H)
+ SET_8BIT (0, cpustate->H)
break;
case 0xC5:
/* SET 0,L */
- SET_8BIT (0, cpustate->b.L)
+ SET_8BIT (0, cpustate->L)
break;
case 0xC6:
- /* SET 0,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (0, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 0,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (0, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xC7:
/* SET 0,A */
- SET_8BIT (0, cpustate->b.A)
+ SET_8BIT (0, cpustate->A)
break;
case 0xC8:
/* SET 1,B */
- SET_8BIT (1, cpustate->b.B)
+ SET_8BIT (1, cpustate->B)
break;
case 0xC9:
/* SET 1,C */
- SET_8BIT (1, cpustate->b.C)
+ SET_8BIT (1, cpustate->C)
break;
case 0xCA:
/* SET 1,D */
- SET_8BIT (1, cpustate->b.D)
+ SET_8BIT (1, cpustate->D)
break;
case 0xCB:
/* SET 1,E */
- SET_8BIT (1, cpustate->b.E)
+ SET_8BIT (1, cpustate->E)
break;
case 0xCC:
/* SET 1,H */
- SET_8BIT (1, cpustate->b.H)
+ SET_8BIT (1, cpustate->H)
break;
case 0xCD:
/* SET 1,L */
- SET_8BIT (1, cpustate->b.L)
+ SET_8BIT (1, cpustate->L)
break;
case 0xCE:
- /* SET 1,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (1, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 1,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (1, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xCF:
/* SET 1,A */
- SET_8BIT (1, cpustate->b.A)
+ SET_8BIT (1, cpustate->A)
break;
case 0xD0:
/* SET 2,B */
- SET_8BIT (2, cpustate->b.B)
+ SET_8BIT (2, cpustate->B)
break;
case 0xD1:
/* SET 2,C */
- SET_8BIT (2, cpustate->b.C)
+ SET_8BIT (2, cpustate->C)
break;
case 0xD2:
/* SET 2,D */
- SET_8BIT (2, cpustate->b.D)
+ SET_8BIT (2, cpustate->D)
break;
case 0xD3:
/* SET 2,E */
- SET_8BIT (2, cpustate->b.E)
+ SET_8BIT (2, cpustate->E)
break;
case 0xD4:
/* SET 2,H */
- SET_8BIT (2, cpustate->b.H)
+ SET_8BIT (2, cpustate->H)
break;
case 0xD5:
/* SET 2,L */
- SET_8BIT (2, cpustate->b.L)
+ SET_8BIT (2, cpustate->L)
break;
case 0xD6:
- /* SET 2,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (2, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 2,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (2, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xD7:
/* SET 2,A */
- SET_8BIT (2, cpustate->b.A)
+ SET_8BIT (2, cpustate->A)
break;
case 0xD8:
/* SET 3,B */
- SET_8BIT (3, cpustate->b.B)
+ SET_8BIT (3, cpustate->B)
break;
case 0xD9:
/* SET 3,C */
- SET_8BIT (3, cpustate->b.C)
+ SET_8BIT (3, cpustate->C)
break;
case 0xDA:
/* SET 3,D */
- SET_8BIT (3, cpustate->b.D)
+ SET_8BIT (3, cpustate->D)
break;
case 0xDB:
/* SET 3,E */
- SET_8BIT (3, cpustate->b.E)
+ SET_8BIT (3, cpustate->E)
break;
case 0xDC:
/* SET 3,H */
- SET_8BIT (3, cpustate->b.H)
+ SET_8BIT (3, cpustate->H)
break;
case 0xDD:
/* SET 3,L */
- SET_8BIT (3, cpustate->b.L)
+ SET_8BIT (3, cpustate->L)
break;
case 0xDE:
- /* SET 3,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (3, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 3,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (3, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xDF:
/* SET 3,A */
- SET_8BIT (3, cpustate->b.A)
+ SET_8BIT (3, cpustate->A)
break;
case 0xE0:
/* SET 4,B */
- SET_8BIT (4, cpustate->b.B)
+ SET_8BIT (4, cpustate->B)
break;
case 0xE1:
/* SET 4,C */
- SET_8BIT (4, cpustate->b.C)
+ SET_8BIT (4, cpustate->C)
break;
case 0xE2:
/* SET 4,D */
- SET_8BIT (4, cpustate->b.D)
+ SET_8BIT (4, cpustate->D)
break;
case 0xE3:
/* SET 4,E */
- SET_8BIT (4, cpustate->b.E)
+ SET_8BIT (4, cpustate->E)
break;
case 0xE4:
/* SET 4,H */
- SET_8BIT (4, cpustate->b.H)
+ SET_8BIT (4, cpustate->H)
break;
case 0xE5:
/* SET 4,L */
- SET_8BIT (4, cpustate->b.L)
+ SET_8BIT (4, cpustate->L)
break;
case 0xE6:
- /* SET 4,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (4, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 4,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (4, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xE7:
/* SET 4,A */
- SET_8BIT (4, cpustate->b.A)
+ SET_8BIT (4, cpustate->A)
break;
case 0xE8:
/* SET 5,B */
- SET_8BIT (5, cpustate->b.B)
+ SET_8BIT (5, cpustate->B)
break;
case 0xE9:
/* SET 5,C */
- SET_8BIT (5, cpustate->b.C)
+ SET_8BIT (5, cpustate->C)
break;
case 0xEA:
/* SET 5,D */
- SET_8BIT (5, cpustate->b.D)
+ SET_8BIT (5, cpustate->D)
break;
case 0xEB:
/* SET 5,E */
- SET_8BIT (5, cpustate->b.E)
+ SET_8BIT (5, cpustate->E)
break;
case 0xEC:
/* SET 5,H */
- SET_8BIT (5, cpustate->b.H)
+ SET_8BIT (5, cpustate->H)
break;
case 0xED:
/* SET 5,L */
- SET_8BIT (5, cpustate->b.L)
+ SET_8BIT (5, cpustate->L)
break;
case 0xEE:
- /* SET 5,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (5, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 5,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (5, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xEF:
/* SET 5,A */
- SET_8BIT (5, cpustate->b.A)
+ SET_8BIT (5, cpustate->A)
break;
case 0xF0:
/* SET 6,B */
- SET_8BIT (6, cpustate->b.B)
+ SET_8BIT (6, cpustate->B)
break;
case 0xF1:
/* SET 6,C */
- SET_8BIT (6, cpustate->b.C)
+ SET_8BIT (6, cpustate->C)
break;
case 0xF2:
/* SET 6,D */
- SET_8BIT (6, cpustate->b.D)
+ SET_8BIT (6, cpustate->D)
break;
case 0xF3:
/* SET 6,E */
- SET_8BIT (6, cpustate->b.E)
+ SET_8BIT (6, cpustate->E)
break;
case 0xF4:
/* SET 6,H */
- SET_8BIT (6, cpustate->b.H)
+ SET_8BIT (6, cpustate->H)
break;
case 0xF5:
/* SET 6,L */
- SET_8BIT (6, cpustate->b.L)
+ SET_8BIT (6, cpustate->L)
break;
case 0xF6:
- /* SET 6,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (6, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 6,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (6, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xF7:
/* SET 6,A */
- SET_8BIT (6, cpustate->b.A)
+ SET_8BIT (6, cpustate->A)
break;
case 0xF8:
/* SET 7,B */
- SET_8BIT (7, cpustate->b.B)
+ SET_8BIT (7, cpustate->B)
break;
case 0xF9:
/* SET 7,C */
- SET_8BIT (7, cpustate->b.C)
+ SET_8BIT (7, cpustate->C)
break;
case 0xFA:
/* SET 7,D */
- SET_8BIT (7, cpustate->b.D)
+ SET_8BIT (7, cpustate->D)
break;
case 0xFB:
/* SET 7,E */
- SET_8BIT (7, cpustate->b.E)
+ SET_8BIT (7, cpustate->E)
break;
case 0xFC:
/* SET 7,H */
- SET_8BIT (7, cpustate->b.H)
+ SET_8BIT (7, cpustate->H)
break;
case 0xFD:
/* SET 7,L */
- SET_8BIT (7, cpustate->b.L)
+ SET_8BIT (7, cpustate->L)
break;
case 0xFE:
- /* SET 7,(HL) */
-
- x = mem_ReadByte (cpustate, cpustate->w.HL);
- SET_8BIT (7, x)
- mem_WriteByte (cpustate, cpustate->w.HL, x);
- break;
+ /* SET 7,(HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+
+ x = mem_ReadByte (cpustate, addr);
+ SET_8BIT (7, x)
+ mem_WriteByte (cpustate, addr, x);
+ }
+ break;
case 0xFF:
/* SET 7,A */
- SET_8BIT (7, cpustate->b.A)
+ SET_8BIT (7, cpustate->A)
break;
diff --git a/src/emu/cpu/lr35902/opc_main.h b/src/emu/cpu/lr35902/opc_main.h
index 9031a27b601..f052c485120 100644
--- a/src/emu/cpu/lr35902/opc_main.h
+++ b/src/emu/cpu/lr35902/opc_main.h
@@ -3,10 +3,10 @@
register UINT8 r,f; \
x++; \
r=(x); \
- f=(UINT8)(cpustate->b.F&FLAG_C); \
+ f=(UINT8)(cpustate->F&FLAG_C); \
if( r==0 ) f|=FLAG_Z; \
if( (r&0xF)==0 ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define DEC_8BIT(x) \
@@ -14,51 +14,52 @@
register UINT8 r,f; \
x--; \
r=(x); \
- f=(UINT8)((cpustate->b.F&FLAG_C)|FLAG_N); \
+ f=(UINT8)((cpustate->F&FLAG_C)|FLAG_N); \
if( r==0 ) f|=FLAG_Z; \
if( (r&0xF)==0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define ADD_HL_RR(x) \
{ \
register UINT32 r1,r2; \
register UINT8 f; \
- r1=cpustate->w.HL+(x); \
- r2=(cpustate->w.HL&0xFFF)+((x)&0xFFF); \
- f=(UINT8)(cpustate->b.F&FLAG_Z); \
+ r1=((cpustate->H<<8)|cpustate->L)+(x); \
+ r2=(((cpustate->H<<8)|cpustate->L)&0xFFF)+((x)&0xFFF); \
+ f=(UINT8)(cpustate->F&FLAG_Z); \
if( r1>0xFFFF ) f|=FLAG_C; \
if( r2>0x0FFF ) f|=FLAG_H; \
- cpustate->w.HL=(UINT16)r1; \
- cpustate->b.F=f; \
+ cpustate->L = r1; \
+ cpustate->H = r1 >> 8; \
+ cpustate->F=f; \
}
#define ADD_A_X(x) \
{ \
register UINT16 r1,r2; \
register UINT8 f; \
- r1=(UINT16)((cpustate->b.A&0xF)+((x)&0xF)); \
- r2=(UINT16)(cpustate->b.A+(x)); \
- cpustate->b.A=(UINT8)r2; \
+ r1=(UINT16)((cpustate->A&0xF)+((x)&0xF)); \
+ r2=(UINT16)(cpustate->A+(x)); \
+ cpustate->A=(UINT8)r2; \
if( ((UINT8)r2)==0 ) f=FLAG_Z; \
else f=0; \
if( r2>0xFF ) f|=FLAG_C; \
if( r1>0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define SUB_A_X(x) \
{ \
register UINT16 r1,r2; \
register UINT8 f; \
- r1=(UINT16)((cpustate->b.A&0xF)-((x)&0xF)); \
- r2=(UINT16)(cpustate->b.A-(x)); \
- cpustate->b.A=(UINT8)r2; \
+ r1=(UINT16)((cpustate->A&0xF)-((x)&0xF)); \
+ r2=(UINT16)(cpustate->A-(x)); \
+ cpustate->A=(UINT8)r2; \
if( ((UINT8)r2)==0 ) f=FLAG_N|FLAG_Z; \
else f=FLAG_N; \
if( r2>0xFF ) f|=FLAG_C; \
if( r1>0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
/*
@@ -66,15 +67,15 @@
{ \
register UINT16 r; \
register UINT8 f; \
- r=(UINT16)(cpustate->b.A-(x)); \
+ r=(UINT16)(cpustate->A-(x)); \
if( ((UINT8)r)==0 ) \
f=FLAG_N|FLAG_Z; \
else \
f=FLAG_N; \
f|=(UINT8)((r>>8)&FLAG_C); \
- if( (r^cpustate->b.A^(x))&0x10 ) \
+ if( (r^cpustate->A^(x))&0x10 ) \
f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
*/
@@ -82,1101 +83,1137 @@
{ \
register UINT16 r1,r2; \
register UINT8 f; \
- r1=(UINT16)((cpustate->b.A&0xF)-((x)&0xF)); \
- r2=(UINT16)(cpustate->b.A-(x)); \
+ r1=(UINT16)((cpustate->A&0xF)-((x)&0xF)); \
+ r2=(UINT16)(cpustate->A-(x)); \
if( ((UINT8)r2)==0 ) f=FLAG_N|FLAG_Z; \
else f=FLAG_N; \
if( r2>0xFF ) f|=FLAG_C; \
if( r1>0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define SBC_A_X(x) \
{ \
register UINT16 r1,r2; \
register UINT8 f; \
- r1=(UINT16)((cpustate->b.A&0xF)-((x)&0xF)-((cpustate->b.F&FLAG_C)?1:0)); \
- r2=(UINT16)(cpustate->b.A-(x)-((cpustate->b.F&FLAG_C)?1:0)); \
- cpustate->b.A=(UINT8)r2; \
+ r1=(UINT16)((cpustate->A&0xF)-((x)&0xF)-((cpustate->F&FLAG_C)?1:0)); \
+ r2=(UINT16)(cpustate->A-(x)-((cpustate->F&FLAG_C)?1:0)); \
+ cpustate->A=(UINT8)r2; \
if( ((UINT8)r2)==0 ) f=FLAG_N|FLAG_Z; \
else f=FLAG_N; \
if( r2>0xFF ) f|=FLAG_C; \
if( r1>0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define ADC_A_X(x) \
{ \
register UINT16 r1,r2; \
register UINT8 f; \
- r1=(UINT16)((cpustate->b.A&0xF)+((x)&0xF)+((cpustate->b.F&FLAG_C)?1:0)); \
- r2=(UINT16)(cpustate->b.A+(x)+((cpustate->b.F&FLAG_C)?1:0)); \
- if( (cpustate->b.A=(UINT8)r2)==0 ) f=FLAG_Z; \
+ r1=(UINT16)((cpustate->A&0xF)+((x)&0xF)+((cpustate->F&FLAG_C)?1:0)); \
+ r2=(UINT16)(cpustate->A+(x)+((cpustate->F&FLAG_C)?1:0)); \
+ if( (cpustate->A=(UINT8)r2)==0 ) f=FLAG_Z; \
else f=0; \
if( r2>0xFF ) f|=FLAG_C; \
if( r1>0xF ) f|=FLAG_H; \
- cpustate->b.F=f; \
+ cpustate->F=f; \
}
#define AND_A_X(x) \
- if( (cpustate->b.A&=(x))==0 ) \
- cpustate->b.F=FLAG_H|FLAG_Z; \
+ if( (cpustate->A&=(x))==0 ) \
+ cpustate->F=FLAG_H|FLAG_Z; \
else \
- cpustate->b.F=FLAG_H;
+ cpustate->F=FLAG_H;
#define XOR_A_X(x) \
- if( (cpustate->b.A^=(x))==0 ) \
- cpustate->b.F=FLAG_Z; \
+ if( (cpustate->A^=(x))==0 ) \
+ cpustate->F=FLAG_Z; \
else \
- cpustate->b.F=0;
+ cpustate->F=0;
#define OR_A_X(x) \
- if( (cpustate->b.A|=(x))==0 ) \
- cpustate->b.F=FLAG_Z; \
+ if( (cpustate->A|=(x))==0 ) \
+ cpustate->F=FLAG_Z; \
else \
- cpustate->b.F=0;
+ cpustate->F=0;
+#define POP(x,y) \
+ y = mem_ReadByte( cpustate, cpustate->SP++ ); \
+ x = mem_ReadByte( cpustate, cpustate->SP++ );
+
+#define PUSH(x,y) \
+ cpustate->SP--; \
+ mem_WriteByte( cpustate, cpustate->SP, x ); \
+ cpustate->SP--; \
+ mem_WriteByte( cpustate, cpustate->SP, y );
case 0x00: /* NOP */
break;
case 0x01: /* LD BC,n16 */
- cpustate->w.BC = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
- break;
+ cpustate->C = mem_ReadOp (cpustate);
+ cpustate->B = mem_ReadOp (cpustate);
+ break;
case 0x02: /* LD (BC),A */
- mem_WriteByte (cpustate, cpustate->w.BC, cpustate->b.A);
+ mem_WriteByte (cpustate, ( cpustate->B << 8 ) | cpustate->C, cpustate->A);
break;
case 0x03: /* INC BC */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.B == 0xFE)
+ if (cpustate->B == 0xFE)
{
trash_sprites (state);
}
#endif
- cpustate->w.BC += 1;
+ cpustate->C++;
+ if ( cpustate->C == 0 )
+ {
+ cpustate->B++;
+ }
CYCLES_PASSED( 4 );
break;
case 0x04: /* INC B */
-
- INC_8BIT (cpustate->b.B)
- break;
+ INC_8BIT (cpustate->B)
+ break;
case 0x05: /* DEC B */
- DEC_8BIT (cpustate->b.B)
+ DEC_8BIT (cpustate->B)
break;
case 0x06: /* LD B,n8 */
- cpustate->b.B = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->B = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x07: /* RLCA */
- cpustate->b.A = (UINT8) ((cpustate->b.A << 1) | (cpustate->b.A >> 7));
- if (cpustate->b.A & 1)
+ cpustate->A = (UINT8) ((cpustate->A << 1) | (cpustate->A >> 7));
+ if (cpustate->A & 1)
{
- cpustate->b.F = FLAG_C;
+ cpustate->F = FLAG_C;
}
else
{
- cpustate->b.F = 0;
+ cpustate->F = 0;
}
break;
case 0x08: /* LD (n16),SP */
- mem_WriteWord (cpustate, mem_ReadWord (cpustate, cpustate->w.PC), cpustate->w.SP);
- cpustate->w.PC += 2;
+ mem_WriteWord (cpustate, mem_ReadWord (cpustate, cpustate->PC), cpustate->SP);
+ cpustate->PC += 2;
break;
case 0x09: /* ADD HL,BC */
- ADD_HL_RR (cpustate->w.BC)
+ ADD_HL_RR ((cpustate->B<<8)|cpustate->C)
CYCLES_PASSED( 4 );
break;
case 0x0A: /* LD A,(BC) */
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.BC);
+ cpustate->A = mem_ReadByte (cpustate, (cpustate->B<<8)|cpustate->C);
break;
case 0x0B: /* DEC BC */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.B == 0xFE)
+ if (cpustate->B == 0xFE)
{
trash_sprites (state);
}
#endif
- cpustate->w.BC -= 1;
+ cpustate->C--;
+ if ( cpustate->C == 0xFF )
+ {
+ cpustate->B--;
+ }
CYCLES_PASSED( 4 );
break;
case 0x0C: /* INC C */
- INC_8BIT (cpustate->b.C)
+ INC_8BIT (cpustate->C)
break;
case 0x0D: /* DEC C */
- DEC_8BIT (cpustate->b.C)
+ DEC_8BIT (cpustate->C)
break;
case 0x0E: /* LD C,n8 */
- cpustate->b.C = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->C = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x0F: /* RRCA */
- cpustate->b.A = (UINT8) ((cpustate->b.A >> 1) | (cpustate->b.A << 7));
- cpustate->b.F = 0;
- if (cpustate->b.A & 0x80)
+ cpustate->A = (UINT8) ((cpustate->A >> 1) | (cpustate->A << 7));
+ cpustate->F = 0;
+ if (cpustate->A & 0x80)
{
- cpustate->b.F |= FLAG_C;
+ cpustate->F |= FLAG_C;
}
break;
case 0x10: /* STOP */
- if ( cpustate->w.gb_speed_change_pending ) {
- cpustate->w.gb_speed = ( cpustate->w.gb_speed == 1 ) ? 2 : 1;
+ if ( cpustate->gb_speed_change_pending ) {
+ cpustate->gb_speed = ( cpustate->gb_speed == 1 ) ? 2 : 1;
}
- cpustate->w.gb_speed_change_pending = 0;
+ cpustate->gb_speed_change_pending = 0;
break;
case 0x11: /* LD DE,n16 */
-
- cpustate->w.DE = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
- break;
+ cpustate->E = mem_ReadOp (cpustate);
+ cpustate->D = mem_ReadOp (cpustate);
+ break;
case 0x12: /* LD (DE),A */
- mem_WriteByte (cpustate, cpustate->w.DE, cpustate->b.A);
+ mem_WriteByte (cpustate, ( cpustate->D << 8 ) | cpustate->E, cpustate->A);
break;
case 0x13: /* INC DE */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.D == 0xFE)
+ if (cpustate->D == 0xFE)
{
trash_sprites (state);
}
#endif
-
- cpustate->w.DE += 1;
+ cpustate->E++;
+ if ( cpustate->E == 0 )
+ {
+ cpustate->D++;
+ }
CYCLES_PASSED( 4 );
break;
case 0x14: /* INC D */
- INC_8BIT (cpustate->b.D)
+ INC_8BIT (cpustate->D)
break;
case 0x15: /* DEC D */
- DEC_8BIT (cpustate->b.D)
+ DEC_8BIT (cpustate->D)
break;
case 0x16: /* LD D,n8 */
- cpustate->b.D = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->D = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x17: /* RLA */
- x = (cpustate->b.A & 0x80) ? FLAG_C : 0;
+ x = (cpustate->A & 0x80) ? FLAG_C : 0;
- cpustate->b.A = (UINT8) ((cpustate->b.A << 1) | ((cpustate->b.F & FLAG_C) ? 1 : 0));
- cpustate->b.F = x;
+ cpustate->A = (UINT8) ((cpustate->A << 1) | ((cpustate->F & FLAG_C) ? 1 : 0));
+ cpustate->F = x;
break;
case 0x18: /* JR n8 */
{
INT8 offset;
- offset = mem_ReadByte (cpustate, cpustate->w.PC++);
- cpustate->w.PC += offset;
+ offset = mem_ReadByte (cpustate, cpustate->PC++);
+ cpustate->PC += offset;
CYCLES_PASSED( 4 );
}
break;
case 0x19: /* ADD HL,DE */
- ADD_HL_RR (cpustate->w.DE)
+ ADD_HL_RR (( cpustate->D << 8 ) | cpustate->E)
CYCLES_PASSED( 4 );
break;
case 0x1A: /* LD A,(DE) */
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.DE);
+ cpustate->A = mem_ReadByte (cpustate, ( cpustate->D << 8 ) | cpustate->E);
break;
case 0x1B: /* DEC DE */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.D == 0xFE)
+ if (cpustate->D == 0xFE)
{
trash_sprites (state);
}
#endif
- cpustate->w.DE -= 1;
+ cpustate->E--;
+ if ( cpustate->E == 0xFF )
+ {
+ cpustate->D--;
+ }
CYCLES_PASSED( 4 );
break;
case 0x1C: /* INC E */
- INC_8BIT (cpustate->b.E)
+ INC_8BIT (cpustate->E)
break;
case 0x1D: /* DEC E */
- DEC_8BIT (cpustate->b.E)
+ DEC_8BIT (cpustate->E)
break;
case 0x1E: /* LD E,n8 */
- cpustate->b.E = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->E = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x1F: /* RRA */
- x = (cpustate->b.A & 1) ? FLAG_C : 0;
+ x = (cpustate->A & 1) ? FLAG_C : 0;
- cpustate->b.A = (UINT8) ((cpustate->b.A >> 1) | ((cpustate->b.F & FLAG_C) ? 0x80 : 0));
- cpustate->b.F = x;
+ cpustate->A = (UINT8) ((cpustate->A >> 1) | ((cpustate->F & FLAG_C) ? 0x80 : 0));
+ cpustate->F = x;
break;
case 0x20: /* JR NZ,n8 */
{
- INT8 offset = mem_ReadByte (cpustate, cpustate->w.PC++);
- if (! (cpustate->b.F & FLAG_Z) )
+ INT8 offset = mem_ReadByte (cpustate, cpustate->PC++);
+ if (! (cpustate->F & FLAG_Z) )
{
- cpustate->w.PC += offset;
+ cpustate->PC += offset;
CYCLES_PASSED( 4 );
}
}
break;
case 0x21: /* LD HL,n16 */
-
- cpustate->w.HL = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
- break;
+ cpustate->L = mem_ReadOp (cpustate);
+ cpustate->H = mem_ReadOp (cpustate);
+ break;
case 0x22: /* LD (HL+),A */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
-
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.A);
- cpustate->w.HL += 1;
- break;
+ mem_WriteByte (cpustate, (cpustate->H << 8 ) | cpustate->L, cpustate->A);
+ cpustate->L++;
+ if ( cpustate->L == 0 )
+ {
+ cpustate->H++;
+ }
+ break;
case 0x23: /* INC HL */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
-
- cpustate->w.HL += 1;
+ cpustate->L++;
+ if ( cpustate->L == 0 )
+ {
+ cpustate->H++;
+ }
CYCLES_PASSED( 4 );
break;
case 0x24: /* INC H */
- INC_8BIT (cpustate->b.H);
+ INC_8BIT (cpustate->H);
break;
case 0x25: /* DEC H */
- DEC_8BIT (cpustate->b.H);
+ DEC_8BIT (cpustate->H);
break;
case 0x26: /* LD H,n8 */
- cpustate->b.H = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->H = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x27: /* DAA */
{
- int tmp = cpustate->b.A;
+ int tmp = cpustate->A;
- if ( ! ( cpustate->b.F & FLAG_N ) ) {
- if ( ( cpustate->b.F & FLAG_H ) || ( tmp & 0x0F ) > 9 )
+ if ( ! ( cpustate->F & FLAG_N ) ) {
+ if ( ( cpustate->F & FLAG_H ) || ( tmp & 0x0F ) > 9 )
tmp += 6;
- if ( ( cpustate->b.F & FLAG_C ) || tmp > 0x9F )
+ if ( ( cpustate->F & FLAG_C ) || tmp > 0x9F )
tmp += 0x60;
} else {
- if ( cpustate->b.F & FLAG_H ) {
+ if ( cpustate->F & FLAG_H ) {
tmp -= 6;
- if ( ! ( cpustate->b.F & FLAG_C ) )
+ if ( ! ( cpustate->F & FLAG_C ) )
tmp &= 0xFF;
}
- if ( cpustate->b.F & FLAG_C )
+ if ( cpustate->F & FLAG_C )
tmp -= 0x60;
}
- cpustate->b.F &= ~ ( FLAG_H | FLAG_Z );
+ cpustate->F &= ~ ( FLAG_H | FLAG_Z );
if ( tmp & 0x100 )
- cpustate->b.F |= FLAG_C;
- cpustate->b.A = tmp & 0xFF;
- if ( ! cpustate->b.A )
- cpustate->b.F |= FLAG_Z;
+ cpustate->F |= FLAG_C;
+ cpustate->A = tmp & 0xFF;
+ if ( ! cpustate->A )
+ cpustate->F |= FLAG_Z;
}
break;
case 0x28: /* JR Z,n8 */
{
- INT8 offset = mem_ReadByte (cpustate, cpustate->w.PC++);;
+ INT8 offset = mem_ReadByte (cpustate, cpustate->PC++);;
- if (cpustate->b.F & FLAG_Z)
+ if (cpustate->F & FLAG_Z)
{
- cpustate->w.PC += offset;
+ cpustate->PC += offset;
CYCLES_PASSED( 4 );
}
}
break;
case 0x29: /* ADD HL,HL */
- ADD_HL_RR (cpustate->w.HL)
+ ADD_HL_RR ((cpustate->H << 8 ) | cpustate->L)
CYCLES_PASSED( 4 );
break;
case 0x2A: /* LD A,(HL+) */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
-
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.HL);
- cpustate->w.HL += 1;
- break;
+ cpustate->A = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
+ cpustate->L++;
+ if ( cpustate->L == 0 )
+ {
+ cpustate->H++;
+ }
+ break;
case 0x2B: /* DEC HL */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
- cpustate->w.HL -= 1;
+ cpustate->L--;
+ if ( cpustate->L == 0xFF )
+ {
+ cpustate->H--;
+ }
CYCLES_PASSED( 4 );
break;
case 0x2C: /* INC L */
- INC_8BIT (cpustate->b.L);
+ INC_8BIT (cpustate->L);
break;
case 0x2D: /* DEC L */
- DEC_8BIT (cpustate->b.L);
+ DEC_8BIT (cpustate->L);
break;
case 0x2E: /* LD L,n8 */
- cpustate->b.L = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->L = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x2F: /* CPL */
- cpustate->b.A = ~cpustate->b.A;
- cpustate->b.F |= FLAG_N | FLAG_H;
+ cpustate->A = ~cpustate->A;
+ cpustate->F |= FLAG_N | FLAG_H;
break;
case 0x30: /* JR NC,n8 */
{
- INT8 offset = mem_ReadByte (cpustate, cpustate->w.PC++);
+ INT8 offset = mem_ReadByte (cpustate, cpustate->PC++);
- if ( ! (cpustate->b.F & FLAG_C) )
+ if ( ! (cpustate->F & FLAG_C) )
{
- cpustate->w.PC += offset;
+ cpustate->PC += offset;
CYCLES_PASSED( 4 );
}
}
break;
case 0x31: /* LD SP,n16 */
- cpustate->w.SP = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ cpustate->SP = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
break;
case 0x32: /* LD (HL-),A */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
-
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.A);
- cpustate->w.HL -= 1;
- break;
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->A);
+ cpustate->L--;
+ if ( cpustate->L == 0xFF )
+ {
+ cpustate->H--;
+ }
+ break;
case 0x33: /* INC SP */
- cpustate->w.SP += 1;
+ cpustate->SP += 1;
CYCLES_PASSED( 4 );
break;
case 0x34: /* INC (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+ register UINT8 r, f;
- {
- register UINT8 r, f;
-
- f = (UINT8) (cpustate->b.F & FLAG_C);
- r = mem_ReadByte (cpustate, cpustate->w.HL);
- r += 1;
- mem_WriteByte (cpustate, cpustate->w.HL, r);
+ f = (UINT8) (cpustate->F & FLAG_C);
+ r = mem_ReadByte (cpustate, addr);
+ r += 1;
+ mem_WriteByte (cpustate, addr, r);
- if (r == 0)
- f |= FLAG_Z;
+ if (r == 0)
+ f |= FLAG_Z;
- if ((r & 0xF) == 0)
- f |= FLAG_H;
+ if ((r & 0xF) == 0)
+ f |= FLAG_H;
- cpustate->b.F = f;
- }
- break;
+ cpustate->F = f;
+ }
+ break;
case 0x35: /* DEC (HL) */
+ {
+ UINT16 addr = ( cpustate->H << 8 ) | cpustate->L;
+ register UINT8 r, f;
- {
- register UINT8 r, f;
-
- f = (UINT8) ((cpustate->b.F & FLAG_C) | FLAG_N);
- r = mem_ReadByte (cpustate, cpustate->w.HL);
- r -= 1;
- mem_WriteByte (cpustate, cpustate->w.HL, r);
+ f = (UINT8) ((cpustate->F & FLAG_C) | FLAG_N);
+ r = mem_ReadByte (cpustate, addr);
+ r -= 1;
+ mem_WriteByte (cpustate, addr, r);
- if (r == 0)
- f |= FLAG_Z;
+ if (r == 0)
+ f |= FLAG_Z;
- if ((r & 0xF) == 0xF)
- f |= FLAG_H;
+ if ((r & 0xF) == 0xF)
+ f |= FLAG_H;
- cpustate->b.F = f;
- }
- break;
+ cpustate->F = f;
+ }
+ break;
case 0x36: /* LD (HL),n8 */
- /* FIXED / broken ? */
- {
- UINT8 v = mem_ReadByte (cpustate, cpustate->w.PC++);
- mem_WriteByte (cpustate, cpustate->w.HL, v);
- }
- break;
+ {
+ UINT8 v = mem_ReadByte (cpustate, cpustate->PC++);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, v);
+ }
+ break;
case 0x37: /* SCF */
- cpustate->b.F = (UINT8) ((cpustate->b.F & FLAG_Z) | FLAG_C);
+ cpustate->F = (UINT8) ((cpustate->F & FLAG_Z) | FLAG_C);
break;
case 0x38: /* JR C,n8 */
{
- INT8 offset = mem_ReadByte (cpustate, cpustate->w.PC++);
+ INT8 offset = mem_ReadByte (cpustate, cpustate->PC++);
- if (cpustate->b.F & FLAG_C)
+ if (cpustate->F & FLAG_C)
{
- cpustate->w.PC += offset;
+ cpustate->PC += offset;
CYCLES_PASSED( 4 );
}
}
break;
case 0x39: /* ADD HL,SP */
- ADD_HL_RR (cpustate->w.SP)
+ ADD_HL_RR (cpustate->SP)
CYCLES_PASSED( 4 );
break;
case 0x3A: /* LD A,(HL-) */
#if 0 /* FIXME ?? do we want to support this? (bug emulation) */
- if (cpustate->b.H == 0xFE)
+ if (cpustate->H == 0xFE)
{
trash_sprites (state);
}
#endif
-
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.HL);
- cpustate->w.HL -= 1;
- break;
+ cpustate->A = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
+ cpustate->L--;
+ if ( cpustate->L == 0xFF )
+ {
+ cpustate->H--;
+ }
+ break;
case 0x3B: /* DEC SP */
- cpustate->w.SP -= 1;
+ cpustate->SP -= 1;
CYCLES_PASSED( 4 );
break;
case 0x3C: /* INC A */
- INC_8BIT (cpustate->b.A);
+ INC_8BIT (cpustate->A);
break;
case 0x3D: /* DEC A */
- DEC_8BIT (cpustate->b.A);
+ DEC_8BIT (cpustate->A);
break;
case 0x3E: /* LD A,n8 */
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.PC++);
+ cpustate->A = mem_ReadByte (cpustate, cpustate->PC++);
break;
case 0x3F: /* CCF */
- cpustate->b.F = (UINT8) ((cpustate->b.F & FLAG_Z) | ((cpustate->b.F & FLAG_C) ? 0 : FLAG_C));
+ cpustate->F = (UINT8) ((cpustate->F & FLAG_Z) | ((cpustate->F & FLAG_C) ? 0 : FLAG_C));
break;
case 0x40: /* LD B,B */
break;
case 0x41: /* LD B,C */
- cpustate->b.B = cpustate->b.C;
+ cpustate->B = cpustate->C;
break;
case 0x42: /* LD B,D */
- cpustate->b.B = cpustate->b.D;
+ cpustate->B = cpustate->D;
break;
case 0x43: /* LD B,E */
- cpustate->b.B = cpustate->b.E;
+ cpustate->B = cpustate->E;
break;
case 0x44: /* LD B,H */
- cpustate->b.B = cpustate->b.H;
+ cpustate->B = cpustate->H;
break;
case 0x45: /* LD B,L */
- cpustate->b.B = cpustate->b.L;
+ cpustate->B = cpustate->L;
break;
case 0x46: /* LD B,(HL) */
- cpustate->b.B = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->B = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x47: /* LD B,A */
- cpustate->b.B = cpustate->b.A;
+ cpustate->B = cpustate->A;
break;
case 0x48: /* LD C,B */
- cpustate->b.C = cpustate->b.B;
+ cpustate->C = cpustate->B;
break;
case 0x49: /* LD C,C */
break;
case 0x4A: /* LD C,D */
- cpustate->b.C = cpustate->b.D;
+ cpustate->C = cpustate->D;
break;
case 0x4B: /* LD C,E */
- cpustate->b.C = cpustate->b.E;
+ cpustate->C = cpustate->E;
break;
case 0x4C: /* LD C,H */
- cpustate->b.C = cpustate->b.H;
+ cpustate->C = cpustate->H;
break;
case 0x4D: /* LD C,L */
- cpustate->b.C = cpustate->b.L;
+ cpustate->C = cpustate->L;
break;
case 0x4E: /* LD C,(HL) */
- cpustate->b.C = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->C = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x4F: /* LD C,A */
- cpustate->b.C = cpustate->b.A;
+ cpustate->C = cpustate->A;
break;
case 0x50: /* LD D,B */
- cpustate->b.D = cpustate->b.B;
+ cpustate->D = cpustate->B;
break;
case 0x51: /* LD D,C */
- cpustate->b.D = cpustate->b.C;
+ cpustate->D = cpustate->C;
break;
case 0x52: /* LD D,D */
break;
case 0x53: /* LD D,E */
- cpustate->b.D = cpustate->b.E;
+ cpustate->D = cpustate->E;
break;
case 0x54: /* LD D,H */
- cpustate->b.D = cpustate->b.H;
+ cpustate->D = cpustate->H;
break;
case 0x55: /* LD D,L */
- cpustate->b.D = cpustate->b.L;
+ cpustate->D = cpustate->L;
break;
case 0x56: /* LD D,(HL) */
- cpustate->b.D = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->D = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x57: /* LD D,A */
- cpustate->b.D = cpustate->b.A;
+ cpustate->D = cpustate->A;
break;
case 0x58: /* LD E,B */
- cpustate->b.E = cpustate->b.B;
+ cpustate->E = cpustate->B;
break;
case 0x59: /* LD E,C */
- cpustate->b.E = cpustate->b.C;
+ cpustate->E = cpustate->C;
break;
case 0x5A: /* LD E,D */
- cpustate->b.E = cpustate->b.D;
+ cpustate->E = cpustate->D;
break;
case 0x5B: /* LD E,E */
break;
case 0x5C: /* LD E,H */
- cpustate->b.E = cpustate->b.H;
+ cpustate->E = cpustate->H;
break;
case 0x5D: /* LD E,L */
- cpustate->b.E = cpustate->b.L;
+ cpustate->E = cpustate->L;
break;
case 0x5E: /* LD E,(HL) */
- cpustate->b.E = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->E = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x5F: /* LD E,A */
- cpustate->b.E = cpustate->b.A;
+ cpustate->E = cpustate->A;
break;
case 0x60: /* LD H,B */
- cpustate->b.H = cpustate->b.B;
+ cpustate->H = cpustate->B;
break;
case 0x61: /* LD H,C */
- cpustate->b.H = cpustate->b.C;
+ cpustate->H = cpustate->C;
break;
case 0x62: /* LD H,D */
- cpustate->b.H = cpustate->b.D;
+ cpustate->H = cpustate->D;
break;
case 0x63: /* LD H,E */
- cpustate->b.H = cpustate->b.E;
+ cpustate->H = cpustate->E;
break;
case 0x64: /* LD H,H */
break;
case 0x65: /* LD H,L */
- cpustate->b.H = cpustate->b.L;
+ cpustate->H = cpustate->L;
break;
case 0x66: /* LD H,(HL) */
- cpustate->b.H = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->H = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x67: /* LD H,A */
- cpustate->b.H = cpustate->b.A;
+ cpustate->H = cpustate->A;
break;
case 0x68: /* LD L,B */
- cpustate->b.L = cpustate->b.B;
+ cpustate->L = cpustate->B;
break;
case 0x69: /* LD L,C */
- cpustate->b.L = cpustate->b.C;
+ cpustate->L = cpustate->C;
break;
case 0x6A: /* LD L,D */
- cpustate->b.L = cpustate->b.D;
+ cpustate->L = cpustate->D;
break;
case 0x6B: /* LD L,E */
- cpustate->b.L = cpustate->b.E;
+ cpustate->L = cpustate->E;
break;
case 0x6C: /* LD L,H */
- cpustate->b.L = cpustate->b.H;
+ cpustate->L = cpustate->H;
break;
case 0x6D: /* LD L,L */
break;
case 0x6E: /* LD L,(HL) */
- cpustate->b.L = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->L = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x6F: /* LD L,A */
- cpustate->b.L = cpustate->b.A;
+ cpustate->L = cpustate->A;
break;
case 0x70: /* LD (HL),B */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.B);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->B);
break;
case 0x71: /* LD (HL),C */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.C);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->C);
break;
case 0x72: /* LD (HL),D */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.D);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->D);
break;
case 0x73: /* LD (HL),E */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.E);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->E);
break;
case 0x74: /* LD (HL),H */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.H);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->H);
break;
case 0x75: /* LD (HL),L */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.L);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->L);
break;
case 0x76: /* HALT */
- cpustate->w.enable |= HALTED;
- cpustate->w.PC--;
+ cpustate->enable |= HALTED;
+ cpustate->PC--;
break;
case 0x77: /* LD (HL),A */
- mem_WriteByte (cpustate, cpustate->w.HL, cpustate->b.A);
+ mem_WriteByte (cpustate, ( cpustate->H << 8 ) | cpustate->L, cpustate->A);
break;
case 0x78: /* LD A,B */
- cpustate->b.A = cpustate->b.B;
+ cpustate->A = cpustate->B;
break;
case 0x79: /* LD A,C */
- cpustate->b.A = cpustate->b.C;
+ cpustate->A = cpustate->C;
break;
case 0x7A: /* LD A,D */
- cpustate->b.A = cpustate->b.D;
+ cpustate->A = cpustate->D;
break;
case 0x7B: /* LD A,E */
- cpustate->b.A = cpustate->b.E;
+ cpustate->A = cpustate->E;
break;
case 0x7C: /* LD A,H */
- cpustate->b.A = cpustate->b.H;
+ cpustate->A = cpustate->H;
break;
case 0x7D: /* LD A,L */
- cpustate->b.A = cpustate->b.L;
+ cpustate->A = cpustate->L;
break;
case 0x7E: /* LD A,(HL) */
- cpustate->b.A = mem_ReadByte (cpustate, cpustate->w.HL);
+ cpustate->A = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
break;
case 0x7F: /* LD A,A */
break;
case 0x80: /* ADD A,B */
- ADD_A_X (cpustate->b.B)
+ ADD_A_X (cpustate->B)
break;
case 0x81: /* ADD A,C */
- ADD_A_X (cpustate->b.C)
+ ADD_A_X (cpustate->C)
break;
case 0x82: /* ADD A,D */
- ADD_A_X (cpustate->b.D)
+ ADD_A_X (cpustate->D)
break;
case 0x83: /* ADD A,E */
- ADD_A_X (cpustate->b.E)
+ ADD_A_X (cpustate->E)
break;
case 0x84: /* ADD A,H */
- ADD_A_X (cpustate->b.H)
+ ADD_A_X (cpustate->H)
break;
case 0x85: /* ADD A,L */
- ADD_A_X (cpustate->b.L)
+ ADD_A_X (cpustate->L)
break;
case 0x86: /* ADD A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
ADD_A_X (x)
break;
case 0x87: /* ADD A,A */
- ADD_A_X (cpustate->b.A)
+ ADD_A_X (cpustate->A)
break;
case 0x88: /* ADC A,B */
- ADC_A_X (cpustate->b.B)
+ ADC_A_X (cpustate->B)
break;
case 0x89: /* ADC A,C */
- ADC_A_X (cpustate->b.C)
+ ADC_A_X (cpustate->C)
break;
case 0x8A: /* ADC A,D */
- ADC_A_X (cpustate->b.D)
+ ADC_A_X (cpustate->D)
break;
case 0x8B: /* ADC A,E */
- ADC_A_X (cpustate->b.E)
+ ADC_A_X (cpustate->E)
break;
case 0x8C: /* ADC A,H */
- ADC_A_X (cpustate->b.H)
+ ADC_A_X (cpustate->H)
break;
case 0x8D: /* ADC A,L */
- ADC_A_X (cpustate->b.L)
+ ADC_A_X (cpustate->L)
break;
case 0x8E: /* ADC A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
ADC_A_X (x)
break;
case 0x8F: /* ADC A,A */
- ADC_A_X (cpustate->b.A)
+ ADC_A_X (cpustate->A)
break;
case 0x90: /* SUB A,B */
- SUB_A_X (cpustate->b.B)
+ SUB_A_X (cpustate->B)
break;
case 0x91: /* SUB A,C */
- SUB_A_X (cpustate->b.C)
+ SUB_A_X (cpustate->C)
break;
case 0x92: /* SUB A,D */
- SUB_A_X (cpustate->b.D)
+ SUB_A_X (cpustate->D)
break;
case 0x93: /* SUB A,E */
- SUB_A_X (cpustate->b.E)
+ SUB_A_X (cpustate->E)
break;
case 0x94: /* SUB A,H */
- SUB_A_X (cpustate->b.H)
+ SUB_A_X (cpustate->H)
break;
case 0x95: /* SUB A,L */
- SUB_A_X (cpustate->b.L)
+ SUB_A_X (cpustate->L)
break;
case 0x96: /* SUB A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
SUB_A_X (x)
break;
case 0x97: /* SUB A,A */
- SUB_A_X (cpustate->b.A)
+ SUB_A_X (cpustate->A)
break;
case 0x98: /* SBC A,B */
- SBC_A_X (cpustate->b.B)
+ SBC_A_X (cpustate->B)
break;
case 0x99: /* SBC A,C */
- SBC_A_X (cpustate->b.C)
+ SBC_A_X (cpustate->C)
break;
case 0x9A: /* SBC A,D */
- SBC_A_X (cpustate->b.D)
+ SBC_A_X (cpustate->D)
break;
case 0x9B: /* SBC A,E */
- SBC_A_X (cpustate->b.E)
+ SBC_A_X (cpustate->E)
break;
case 0x9C: /* SBC A,H */
- SBC_A_X (cpustate->b.H)
+ SBC_A_X (cpustate->H)
break;
case 0x9D: /* SBC A,L */
- SBC_A_X (cpustate->b.L)
+ SBC_A_X (cpustate->L)
break;
case 0x9E: /* SBC A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
SBC_A_X (x)
break;
case 0x9F: /* SBC A,A */
- SBC_A_X (cpustate->b.A)
+ SBC_A_X (cpustate->A)
break;
case 0xA0: /* AND A,B */
- AND_A_X (cpustate->b.B)
+ AND_A_X (cpustate->B)
break;
case 0xA1: /* AND A,C */
- AND_A_X (cpustate->b.C)
+ AND_A_X (cpustate->C)
break;
case 0xA2: /* AND A,D */
- AND_A_X (cpustate->b.D)
+ AND_A_X (cpustate->D)
break;
case 0xA3: /* AND A,E */
- AND_A_X (cpustate->b.E)
+ AND_A_X (cpustate->E)
break;
case 0xA4: /* AND A,H */
- AND_A_X (cpustate->b.H)
+ AND_A_X (cpustate->H)
break;
case 0xA5: /* AND A,L */
- AND_A_X (cpustate->b.L)
+ AND_A_X (cpustate->L)
break;
case 0xA6: /* AND A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
AND_A_X (x)
break;
case 0xA7: /* AND A,A */
- cpustate->b.F = (cpustate->b.A == 0) ? (FLAG_H | FLAG_Z) : FLAG_H;
+ cpustate->F = (cpustate->A == 0) ? (FLAG_H | FLAG_Z) : FLAG_H;
break;
case 0xA8: /* XOR A,B */
- XOR_A_X (cpustate->b.B)
+ XOR_A_X (cpustate->B)
break;
case 0xA9: /* XOR A,C */
- XOR_A_X (cpustate->b.C)
+ XOR_A_X (cpustate->C)
break;
case 0xAA: /* XOR A,D */
- XOR_A_X (cpustate->b.D)
+ XOR_A_X (cpustate->D)
break;
case 0xAB: /* XOR A,E */
- XOR_A_X (cpustate->b.E)
+ XOR_A_X (cpustate->E)
break;
case 0xAC: /* XOR A,H */
- XOR_A_X (cpustate->b.H)
+ XOR_A_X (cpustate->H)
break;
case 0xAD: /* XOR A,L */
- XOR_A_X (cpustate->b.L)
+ XOR_A_X (cpustate->L)
break;
case 0xAE: /* XOR A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
XOR_A_X (x)
break;
case 0xAF: /* XOR A,A */
- XOR_A_X (cpustate->b.A)
+ XOR_A_X (cpustate->A)
break;
case 0xB0: /* OR A,B */
- OR_A_X (cpustate->b.B)
+ OR_A_X (cpustate->B)
break;
case 0xB1: /* OR A,C */
- OR_A_X (cpustate->b.C)
+ OR_A_X (cpustate->C)
break;
case 0xB2: /* OR A,D */
- OR_A_X (cpustate->b.D)
+ OR_A_X (cpustate->D)
break;
case 0xB3: /* OR A,E */
- OR_A_X (cpustate->b.E)
+ OR_A_X (cpustate->E)
break;
case 0xB4: /* OR A,H */
- OR_A_X (cpustate->b.H)
+ OR_A_X (cpustate->H)
break;
case 0xB5: /* OR A,L */
- OR_A_X (cpustate->b.L)
+ OR_A_X (cpustate->L)
break;
case 0xB6: /* OR A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
OR_A_X (x)
break;
case 0xB7: /* OR A,A */
- OR_A_X (cpustate->b.A)
+ OR_A_X (cpustate->A)
break;
case 0xB8: /* CP A,B */
- CP_A_X (cpustate->b.B)
+ CP_A_X (cpustate->B)
break;
case 0xB9: /* CP A,C */
- CP_A_X (cpustate->b.C)
+ CP_A_X (cpustate->C)
break;
case 0xBA: /* CP A,D */
- CP_A_X (cpustate->b.D)
+ CP_A_X (cpustate->D)
break;
case 0xBB: /* CP A,E */
- CP_A_X (cpustate->b.E)
+ CP_A_X (cpustate->E)
break;
case 0xBC: /* CP A,H */
- CP_A_X (cpustate->b.H)
+ CP_A_X (cpustate->H)
break;
case 0xBD: /* CP A,L */
- CP_A_X (cpustate->b.L)
+ CP_A_X (cpustate->L)
break;
case 0xBE: /* CP A,(HL) */
- x = mem_ReadByte (cpustate, cpustate->w.HL);
+ x = mem_ReadByte (cpustate, ( cpustate->H << 8 ) | cpustate->L);
CP_A_X (x)
break;
case 0xBF: /* CP A,A */
- CP_A_X (cpustate->b.A)
+ CP_A_X (cpustate->A)
break;
case 0xC0: /* RET NZ */
CYCLES_PASSED( 4 );
- if (!(cpustate->b.F & FLAG_Z))
+ if (!(cpustate->F & FLAG_Z))
{
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
CYCLES_PASSED( 4 );
}
break;
case 0xC1: /* POP BC */
-
- cpustate->w.BC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
- break;
+ POP( cpustate->B, cpustate->C );
+ break;
case 0xC2: /* JP NZ,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if ( ! (cpustate->b.F & FLAG_Z) )
+ if ( ! (cpustate->F & FLAG_Z) )
{
- cpustate->w.PC = addr;
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
break;
case 0xC3: /* JP n16 */
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.PC);
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->PC);
CYCLES_PASSED( 4 );
break;
case 0xC4: /* CALL NZ,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if ( ! (cpustate->b.F & FLAG_Z) )
+ if ( ! (cpustate->F & FLAG_Z) )
{
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = addr;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
break;
case 0xC5: /* PUSH BC */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.BC);
+ PUSH( cpustate->B, cpustate->C );
CYCLES_PASSED( 4 );
break;
case 0xC6: /* ADD A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
ADD_A_X (x)
break;
case 0xC7: /* RST 0 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0;
CYCLES_PASSED( 4 );
break;
case 0xC8: /* RET Z */
CYCLES_PASSED( 4 );
- if (cpustate->b.F & FLAG_Z)
+ if (cpustate->F & FLAG_Z)
{
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
CYCLES_PASSED( 4 );
}
break;
case 0xC9: /* RET */
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
CYCLES_PASSED( 4 );
break;
case 0xCA: /* JP Z,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if (cpustate->b.F & FLAG_Z)
+ if (cpustate->F & FLAG_Z)
{
- cpustate->w.PC = addr;
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
break;
case 0xCB: /* PREFIX! */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
switch (x)
{
#include "opc_cb.h"
@@ -1184,62 +1221,60 @@ case 0xCB: /* PREFIX! */
break;
case 0xCC: /* CALL Z,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if (cpustate->b.F & FLAG_Z)
+ if (cpustate->F & FLAG_Z)
{
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = addr;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
break;
case 0xCD: /* CALL n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = addr;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
break;
case 0xCE: /* ADC A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
ADC_A_X (x)
break;
case 0xCF: /* RST 8 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 8;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 8;
CYCLES_PASSED( 4 );
break;
case 0xD0: /* RET NC */
CYCLES_PASSED( 4 );
- if (!(cpustate->b.F & FLAG_C))
+ if (!(cpustate->F & FLAG_C))
{
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
CYCLES_PASSED( 4 );
}
break;
case 0xD1: /* POP DE */
-
- cpustate->w.DE = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
- break;
+ POP( cpustate->D, cpustate->E );
+ break;
case 0xD2: /* JP NC,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if ( ! (cpustate->b.F & FLAG_C) )
+ if ( ! (cpustate->F & FLAG_C) )
{
- cpustate->w.PC = addr;
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
@@ -1248,57 +1283,56 @@ case 0xD3: /* EH? */
break;
case 0xD4: /* CALL NC,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if ( ! (cpustate->b.F & FLAG_C) )
+ if ( ! (cpustate->F & FLAG_C) )
{
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = addr;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
break;
case 0xD5: /* PUSH DE */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.DE);
+ PUSH( cpustate->D, cpustate->E );
CYCLES_PASSED( 4 );
break;
case 0xD6: /* SUB A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
SUB_A_X (x)
break;
case 0xD7: /* RST $10 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x10;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x10;
CYCLES_PASSED( 4 );
break;
case 0xD8: /* RET C */
CYCLES_PASSED( 4 );
- if (cpustate->b.F & FLAG_C)
+ if (cpustate->F & FLAG_C)
{
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
CYCLES_PASSED( 4 );
}
break;
case 0xD9: /* RETI */
- cpustate->w.PC = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
- cpustate->w.enable |= IME;
+ cpustate->PC = mem_ReadWord (cpustate, cpustate->SP);
+ cpustate->SP += 2;
+ cpustate->enable |= IME;
CYCLES_PASSED( 4 );
break;
case 0xDA: /* JP C,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if (cpustate->b.F & FLAG_C)
+ if (cpustate->F & FLAG_C)
{
- cpustate->w.PC = addr;
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
@@ -1307,14 +1341,14 @@ case 0xDB: /* EH? */
break;
case 0xDC: /* CALL C,n16 */
{
- UINT16 addr = mem_ReadWord (cpustate, cpustate->w.PC);
- cpustate->w.PC += 2;
+ UINT16 addr = mem_ReadWord (cpustate, cpustate->PC);
+ cpustate->PC += 2;
- if (cpustate->b.F & FLAG_C)
+ if (cpustate->F & FLAG_C)
{
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = addr;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = addr;
CYCLES_PASSED( 4 );
}
}
@@ -1323,48 +1357,45 @@ case 0xDD: /* EH? */
break;
case 0xDE: /* SBC A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
SBC_A_X (x)
break;
case 0xDF: /* RST $18 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x18;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x18;
CYCLES_PASSED( 4 );
break;
case 0xE0: /* LD ($FF00+n8),A */
{
- UINT8 v = mem_ReadByte (cpustate, cpustate->w.PC++);
- mem_WriteByte (cpustate, 0xFF00 + v, cpustate->b.A);
+ UINT8 v = mem_ReadByte (cpustate, cpustate->PC++);
+ mem_WriteByte (cpustate, 0xFF00 + v, cpustate->A);
}
break;
case 0xE1: /* POP HL */
-
- cpustate->w.HL = mem_ReadWord (cpustate, cpustate->w.SP);
- cpustate->w.SP += 2;
- break;
+ POP( cpustate->H, cpustate->L );
+ break;
case 0xE2: /* LD ($FF00+C),A */
- mem_WriteByte (cpustate, (UINT16) (0xFF00 + cpustate->b.C), cpustate->b.A);
+ mem_WriteByte (cpustate, (UINT16) (0xFF00 + cpustate->C), cpustate->A);
break;
case 0xE3: /* EH? */
break;
case 0xE4: /* EH? */
break;
case 0xE5: /* PUSH HL */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.HL);
+ PUSH( cpustate->H, cpustate->L );
CYCLES_PASSED( 4 );
break;
case 0xE6: /* AND A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
AND_A_X (x)
break;
case 0xE7: /* RST $20 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x20;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x20;
CYCLES_PASSED( 4 );
break;
case 0xE8: /* ADD SP,n8 */
@@ -1378,34 +1409,33 @@ case 0xE8: /* ADD SP,n8 */
{
register INT32 n;
- n = (INT8) mem_ReadByte (cpustate, cpustate->w.PC++);
+ n = (INT8) mem_ReadByte (cpustate, cpustate->PC++);
- if ( ( cpustate->w.SP & 0xFF ) + (UINT8)(n & 0xFF) > 0xFF )
+ if ( ( cpustate->SP & 0xFF ) + (UINT8)(n & 0xFF) > 0xFF )
{
- cpustate->b.F = FLAG_C;
+ cpustate->F = FLAG_C;
}
else
{
- cpustate->b.F = 0;
+ cpustate->F = 0;
}
- if ( ( cpustate->w.SP & 0x0F ) + ( n & 0x0F ) > 0x0F )
+ if ( ( cpustate->SP & 0x0F ) + ( n & 0x0F ) > 0x0F )
{
- cpustate->b.F |= FLAG_H;
+ cpustate->F |= FLAG_H;
}
- cpustate->w.SP = (UINT16) ( cpustate->w.SP + n );
+ cpustate->SP = (UINT16) ( cpustate->SP + n );
}
CYCLES_PASSED( 8 );
break;
case 0xE9: /* JP (HL) */
-
- cpustate->w.PC = cpustate->w.HL;
- break;
+ cpustate->PC = ( cpustate->H << 8 ) | cpustate->L;
+ break;
case 0xEA: /* LD (n16),A */
- mem_WriteByte (cpustate, mem_ReadWord (cpustate, cpustate->w.PC), cpustate->b.A);
- cpustate->w.PC += 2;
+ mem_WriteByte (cpustate, mem_ReadWord (cpustate, cpustate->PC), cpustate->A);
+ cpustate->PC += 2;
break;
case 0xEB: /* EH? */
break;
@@ -1415,50 +1445,49 @@ case 0xED: /* EH? */
break;
case 0xEE: /* XOR A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
XOR_A_X (x)
break;
case 0xEF: /* RST $28 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x28;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x28;
CYCLES_PASSED( 4 );
break;
case 0xF0: /* LD A,($FF00+n8) */
{
- UINT8 v = mem_ReadByte (cpustate, cpustate->w.PC++);
- cpustate->b.A = mem_ReadByte (cpustate, 0xFF00 + v);
+ UINT8 v = mem_ReadByte (cpustate, cpustate->PC++);
+ cpustate->A = mem_ReadByte (cpustate, 0xFF00 + v);
}
break;
case 0xF1: /* POP AF */
-
- cpustate->w.AF = (UINT16) (mem_ReadWord (cpustate, cpustate->w.SP) & 0xFFF0);
- cpustate->w.SP += 2;
- break;
+ POP( cpustate->A, cpustate->F );
+ cpustate->F &= 0xF0;
+ break;
case 0xF2: /* LD A,($FF00+C) */
- cpustate->b.A = mem_ReadByte (cpustate, (UINT16) (0xFF00 + cpustate->b.C));
+ cpustate->A = mem_ReadByte (cpustate, (UINT16) (0xFF00 + cpustate->C));
break;
case 0xF3: /* DI */
- cpustate->w.ei_delay = 0;
- cpustate->w.enable &= ~IME;
+ cpustate->ei_delay = 0;
+ cpustate->enable &= ~IME;
break;
case 0xF4: /* EH? */
break;
case 0xF5: /* PUSH AF */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, (UINT16) (cpustate->w.AF & 0xFFF0));
+ cpustate->F &= 0xF0;
+ PUSH( cpustate->A, cpustate->F );
CYCLES_PASSED( 4 );
break;
case 0xF6: /* OR A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
OR_A_X (x)
break;
case 0xF7: /* RST $30 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x30;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x30;
CYCLES_PASSED( 4 );
break;
case 0xF8: /* LD HL,SP+n8 */
@@ -1475,49 +1504,52 @@ case 0xF8: /* LD HL,SP+n8 */
{
register INT32 n;
- n = (INT8) mem_ReadByte (cpustate, cpustate->w.PC++);
+ n = (INT8) mem_ReadByte (cpustate, cpustate->PC++);
- if ( ( cpustate->w.SP & 0xFF ) + (UINT8)(n & 0xFF) > 0xFF )
+ if ( ( cpustate->SP & 0xFF ) + (UINT8)(n & 0xFF) > 0xFF )
{
- cpustate->b.F = FLAG_C;
+ cpustate->F = FLAG_C;
}
else
{
- cpustate->b.F = 0;
+ cpustate->F = 0;
}
- if ( ( cpustate->w.SP & 0x0F ) + ( n & 0x0F ) > 0x0F )
+ if ( ( cpustate->SP & 0x0F ) + ( n & 0x0F ) > 0x0F )
{
- cpustate->b.F |= FLAG_H;
+ cpustate->F |= FLAG_H;
}
- cpustate->w.HL = (UINT16) ( cpustate->w.SP + n );
+ UINT16 res = cpustate->SP + n;
+
+ cpustate->L = res & 0xFF;
+ cpustate->H = res >> 8;
}
CYCLES_PASSED( 4 );
break;
case 0xF9: /* LD SP,HL */
- cpustate->w.SP = cpustate->w.HL;
+ cpustate->SP = ( cpustate->H << 8 ) | cpustate->L;
CYCLES_PASSED( 4 );
break;
case 0xFA: /* LD A,(n16) */
- cpustate->b.A = mem_ReadByte (cpustate, mem_ReadWord (cpustate, cpustate->w.PC));
- cpustate->w.PC += 2;
+ cpustate->A = mem_ReadByte (cpustate, mem_ReadWord (cpustate, cpustate->PC));
+ cpustate->PC += 2;
break;
case 0xFB: /* EI */
- cpustate->w.enable |= IME;
- cpustate->w.ei_delay = 1;
+ cpustate->enable |= IME;
+ cpustate->ei_delay = 1;
break;
case 0xFC: /* EH? */
break;
case 0xFD: /* EH? */
break;
case 0xFE: /* CP A,n8 */
- x = mem_ReadByte (cpustate, cpustate->w.PC++);
+ x = mem_ReadByte (cpustate, cpustate->PC++);
CP_A_X (x)
break;
case 0xFF: /* RST $38 */
- cpustate->w.SP -= 2;
- mem_WriteWord (cpustate, cpustate->w.SP, cpustate->w.PC);
- cpustate->w.PC = 0x38;
+ cpustate->SP -= 2;
+ mem_WriteWord (cpustate, cpustate->SP, cpustate->PC);
+ cpustate->PC = 0x38;
CYCLES_PASSED( 4 );
break;