mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
Sync with MESS
This commit is contained in:
parent
1ff793a4a8
commit
d20fa161df
@ -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->enable = 0;
|
||||
cpustate->IE = 0;
|
||||
cpustate->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->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_SP: cpustate->SP = info->i; break;
|
||||
case CPUINFO_INT_PC: cpustate->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_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_INPUT_STATE + 4: info->i = cpustate->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_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user