Ahh, the Spectrum screen pixel math, oh the memories.
Once upon a time a much younger myself obtained a dot-matrix printer that I managed to wire up to my computer. Sadly, it was meant to only print text, and having a fancy typewriter definitely wasn't very much fun to me. Somehow, I figured out that the printer actually supported defining custom fonts! After some reverse-engineering of the format I ended up with a program to slice the screen into rectangles matching printer's letter sizes (which were not 8x8 pixels, to make it extra fun) and sending them as custom font definition for each symbol of the alphabet, then printing "ABCD..."
Getting a paper printout of loading screens or in-game screenshot art was mind-blowing.
Why’s the Spectrum’s screen layout different from, say, a C64? The explanation on the page sounds a lot like the 64’s.
(Not trying to sound snarky, but curious. Hope I can learn something cool this morning!)
You want something that is easy to use for a Z80 (and not to hard to do with the custom logic chip, the "ULA").
Making each line (row) 256 bytes apart makes it fairly easy to draw characters: copy a byte over from the ROM, increase the ROM address by 1, increase the high byte of the screen address by 1, continue.
> Why’s the Spectrum’s screen layout different from, say, a C64? The explanation on the page sounds a lot like the 64’s.
This was done for some deep hardware reasons. The DRAM in ZX Spectrum was addressable in pages of 128 bytes (7 bits). So to select the address, the controller had to first select the page and then read the byte.
But due to the screen organization, the address of a pixel and the address of its attribute shared the same low 7 bits of the address (out of 14 in total) so that the CPU could address both without having to switch the page.
"Each block row subdivided into top, middle, and bottom parts Memory stores all top rows first, then middle rows, then bottom rows"
Is the key bit. If you are at mem location z which represent a point on row y and you want to read the same x position 17 rows down you can't do it by just multiplying a constant by 17 and adding it to your current z.