How to write a game on a ZX81 [video]
cowlark.com
cowlark.com
Essentially, the CPU executes each line of video, jumping to the start of each line of cells. The video system latches each byte onto a shift register and displays it.
But the CPU is tricked -- NOPs are forced onto its data bus right before it decodes the instruction. So it merrily marches along fetching successive bytes for the video subsystem, without interpreting them.
That is, until a certain bit of the character code is seen, then the CPU is allowed to execute the instruction and terminate the scanline (usually HALT on the ZX). This process repeats over and over for each scanline.
As a result, it's pretty tricky to program animations. There's not much CPU time left for anything while a frame is being displayed.
Oh, yeah: ZX81 BASIC doesn't support multiple statements per line, and the IF...THEN statement doesn't support ELSE. Writing complex logic on it can be a challenge!
What I really liked about the ZX81 and I think you demonstrated well is how interactive programming is. Just run your program at any point to see progress. Commonly used modern programming environments aren't as good in this respect.
And yes, some optimisations are left as an exercise for the reader.
Still hope to get around to it some day.
Although it taught me from an early age to dig to find things, you can't beat having learning material...
I am also of the opinion videos are the worst and laziest way to convey deep technical information; yet it is really popular. If someone wrote this into a post, I would he able to digest and try out in a very short period of time, with videos it is pretty uncomfortable. I wonder why it is so popular aside that most people who watch it will never try it out to begin with.
I showed this video to some work-mates, mostly younger than I am, and some of the questions I got were really revealing: 'Does it boot into Basic?' 'But if there's no disk, where does it put the compiled program?' These machines are _completely alien_ to the modern mindset, and so I wanted to actually demonstrate working on one in practice, rather than just write it up. There's plenty of technical docs out there already.
YT works for game reviews, and the odd conference presentation, for everything else I'll seek out a post.