There are some OPcodes that will take one cycle more if during its execution they have to swap a memory page. As an example, reading a word from 0xFF will cause it to swap since it will read one byte from 0xFF and the next one from 0x100.
We need to figure out a good way of detecting when this has happened without duplicating tons of code.
i.e. should we have a function on memory.h/c named has_page_swapped that returns 1 or 0 if the page has swapped since the last read/write? I don't know. Is there a better way? Let's focus mainly on clarity and avoid dupplicate code.
All of the opcodes that need this functionality are marked with a TODO on cpu.c
There are some OPcodes that will take one cycle more if during its execution they have to swap a memory page. As an example, reading a word from
0xFFwill cause it to swap since it will read one byte from0xFFand the next one from0x100.We need to figure out a good way of detecting when this has happened without duplicating tons of code.
i.e. should we have a function on
memory.h/cnamedhas_page_swappedthat returns 1 or 0 if the page has swapped since the last read/write? I don't know. Is there a better way? Let's focus mainly on clarity and avoid dupplicate code.All of the opcodes that need this functionality are marked with a
TODOoncpu.c