Minor code cleanup to make it more readable

This commit is contained in:
David Guillen Fandos 2021-11-02 21:14:38 +01:00
parent 0d864be803
commit 6f81dbad1d
1 changed files with 10 additions and 12 deletions

View File

@ -1022,17 +1022,6 @@ typedef enum
// This is pretty infrequent (returning from interrupt handlers, et al) so // This is pretty infrequent (returning from interrupt handlers, et al) so
// probably not worth optimizing for. // probably not worth optimizing for.
#define check_for_interrupts() \
if((io_registers[REG_IE] & io_registers[REG_IF]) && \
io_registers[REG_IME] && ((reg[REG_CPSR] & 0x80) == 0)) \
{ \
reg_mode[MODE_IRQ][6] = reg[REG_PC] + 4; \
spsr[MODE_IRQ] = reg[REG_CPSR]; \
reg[REG_CPSR] = 0xD2; \
address = 0x00000018; \
set_cpu_mode(MODE_IRQ); \
} \
#define generate_load_reg_pc(ireg, reg_index, pc_offset) \ #define generate_load_reg_pc(ireg, reg_index, pc_offset) \
if(reg_index == 15) \ if(reg_index == 15) \
{ \ { \
@ -1058,7 +1047,16 @@ u32 function_cc execute_spsr_restore(u32 address)
reg[REG_CPSR] = spsr[reg[CPU_MODE]]; reg[REG_CPSR] = spsr[reg[CPU_MODE]];
extract_flags(); extract_flags();
set_cpu_mode(cpu_modes[reg[REG_CPSR] & 0x1F]); set_cpu_mode(cpu_modes[reg[REG_CPSR] & 0x1F]);
check_for_interrupts();
if((io_registers[REG_IE] & io_registers[REG_IF]) &&
io_registers[REG_IME] && ((reg[REG_CPSR] & 0x80) == 0))
{
reg_mode[MODE_IRQ][6] = reg[REG_PC] + 4;
spsr[MODE_IRQ] = reg[REG_CPSR];
reg[REG_CPSR] = 0xD2;
address = 0x00000018;
set_cpu_mode(MODE_IRQ);
}
if(reg[REG_CPSR] & 0x20) if(reg[REG_CPSR] & 0x20)
address |= 0x01; address |= 0x01;