mirror of
https://github.com/DavidBuchanan314/6502-emu.git
synced 2024-06-16 01:29:31 +00:00
Handle zero page wraparound in ($xx,X)
* fixes line #1100: CFF4 C9 5D CMP
This commit is contained in:
parent
44dfdfaca5
commit
986a9f33b6
8
6502.c
8
6502.c
|
@ -528,7 +528,13 @@ uint8_t * get_IND()
|
||||||
uint8_t * get_XIND()
|
uint8_t * get_XIND()
|
||||||
{
|
{
|
||||||
uint16_t ptr;
|
uint16_t ptr;
|
||||||
memcpy(&ptr, get_ZPX(), sizeof(ptr));
|
ptr = ((* get_IMM()) + X) & 0xFF;
|
||||||
|
if (ptr == 0xff) { // check for wraparound in zero page
|
||||||
|
ptr = memory[ptr] + (memory[ptr & 0xff00] << 8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memcpy(&ptr, &memory[ptr], sizeof(ptr));
|
||||||
|
}
|
||||||
return &memory[ptr];
|
return &memory[ptr];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user