Spectrum screen layout

Share graphical tips, notes and queries related to our favourite screen layout and its editors.
Post Reply
tobobobo
Berk
Posts: 6
Joined: Sun Nov 12, 2017 8:10 pm

Spectrum screen layout

Post by tobobobo » Sun Nov 12, 2017 9:13 pm

I have a question.

The Spectrum screen layout is well documented in books, websites, etc. but I’ve yet to learn WHY it’s the way it is?

Why is it in 3 x 8 rows of 8 - it’s the same amount of bytes, surely. Is it some bit-manipulation reason that makes addressing the screen addresses easier this way? ...easier than sequential like the attribute addresses?

So, yes, I get that it’s unusual, but why is it unusual?



T.
0 x

User avatar
R-Tape
Site Admin
Posts: 261
Joined: Thu Nov 09, 2017 11:46 am

Re: Spectrum screen layout

Post by R-Tape » Sun Nov 12, 2017 9:32 pm

Hopefully some experts can answer this (i.e. not me) but one of the reasons was to make printing characters easier/faster, they certainly didn't have game sprites in mind! The distance between lines within a cell is 256, so you can just increase the high byte with a single quick instruction.
0 x

Ralf
Microbot
Posts: 131
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Spectrum screen layout

Post by Ralf » Mon Nov 13, 2017 12:46 pm

I've heard it was easy to do on hardware level. And that it's described in book about ULA by Chris Smith. Unfortunately I'm crap when it comes to hardware so I won't say you more.

You must also remember that Zx Spectrum wasn't designed from the scratch. It was a development of earlier models - Z80 and Z81. I suppose it was in some way natural conitnuation to do it this way.

Besides actually many computer of the 80s had weird screen layouts and each retro communtiy complains and wonders about them. Amstrad CPC, Atari 2600, 8-bit Atari and so on. So it was nothing unusual in those days :)
0 x

User avatar
Einar Saukas
Dizzy
Posts: 64
Joined: Wed Nov 15, 2017 2:48 pm

Re: Spectrum screen layout

Post by Einar Saukas » Thu Nov 16, 2017 12:21 pm

R-Tape wrote:
Sun Nov 12, 2017 9:32 pm
Hopefully some experts can answer this (i.e. not me) but one of the reasons was to make printing characters easier/faster, they certainly didn't have game sprites in mind! The distance between lines within a cell is 256, so you can just increase the high byte with a single quick instruction.
Exactly! In theory, it's the most efficient screen layout for rendering text on screen. Keep in mind that the Spectrum was designed for "serious" applications, not games. Some computers at the time provided different screen modes for text or graphics, but the Spectrum didn't have this distinction (probably to reduce costs) and rendered text directly into graphics mode. Designers probably wanted to ensure that printing text wouldn't be noticeably slower than other computers using text mode, so the hardware was designed to optimize this operation.

Technically, when drawing a character on screen, each character byte should be placed at consecutive line positions. It takes a single instruction INC H to move to next line position within the same row. Afterwards, it takes a single instruction INC L to move to the next character position (either next column in the same row or, after reaching last column, then first column in next row). Except this layout only works for 8 rows * 32 columns = 256 characters, thus requiring 3 sections of 256 characters each.
1 x

User avatar
balford
Berk
Posts: 11
Joined: Mon Nov 13, 2017 2:01 pm

Re: Spectrum screen layout

Post by balford » Thu Nov 16, 2017 12:25 pm

For an explanation of the memory screen layout, see this page (by Chris Smith, this is the work that fed into his book):
http://www.zxdesign.info/memoryToScreen.shtml

- and for an explanation (a little technical) as to why this layout is important:
http://www.zxdesign.info/dynamicRam2.shtml

Basically this allowed the interleaving between ULA and CPU access of the lower 16K of RAM to be as efficient as was possible at the time, given the cost constraints.
1 x
Fixing ZX Spectrums in the 21st Century
https://github.com/brendanalford/zx-diagnostics

Pobulous
Berk
Posts: 2
Joined: Wed Nov 15, 2017 12:51 pm

Re: Spectrum screen layout

Post by Pobulous » Thu Nov 16, 2017 1:28 pm

I thought the main reason for splitting it into 3 sections was for ease of addressing characters.
So once you have the address of the top line of a char, then just increase the MSB to move down to the next line.
ie, if DE register pair points at the top line of char on screen, then just:
INC D
to move to the next line.

If it was all in one section, then you'd need to do:
INC D
INC D
INC D
each time.
0 x

User avatar
1024MAK
Dizzy
Posts: 51
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: Spectrum screen layout

Post by 1024MAK » Thu Nov 16, 2017 3:27 pm

The simple answer is to make the hardware simpler, hence keep the cost down (hence keep the design of the ULA and it's RAM interface as low cost as possible).

For once, the design has very little in common with the ZX80 or the ZX81. They use a completely different method of screen generation and in the RAM of a ZX80 or ZX81, there is NO pixel data (only character codes) (true for the BASIC system, but people eventually found ways round this and hi-res screens then became possible).

The software tricks are solutions to the layout of the screen, not the reason for it.

Mark
1 x

Post Reply