Some form of addreess mapping is currently implemented as a bunch of if conditions.
Let's abstract it properly.
Tasks
[x] Any adress-bus attached device can't be accessed directly. The only way to interact with should be via machine's get_byte, set_byte methods (perhaps worth renaming to read_byte / write_byte)
[x] read_word / write_word are just a convenience functions on machine level, not on memory-device
[x] unit tests!
[x] get rid of the current concept of Memory struct that has rom/rom fields. Separate them!
[ ] the minimalistic implementation (MOS6502_Machine) - that cen be considered as implementation of Default trait, should consist of 64kB of RAM and 6-bytes ROM for reset/irq/nmi vectors. Don't hardcoded vector addresses anymore on machine's start function.
[x] for C64 implement at least a primitive version of PLA-82S100 - the memory "bus" logic
[x] on C64 level connect CIA, RAM, ROM and VIC_II via memory address bus and don't refer to them directly from C64 logic.
[x] Make the proper use of Byte 0, that may prevent writing access at some occasions
[ ] (optional) would be great to have debugger being aware of the source of data
References:
"Address decoding", by Wilson Mines
That's rather overkill for this topic (explains address decoding on electronic level), but gives pretty good understanding how it works.
"The C64 PLA Dissected", by Thomas ’skoe’ Giesel
Full (I mean - full!) description of C64's PLA. On page 8 (section 2.6) there is good explanation of the logic - that looks like a great source of info for writing C64-specific tests
Some form of addreess mapping is currently implemented as a bunch of if conditions. Let's abstract it properly.
Tasks
get_byte
,set_byte
methods (perhaps worth renaming toread_byte
/write_byte
)read_word
/write_word
are just a convenience functions on machine level, not on memory-deviceMOS6502_Machine
) - that cen be considered as implementation ofDefault
trait, should consist of 64kB of RAM and 6-bytes ROM for reset/irq/nmi vectors. Don't hardcoded vector addresses anymore on machine's start function.References: