Handle zero page wraparound in ($xx),Y
* fixes line #3065: D95B C9 12 CMP
This commit is contained in:
parent
986a9f33b6
commit
15287322f1
8
6502.c
8
6502.c
|
@ -541,7 +541,13 @@ uint8_t * get_XIND()
|
||||||
uint8_t * get_INDY()
|
uint8_t * get_INDY()
|
||||||
{
|
{
|
||||||
uint16_t ptr;
|
uint16_t ptr;
|
||||||
memcpy(&ptr, get_ZP(), sizeof(ptr));
|
ptr = * get_IMM();
|
||||||
|
if (ptr == 0xff) { // check for wraparound in zero page
|
||||||
|
ptr = memory[ptr] + (memory[ptr & 0xff00] << 8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memcpy(&ptr, &memory[ptr], sizeof(ptr));
|
||||||
|
}
|
||||||
ptr += Y;
|
ptr += Y;
|
||||||
return &memory[ptr];
|
return &memory[ptr];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue