mirror of
https://github.com/jborza/emu6502.git
synced 2025-02-16 17:30:27 +00:00
wraparound handling if crossing a page boundary at reading a word
This commit is contained in:
parent
d0e5449ae1
commit
94aea533a9
6
memory.c
6
memory.c
@ -12,8 +12,14 @@ word fetch_word(State6502* state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
word read_word(State6502* state, word address) {
|
word read_word(State6502* state, word address) {
|
||||||
|
if ((address & 0xFF) == 0xFF)
|
||||||
|
{
|
||||||
|
return state->memory[address] | state->memory[address - 0xFF] << 8;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return state->memory[address] | state->memory[address + 1] << 8;
|
return state->memory[address] | state->memory[address + 1] << 8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
word get_address_zero_page(State6502* state) {
|
word get_address_zero_page(State6502* state) {
|
||||||
return fetch_byte(state);
|
return fetch_byte(state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user