It's interesting how those notebook scribblings are so similar and look so familiar. I too have a couple of those in my attic and they are the same yellowed grid paper, scribbled full with flow diagrams, Z80 assembly snippets written in a clumsy teenager hand, character code tables, assembler to machinecode translation tables, sprite and tile graphics layed out on the pixel grid, etc...
I follow a couple of 8-bit veterans on Twitter, and from time to time they whip out their old game design binders, and they all look the same, no matter what computer they were on, or whether they lived on the left or right side of the iron curtain :)
Z80 has index registers (IX, IY) and indexed access instructions for them, a mirror register set that can be swapped instantly, and some useful block move instructions over 8080/8085.
Oh memories. I did the same for the MSX only a little bit earlier in the 80s (my first game at age 9 as well). Unfortunately all was lost due to a few moves.
When I am trying to recall my childhood the memory of ‘dreaming about writing my own program in assemly’ is more vivid then actually writing it. You see it took some time and a few preparation steps:
1. Preparing computer:
1.1 Discovering the opportunity: Turns out it can be soldered by myself which makes it cheap enough and thus actually even possible.
1.2 Convincing parents that even though I had no interest in electronics before it’s a good idea to build something called “computer”. Never mind what it is, it only needs a few chips and some other electronic components. I’ve seen one. It can work!
1.3 Hunting all components for weeks. Not an easy task where I have been back then.
1.4 Soldering all components to the board. Learning soldering on-the-go. I had zero interest in electronics before my friend had shown me a computer. It was the first time in my life I took soldering iron in my hands. Noticing expression of shock on faces of my parents I was calming down them with phrases like: How hard it should be? What could possibly go wrong? Right? :)
1.5 Discovering that computer would not work after soldering. It needs something called Power Supply and they don’t sell it. So the only way is to build one.
1.5.1 Hunting for components again. Power supply had to be build with short-circuit protection because burning computer would mean no second chance.
1.5.2 Building special power supply with basic components transistors, resistors, condensers, diods etc.
1.5.3 Learning some basic things about electronics and how power supplies function. Finding problems. Fixing them and making it work properly.
1.6 Discovering there is no way to buy a keyboard and recalling :) that computer actually needs Input device.
1.6.1 Hunting for old calculators.
1.6.2 Disassembling few calculators to extract buttons
1.6.3 Making keyboard with extracted buttons.
1.7 Turning On the computer. Discovering it’s not working and needs debugging.
1.8 Learning Digital electronics for some time from the book “Digital Electronics” by Tokhaim. Discovering that local schematics are not the same as in the foreign book. Oops! :) Tracing all kind of problems. Fixing them one by one and arriving to the stage where something should be shown on the screen.
1.9 Discovering that home TV doesn’t have ‘video in’.
1.9.1 Disassemble TV partially, study schematics and how TV works.
1.9.2 Make add-on with ’Video-In’ to make TV function as a Monitor.
1.10 Turn On the computer and Debug it with visual feedback. Much better! :)
1.11 Debugging computer with oscilloscope and learning how it should work on the go.
1.12 Celebrate first successfull start and making sure that everything works as it should.
2. Running Computer with visual feedback(monitor) and input device (keyboard) while everything is working properly :) Much better :)
3. Discovering how to run own programs. BIOS had no documentation. With ‘try and error’ discover how to put codes into the memory and what command will actually execute them. Then locate where the video memory starts. To at least see something! Calling builtin BIOS functions was not an option.
4. Learning codes of CPU from the table by ‘try and error’ . Table had only mnemonics without any detailed descriptions. So you basically just guess the meaning. Sometimes you guess wrong. For example HLT will not stop the program properly :) Meaning you write program again :)
And then finally , after those preparation steps I wrote my first assembly program. I believe it was some 8 dots moving horizontally.
So I had a lot of time for that “dreaming about my first program” … :)
It was Sunday, and it worked. Small white line sliding in the center of the screen. Lovely. What you wouldn’t do for that!? :)
Not because of the LD's or the ADD or the INC! But because its an Assembler macro that contains a primitive form of higher-level languages if.. then.. (AKA "conditional") statement.
See, the variable COLECO is defined at the start of the program (basically it's just a memory address):
COLECO: EQU 0
So "IF COLECO" -- will be replaced by something like the following steps in Assembler psuedocode:
1) Maybe PUSH a register to be used for comparison to the stack (optional if we want to recover the register's previous value)
2) Move (Copy) the contents of the memory address referenced by COLECO to a register to be used for comparison;
3) Make the comparison between the contents of that register and 1 (True).
4) Do nothing / fall through if they are equal.
5) But if they are not equal, JUMP to the memory address of the ELSE statement -- which (since the ELSE statement is removed on Assembly by the Assembler, because it is only "syntactic sugar"; a placeholder for the address of the next actual instruction) is the memory address of the LD HL,($0004) instruction.
6) (Optional, if comparison register preservation is desired) Restore the value of the comparison register pre-comparison, in either code path, before additional code is executed (requires inserting additional instructions).
Now the above is based on me thinking in x86 Assembler, which the above code clearly is not...
Some popular 8-bit chips of the era had a "code page" -- Basically the first 256 bytes of memory could be used almost like registers... so there may have been a direct comparison operator in Z-80 Assembler (I do not know much about Z-80 Assembler, so forgive me if anything I'm saying is incorrect or missing) which would have obviated the need for the use of a comparison register.
But my main, most general point, remains -- it's a very interesting higher-level code construct, implemented via macro -- inside of a very low-level programming language.
Basically it's a step -- between an Assembler and a Compiler...
Anyway, an excellent article(!) -- and it's fun to look at retro 8-bit assembly code codebases!
I follow a couple of 8-bit veterans on Twitter, and from time to time they whip out their old game design binders, and they all look the same, no matter what computer they were on, or whether they lived on the left or right side of the iron curtain :)