The ZX Spectrum Reverse Engineering and Clone Desgin Blog


A site dedicated to the reverse engineering of the ZX Spectrum and related projects.

< 19 of 68 >

Memory to Display Interface

Apr 12, 2007

I'm in a position where I can start thinking seriously about how I get a picture from memory onto the screen. This will involve the following processes:

  1. Get an attribute byte from memory
  2. Get a screen byte from memory
  3. Get the current border colour
  4. When scanline is within the border switch RGB output to the border colour
  5. When scanline is within display rectangle, shift bits out of the screen byte. If a 1, switch RGB output to attribute INK, if a 0 switch RGB output to attribute PAPER.

Remembering of course that when we're blanking, I must disable the RGB output.

I discussed the control signals involved in loading the attribute and screen bytes in Horizontal Timing 2. I also determined that the screen byte and its attribute byte must be available at exactly the same time if they are to be presented to the TV without any visible artifacts.

The attribute and screen bytes must be fetched sequentially from memory, and so one of them will need to be temporarily stored whilst the other is being fetched. It doesn't really matter which, but the Sinclair FAQ hints that the attribute byte is fetched first (I don't know how this was determined), so I'll do the same and store it whilst fetching the screen byte.

The easiest and probably the first place to start would be to sort out the RGB signal switching between border, ink and paper colours. So here we go...