Working up the nes cpu

This commit is contained in:
Sergio Martin 2024-01-13 20:17:41 +01:00
parent e40e0c7888
commit 0240d9d1aa
1 changed files with 1 additions and 10 deletions

View File

@ -109,7 +109,7 @@ imm##op: \
pc++; \ pc++; \
int offset = (int8_t) data; \ int offset = (int8_t) data; \
int extra_clock = (pc & 0xFF) + offset; \ int extra_clock = (pc & 0xFF) + offset; \
if ( !(cond) ) goto dec_clock_loop; \ if ( !(cond) ) {clock_count--; goto loop; } \
pc += offset; \ pc += offset; \
pc = uint16_t( pc ); \ pc = uint16_t( pc ); \
clock_count += (extra_clock >> 8) & 1; \ clock_count += (extra_clock >> 8) & 1; \
@ -239,11 +239,6 @@ Nes_Cpu::result_t Nes_Cpu::run( nes_time_t end )
volatile result_t result = result_cycles; volatile result_t result = result_cycles;
#if !BLARGG_CPU_CISC
long clock_count = this->clock_count;
uint8_t* const low_mem = this->low_mem;
#endif
// registers // registers
unsigned pc = r.pc; unsigned pc = r.pc;
int sp; int sp;
@ -252,7 +247,6 @@ Nes_Cpu::result_t Nes_Cpu::run( nes_time_t end )
int x = r.x; int x = r.x;
int y = r.y; int y = r.y;
int status; int status;
int c; // carry set if (c & 0x100) != 0 int c; // carry set if (c & 0x100) != 0
int nz; // Z set if (nz & 0xFF) == 0, N set if (nz & 0x880) != 0 int nz; // Z set if (nz & 0xFF) == 0, N set if (nz & 0x880) != 0
@ -261,9 +255,6 @@ Nes_Cpu::result_t Nes_Cpu::run( nes_time_t end )
SET_STATUS( temp ); SET_STATUS( temp );
} }
goto loop;
dec_clock_loop:
clock_count--;
loop: loop:
uint8_t const* page = code_map [pc >> page_bits]; uint8_t const* page = code_map [pc >> page_bits];