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()
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue