Handle zero page wraparound in ($xx),Y

* fixes line #3065: D95B  C9 12     CMP
This commit is contained in:
Rob McMullen 2017-12-18 12:01:18 -08:00
parent 986a9f33b6
commit 15287322f1

8
6502.c
View File

@ -541,7 +541,13 @@ uint8_t * get_XIND()
uint8_t * get_INDY()
{
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;
return &memory[ptr];
}