Colour Clash: The Engineering Miracle of the Sinclair ZX Spectrum
paleotronic.com
paleotronic.com
My guess is that this was done to simplify and speed up character rendering. The Z80 has 8-bit registers, but 2 consecutive registers form a 16-bit register pair. E.g. you have the 8-bit registers H and L, which form the 16-bit register HL.
To get to the next horizontal character, you simply increment L, continue incrementing past 31, and you get to the start of the next character line.
To copy a font character, just increment H and write a font glyph byte to the address pointed to by HL 8 times.
The East German KC85/4 (which borrows many ideas from the Spectrum) took this idea one step further, it had a 320x256 display, also organized as separate pixel and color banks (40x256 bytes each). But the video memory was 90 degree rotated. Put a video memory address into HL, incrementing L gets you to the next vertical pixel line, and incrementing H to the next horizontal 8-pixel byte.
Each 8-bit home computer had it's own signature video memory layout, basically early attempts at hardware image compression (a bit similar to today's GPU texture compression formats).
Go here: https://floooh.github.io/tiny8bit/zx.html, select "128 BASIC", enter the following program, then start it with "run":
10 for i=0 to 7
20 poke 16384+i*256,255
30 next iFeel free to write a ticket here with reproduction steps:
https://en.wikipedia.org/wiki/Coordinating_Committee_for_Mul...
AFAIK 8-bit chips weren't really covered by this anymore during the 80's, but apparently the Amiga fell under the embargo for being 'too powerful'... probably a convenient marketing myth ;)
The Eastern countries were pretty quick to build clones of popular chips though (mostly Z80s and x86, Bulgaria also built MOS 6502 and Motorola 6800 clones).
A community center in an outer district of Budapest have organized a "micro club" every week, I can't find a definite date of when it started, this photo is titled "some time around 1986" http://gpsgames.hu/data/games/2796/2796_1.jpg Every Friday people would haul their various microcomputers to this place and swap programs and chat. Copyright ... we kind of knew it was not "legal" but noone cared.
Those were the days.
In fact, I read that one reason for the opening up of the USSR under Gorbachev was that the Soviets realized that they couldn't both maintain a totalitarian dictatorship and keep up in information technology.
(I read this stuff awhile ago and my memory of the details is vague. For example, I don't know if those policies existed in Hungary specifically.)
East Germany put a lot of effort into tech-education though. The "glorious leadership" realized that they were quickly falling behind in high-technology during the 70's, and they actually tried to fix this.
Most of the 8-bit computers that Eastern Germany started to manufacture in '84 were former 'grass-roots' designs done by hardware engineers as side projects.
When the government desperately needed cheap hardware for education, those side projects got green-lit and were developed into official projects. This is where reality kicked in again unfortunately, the limited resources of the "real-socialist economy" didn't allow for the mass production necessary to fulfill private demand, so everything that was built went to schools and universities (at least!), but also military academies.
That allowed showing bright colors against a uniform black background, which otherwise wouldn't have been possible, as the "bright" flag was set for the whole colour cell and shared for both figure and background pixels.
$50 for a CGA monitor at Trenton Computer Festival. A total bargain! But the case was made of styrofoam. And out of the box it only supported 8 colours, we had to build the logic board to apply the intensity bit to go to 16 colours.
But it turned out to be actually 15 colours, unlike normal CGA or Tandy graphics, the ‘bright’ black came out as black and not dark gray, so occasionally had issues with software that depended on the contrast between color 8 and color 0.
I was a little late to the party and without the electronics chops myself, I had to let my Amiga be bereft of 4080 of its 4096 colors.
http://www.bigbookofamigahardware.com/bboah/product.aspx?id=...
The principle is the same as the one producing colored strips in the BORDER, by changing the color really fast while the TV beam is jumping from one row to the next.
It was easy with the border, as there was a single bit defining the color (the loading routines changed it with the current value read from the tape, that's why you got the crazy border strips, and these were synchronized with the sound).
To change the main screen color though, you need to re-write the contents of the screen memory, really fast. With the limited development tools at the time, I can see how nobody got to create a graphic library as powerful as Nirvana or BiFrost.
There were people who thought of doing it, though. I remember seeing a demo which painted 1-pixel-high horizontal strips in different colors across the whole screen, syncing the border and the screen. My mind certainly was blown :-)
Perhaps it is not the raw speed but the extreme precision of the timings that were the limiting factor. I can see how the move to developing through emulators would help there, certainly. A truly amazing achievement!
The timing was solved by setting interruptions synchronized to that instant.
It's Behind You by Bob Pape - available as a free ebook in various formats at from [1].
It doesn't go into extreme technical detail but is an interesting view of how the industry worked back then.
[0] https://www.youtube.com/watch?time_continue=18&v=jiQxq98OYfA
I am amazed that decades after the Spectrum was current that clever code has been written to get more colours than previously thought possible in an 8x8 area.
However, none of this was available in the 1980's, when people actually used/played games on these home micros.
The situation was different with the ZX81. Originally this had the lamest display ever, black and white, 40 x 25 characters. Some characters were graphics, i.e. a bit like very blocky unicode. Notionally that was the best you could get. However, you could re-map the characters to RAM and in RAM you could put your own character definitions, e.g. the letter 'A' could be made to be your own 8x8 pixel black and white character. If you re-mapped every character then you could create a rudimentary 'high resolution' game environment. This technique actually required 'shadow RAM' in the 8-16K part of memory. You then had to enter characters the hard way, working out from graph paper what the binary was to be. At the time this was mind blowing. The iphone launch was nothing compared to the excitement of getting high res black and white graphics on the ZX81.
But, it was on the BBC Micro where real mind blowing stuff happened. The game Elite did something utterly crazy with graphics on the BBC B. The top part of the screen was in high res black and white and the lower dashboard/console was in chunkier four colour graphics. The Braben/Bell team had managed to not only think of switching modes mid screen, they implemented it and they did it all with genuine 3D.
This only worked on the BBC Micro, other variants of Elite were not as good as there wasn't the hardware on other systems to do truly cool stuff.
Imagine if you went to a web page and the top part had 4K monochrome video even if you didn't think your computer did 4K with the part below the video at 720p with HDR colours, with there being both modes on screen at once. You would be in awe of that, and this is the best analogy I can think of to think of what Elite did.
Elite was a 1980's game and this hardcore hacking of the display modes was available at the time and not something developed demo-scene style decades later.
Elite defied so many things that should not have been possible. As well as the funky screen modes there were things like the thousands of planets, far too many and far too detailed to fit into RAM. This was tantamount to magic.
I never felt that any of the hacks on the Spectrum had that jaw-dropping awe factor, it is a shame that the subsequent video hacks were not available at the time, in the 1980's.
The Commodore 264 family shipped this functionality built into BASIC 3.5 earlier in 1984. It can be activated with the GRAPHICS 4 command.
Before these, the Atari 400/800 had the ANTIC chip to drive the CTIA. You can actually program the ANTIC to do a lot more than just interrupts: https://archive.org/details/ataribooks-de-re-atari/page/n0
I don't know whether or not it was used on the Spectrum in the 1980's, but here is one from 1990:
https://www.youtube.com/watch?v=zBOPdiGC5EY
Though these kind of raster effects were absolutely staple of both demos and games in the early 80's on the C64, so it'd surprise me if there aren't earlier examples on the Spectrum as well. I'm not sure when exactly it became common, but e.g. pretty much all pseudo-3d racing games for the C64 used raster effects, as you can see in this video of Pole Position (1984) for example:
https://archive.org/details/C64Gamevideoarchive104-PolePosit...
There's is brief flickering of the stripes on the road at the beginning (most visible from around 15-30 seconds; when the game starts it shifts too fast to be very noticeable) - this is due to poorly timed colour changes; an interrupt handler was used to switch the background colour for the stripes, but you want to do so in the horizontal blank, and you'd regularly see them miss-time this.
I can't tell if the ZX Spectrum version of Pole Position used the same trick, or if it just flipped colour per character block:
https://www.youtube.com/watch?v=76omr-7FDXo
> But, it was on the BBC Micro where real mind blowing stuff happened. The game Elite did something utterly crazy with graphics on the BBC B. The top part of the screen was in high res black and white and the lower dashboard/console was in chunkier four colour graphics. The Braben/Bell team had managed to not only think of switching modes mid screen, they implemented it and they did it all with genuine 3D.
Are you sure? I don't see any signs of this here:
https://www.mobygames.com/game/bbc-micro_/elite/screenshots/... https://www.mobygames.com/game/c64/elite/screenshots/gameSho...
They both seem to have identical resolution.
The C64 version would have been capable of that level of colour in both it's bitmap modes (320x200 and 160x200), as it could do a minimum of two colour per 8x8 cell in the 320x200 mode as well.
[EDIT: Actually, there are things in the image that would require the "lores" 160x200 mode on the C64; so it might be that both of them do the mode switching; it'd be able to use multiple colours but some of them seem to use two foreground colours per 8x8 block and that wouldn't work in hires - though it'd be possible to achieve the effects shown with a couple of sprites and some raster colour changes, it'd probably be more trouble than it'd be worth vs. a mode change]
Though the bitmap modes were overall very rarely used on the C64 (Elite was a very notable exception) as it was more common to use tiles with custom character sets combined with sprites, even for pseudo-3d games like Skyfox as it was much faster (at the cost of jerkier movement and more memory for multiple scaled copies of graphics):
https://www.youtube.com/watch?v=lNkFD_jMzto
> This only worked on the BBC Micro, other variants of Elite were not as good as there wasn't the hardware on other systems to do truly cool stuff.
There were 16/32 bit version of Elite that did much better, but of course that was a few years later. Here's the Amiga version:
> https://www.mobygames.com/game/bbc-micro_/elite/screenshots/...
If you look closely than you can see on this screenshot that the pixels in the lower colored section are twice as wide (horizontally) as the pixels in the upper black and white section.
AFAIK really complex scanline tricks mostly appeared on the Atari and Amiga platforms first because they exposed explicit programmability that made it simple to define exactly what you wanted the memory layout to map to. Other hardware could do similar things, but needed to code a cycle-exact loop - a feat that was certainly known in the 80's, but also relied on a good understanding of the timings of all the hardware.
Try it on an emulator: https://bbc.godbolt.org/ - Elite is the default disc. To load: hold Shift, tap F12, release shift. Once the game is loaded and you see the animating ship, hold F12. The mode-switching interrupt stops running while it's held down (that key is wired to the reset pin on the real hardware), and you'll see the entire display incorrectly scanned out in just one of the modes.
But anyway, it's also described here:
http://beebwiki.mdfs.net/MODE_5
The Amstrad CPC could also do this type of effect, although it could not freely position the raster interrupt. There are newer demos though that go quite crazy with reprogramming the display mid-screen, for instance:
Braben and Bell were Cambridge University grade geniuses, in the UK's Silicon Fen, so they were probably exposed to a lot more than schoolkids like myself living in the countryside. So I now imagine they had a lot more influences, and, like all great artists, they 'stole' ideas from other platforms for their 'stolen ideas' to be as good as rocket science magic for the likes of myself.
Elite on the BBC Micro was the best game ever until networked games came along. This is probably why I am not a gamer, I was not that impressed by consoles or PC games, they lacked the ambition of 'Elite'. Of course that has changed now but there was a step backwards for me.
However its processor was twice as fast as the C64 so it had an advantage for 3D graphics.
Of course because the C64 had more free RAM it was able to hold a lookup for some calculations so get around the slower CPU.
I love the balancing of those trade offs back in the day.
I believe that the “ultimate” 8 bit Elite was the co-processor Beeb version which had 64k on the copro and the hosts shadow memory plus a faster 6502 too.
Hidden line removal! In. Real. Time. Just imagine that if you can.
Routines have been made to deliver 64 x scanline "pixels", essentially creating an Apple 2 like lowres display.