spjewkes / jrnz

A work-in-progress ZX Spectrum emulator
MIT License
1 stars 0 forks source link

StorageElement needs a massive rethink #27

Open spjewkes opened 5 years ago

spjewkes commented 5 years ago

StorageElement needs to be rethought in terms of accessing the bus with an address rather than holding on to a raw pointer to the bus' underlying memory array. The problem with a pointer is that we run the risk of trying to access memory beyond the array. What we should be doing is telling the StorageArray the address that we are interested in and let the bus decode it.

The issue with changing this is that we've also relied on pointers to access the memory of the registers so we'd need to expand/refine how StorageElements are created. This would likely add complexity to the copying functions but I think that's preferable to what we're currently doing.