Strange layout of Spectrum video memory
Hello,
does anyone have an idea why the Spectrum's video memory has such a strange layout? I understand that a resolution of 256x192 is an easy means to get a 4:3 picture on a standard TV without having to deal with two separate interlaced pictures. The width is a power of two, making it easier to address video memory. I also understand that the separate attributes (incl. colour clash) are a compromise to limited memory. But where does the line organisation come from, that is, those three big blocks of interlaced lines? Is it easier to generate the TV picture? Or can it be done faster? Maybe someone who knows the inner workings of the ULA can comment on this.
The reason I'm asking is that I'm currently working on a piece of (non-Spectrum) electronics that generates a TV picture. Pondering various solutions for timing etc., I quickly arrived at a resolution of 256x192 pixels with roughly the same borders the Spectrum has. This is why I thought that the Spectrum's line organisation might have some advantage, too. I just can't see it (yet). :)
Kind regards,
J?rg
does anyone have an idea why the Spectrum's video memory has such a strange layout? I understand that a resolution of 256x192 is an easy means to get a 4:3 picture on a standard TV without having to deal with two separate interlaced pictures. The width is a power of two, making it easier to address video memory. I also understand that the separate attributes (incl. colour clash) are a compromise to limited memory. But where does the line organisation come from, that is, those three big blocks of interlaced lines? Is it easier to generate the TV picture? Or can it be done faster? Maybe someone who knows the inner workings of the ULA can comment on this.
The reason I'm asking is that I'm currently working on a piece of (non-Spectrum) electronics that generates a TV picture. Pondering various solutions for timing etc., I quickly arrived at a resolution of 256x192 pixels with roughly the same borders the Spectrum has. This is why I thought that the Spectrum's line organisation might have some advantage, too. I just can't see it (yet). :)
Kind regards,
J?rg
Post edited by J?rg Pleumann on
Comments
Once you have the baseaddress you only have to increase the highbyte to place the next pixelrow from a character. For PRINT the screen is easy, for MC scrolling it is a lot harder.
PRINT TO SCREEN
LD HL,(23606) LD DE,512 ADD HL,DE EX DE,HL ; DE holds a printable char LD HL,16384 ; or any other screenposition LD B,8 LOOP LD (HL),A INC DE INH H DJNZ LOOP RETYet, I wonder if the price for this is higher complexity in the ULA while generating the TV picture? Or can the video memory still be addressed by one linear counter if I switch some address lines cleverly? Would have to try that with pen and paper...
Where t t = bits 6-7 of line no.
Y Y Y = bits 3-5 of line no.
y y y = bits 0-2 of line no.
Frankly, if I had been the designer of the Speccy, I wouldn't have chosen this layout. It's true that it optimizes 8x8 character writing used by BASIC, but for any serious machine-code programs, this stupid layout just gets in the way.
I've just had an idea: it would have been nice if the ULA had a software-controlled switch that controlled whether certain address bits should be swapped - that way, you could choose which layout ("normal" or "8x8 optimiesd) you would like the ULA to use.
_________________
Somebody please put me out of my misery :( :(.
[ This Message was edited by: GOC on 2004-08-04 12:15 ]
The software-controlled switch in the ULA might be a nice thing for clones, too. Should allow a video mode that is more games-oriented. Maybe something for the folks that are just about to build our next generation of Spectrum machines.
The reason for Sinclair using the strange scheme at all might be the old 48K Basic editor. It repaints the whole screen after you go up or down a line. It already is pretty slow, but would be even more so if printing the characters took longer.
Ok, they could have designed a real scrolling editor using the normal memory layout in the first place, but who knows what drove their decisions 20 years ago. Maybe they wanted to reuse code from the ZX 81 or so.
PS: Did you update your posting? I was just about to write "it works if you swap the YYY and yyy in one of the layouts", but then I saw that they were already swapped. Something with my eyes? :)
Yeah. I think I've found a serious bug in the forum software: if you put more than one "code" block in the same post, all blocks will be a copy of the first one, regardless of what you actually typed in them. A very nasty suprise...
I see you're from Mulheim a/d Ruhr.
In Germany there is still an active Sinclair Magazine. The editor of it lives in K?ln and will visit a dutch meeting in September.
If you like I can manage to let him pass by to visit this meeting.
When and where will the meeting take place? I'll be on the road a couple of times in September for business reasons, but if I have the time, I'd love to participate.
PS: Would also give me a chance to buy some Vla. :)
All you Germans are the same. They all want VLA from Holland. (DUBBELVLA???)
Have a look at www.WOMOTEAM.DE and contact
Wolfgang Haller. Make a note that you spoke to me. Sure he will give you a lift.
The date is 11 September from 10:00 to 16:00
More info also on HCC Sinclair website (Just GOOGLE).
Besides, it's not true that all Germans are the same and Vla is the only thing we're interested in when we visit the Netherlands. We're not that narrow-minded. We know there's also other intersting things to see in your country. Like, say, Pindakaas and those chocolate crumbs (not sure about the term, but you know what I mean) you can put on your bread. :)