3 ms·
What's not mentioned in the article is that the pixel memory also had an interesting layout. It's organized as 32x192 bytes, with each byte holding 8 1-bit pixe
by flohofwoe 8y ago
What's not mentioned in the article is that the pixel memory also had an interesting layout. It's organized as 32x192 bytes, with each byte holding 8 1-bit pixels. But the memory wasn't organized in a linear fashion. To get to the next pixel line you don't add 32 bytes, but 256 bytes (adding 32 bytes gets you to the next character line, 8 pixel lines below).
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).
- flohofwoe 8y agoBonus BASIC program demonstrating this :) Go here: https://floooh.github.io/tiny8bit/zx.html 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 i
- emilfihlman 8y agoThe emulator sucks btw, it can't handle alt+tab or ctrl+pageup/down for navigating away.
- flohofwoe 8y agoHuh? Weird, it works on Windows and Mac for me (Alt-Tab on both, and Ctrl PageUp/Down on Windows, no such keys on my Mac keyboard to test though). I had to consume the browser key events in order to catch the function keys for the emulator (e.g. Chrome uses F1 on Windows for showing the help, but F1 is also needed in the emulators), maybe you're seeing a side-effect of this. Feel free to write a ticket here with reproduction steps: https://github.com/floooh/chips-test/issues https://github.com/floooh/chips-test/issues
- pjc50 8y agoThis also caused the characteristic out-of-order loading of splash screens from tape - they were loaded linearly into this nonlinear layout.