Fixing performance degrading problem
This commit is contained in:
parent
0afe500701
commit
e376b69d84
|
@ -121,10 +121,11 @@ imm##op: \
|
||||||
#define BRANCH( cond ) \
|
#define BRANCH( cond ) \
|
||||||
{ \
|
{ \
|
||||||
pc++; \
|
pc++; \
|
||||||
if ( (cond) == false ) [[likely]] {clock_count--; goto loop; } \
|
int offset = (int8_t) data; \
|
||||||
int32_t offset = (int8_t) data; \
|
int extra_clock = (pc & 0xFF) + offset; \
|
||||||
int32_t extra_clock = (pc & 0xFF) + offset; \
|
if ( !(cond) ) {clock_count--; goto loop; } \
|
||||||
pc += offset; \
|
pc += offset; \
|
||||||
|
pc = uint16_t( pc ); \
|
||||||
clock_count += (extra_clock >> 8) & 1; \
|
clock_count += (extra_clock >> 8) & 1; \
|
||||||
goto loop; \
|
goto loop; \
|
||||||
}
|
}
|
||||||
|
@ -201,7 +202,26 @@ inline void Cpu::write( nes_addr_t addr, int value )
|
||||||
}
|
}
|
||||||
|
|
||||||
// status flags
|
// status flags
|
||||||
extern uint8_t clock_table [256];
|
uint8_t clock_table [256] = {
|
||||||
|
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||||
|
7,6,2,8,3,3,5,5,3,2,2,2,4,4,6,6,// 0
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 1
|
||||||
|
6,6,2,8,3,3,5,5,4,2,2,2,4,4,6,6,// 2
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 3
|
||||||
|
6,6,2,8,3,3,5,5,3,2,2,2,3,4,6,6,// 4
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 5
|
||||||
|
6,6,2,8,3,3,5,5,4,2,2,2,5,4,6,6,// 6
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 7
|
||||||
|
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// 8
|
||||||
|
3,6,2,6,4,4,4,4,2,5,2,5,5,5,5,5,// 9
|
||||||
|
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// A
|
||||||
|
3,5,2,5,4,4,4,4,2,4,2,4,4,4,4,4,// B
|
||||||
|
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// C
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// D
|
||||||
|
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// E
|
||||||
|
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7 // F
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
__attribute__((optimize("align-functions=" _PAGE_SIZE)))
|
__attribute__((optimize("align-functions=" _PAGE_SIZE)))
|
||||||
Cpu::result_t Cpu::run ( nes_time_t end )
|
Cpu::result_t Cpu::run ( nes_time_t end )
|
||||||
|
@ -1148,24 +1168,5 @@ end:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t clock_table [256] = {
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
|
||||||
7,6,2,8,3,3,5,5,3,2,2,2,4,4,6,6,// 0
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 1
|
|
||||||
6,6,2,8,3,3,5,5,4,2,2,2,4,4,6,6,// 2
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 3
|
|
||||||
6,6,2,8,3,3,5,5,3,2,2,2,3,4,6,6,// 4
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 5
|
|
||||||
6,6,2,8,3,3,5,5,4,2,2,2,5,4,6,6,// 6
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 7
|
|
||||||
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// 8
|
|
||||||
3,6,2,6,4,4,4,4,2,5,2,5,5,5,5,5,// 9
|
|
||||||
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// A
|
|
||||||
3,5,2,5,4,4,4,4,2,4,2,4,4,4,4,4,// B
|
|
||||||
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// C
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// D
|
|
||||||
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// E
|
|
||||||
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7 // F
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace quickNES
|
} // namespace quickNES
|
Loading…
Reference in New Issue