Closed gergoerdi closed 5 years ago
Note that because we have access to dual-port block RAM, there is no need to arbitrate on writes.
One easy (but perhaps, too easy) way to implement it would be to completely suspend the CPU during drawing the visible portion of the screen. Since we run the CPU at 12x the original speed, we probably have enough time during non-visible parts to do everything.
Not sure if this would be pedagogically a useful intermediate step towards proper read arbitration.
I've implemented this in 0fb3adc3cbb by changing cpuInMem
to a Maybe
value, and passing in Nothing
when the video system is reading, once every 8 virtual (16 physical) pixels, into a shift-out register. The CPU aborts the current cycle's work in readMem
if cpuInMem
is Nothing
, and retries in the next cycle.
Get rid of doubled VRAM by simply not letting the CPU access VRAM while it is needed by the video system: