wraparound handling if crossing a page boundary at reading a word

This commit is contained in:
jborza 2019-05-07 20:24:16 +02:00
parent d0e5449ae1
commit 94aea533a9
1 changed files with 7 additions and 1 deletions

View File

@ -12,7 +12,13 @@ word fetch_word(State6502* state) {
}
word read_word(State6502* state, word address) {
return state->memory[address] | state->memory[address + 1] << 8;
if ((address & 0xFF) == 0xFF)
{
return state->memory[address] | state->memory[address - 0xFF] << 8;
}
else {
return state->memory[address] | state->memory[address + 1] << 8;
}
}
word get_address_zero_page(State6502* state) {