Enough is now implemented that the ULA just needs to access the video section of RAM and display it, which should result in a nice Acorn Electron prompt. Simple right?
Originally I was expecting memory layout to be more like a regular frame buffer. Start at 0x6000 and with 8 pixels per byte and a 320 resolution, that would mean 0x6000 to 0x6027 for line one, 0x6028 through 0x6049 for line two etc
The result of this expectation was the rendering of a garbled mess although a blinking cursor did stand out, so I felt I was close.
Turns out, the memory layout is anything but linear.
Whilst the display starts at 0x6000 for the first 8 pixels, the next 8 pixels are at address 0x6008 and not 0x6001. Tired and not paying enough attention, I implemented that which resulted in…
After a good nights sleep, re-reading the AUG1 and paying a little more attention to the Mode 6 memory layout graphic, the problem was obvious.
An 8 byte stride is used for horizontal reads but each successive row is only offset by 1 byte per row until 8 rows have been output (and two blank lines) when the row is offset by a total of 320 pixels or 0x140 bytes to 0x6140 ready to display the next 8 lines and (2 blank lines) of data.
One final quirk remained
When, while displaying, the actual address of displayed byte reaches 8000H it is reset to its hardwired start address (see column "Addr" in the table above). This feature is used for hardware scrolling.
With the address wrap around logic taken care of and the memory layout accounted for, the Electron finally came to life
albeit in mode 6 only and with no keyboard, sound or cassette support.
Still, this calls for a celebratory cuppa.
Remaining tasks are to add the PS2 keyboard interface, implementing graphics modes 0 through 5, colour palette, 1MHz - 2MHz clock transition, researching the cassette interface and providing an option to load data from the SD card via the replay’s fileio interface and finally sound.
Quite a lot left to do really.
Acorn Electron Advanced User Guide. ↩︎