mirror of
https://github.com/DavidBuchanan314/6502-emu.git
synced 2024-12-25 22:30:50 +00:00
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()
|
||||
{
|
||||
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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user