Illuminati - for 16K ZX81 by Jim Waterman - 24-26 November 2020 ===================================== Context ------- I've been rather productive in the CSSCGC this year - releasing Corona Capers for the 128K Spectrum, along with the piece of garbage amputated from that fine effort that was called D.N.A. Dilemma for the 16K Spectrum, and the Casio MG-777 Games compilation for the 48K Spectrum. For the ZX80, there was Complex Maths... WITH DRAGONS!. And then, +D Blue Peter and Jigsaw, both for 128K Spectrums equipped with various disc interfaces. I was not about to leave the ZX81 out in the cold, seeing as I actually own a real one now for the first time in around 33 years - and it's even equipped with an internal 16K modification to eliminate the dreaded RAM pack wobble. It has a composite output instead of the RF modulator as well. So I had to write a CSSCGC game for it... and for some reason, I thought of a pyramid with the Illuminati eye perched on top of it. Add the fact that I've been learning Z80 machine code for the first time during the relentless horror of Coronatarianism (that I *really* need to take my mind away from, because it leads to a very dark place fill of disaster...), and I thought there was no better vehicle to showcase what I can do when I talk to the processor in its own language. So I might still be at the "asking each other the way to the beach in annoyingly loud voices" stage, but it's better than nothing. The ludicrous backstory ----------------------- This has been a feature of my CSSCGC games this year - but given that this one involves the Illuminati, there's no pressing need. You can believe in this cabal of very powerful elites manipulating the leaders of the world like puppets on strings, or not - the choice is yours. It is said that behind every conspiracy theory there is a seed of truth just waiting to be discovered, but it's very hard not to be distracted from finding that truth when, for instance, David Icke mentions shape-shifting lizards, or Alex Jones starts shouting so furiously that his head looks like it'll explode. But anyway, the story is - the Illuminati are about to take over the world, and you have to stop them. (Paul Joseph Watson interjects here, to say "Well, imagine my shock!" the way he does. And he would be right do so at this point, because who didn't see that coming?) The Illuminati's Top Secret Pyramid has a combination lock which requires the input of three bytes of code in hexadecimal format - with a total of 16,777,215 possible combinations. Unfortunately, for them at least, they put a complete brainlet in charge of writing the code to secure the lock - who has only just read about it in a book that's nearly 40 years out of date. The Illuminati, of course, are not technically-minded so they have absolutely no idea about this, and they're far too busy plotting what they're going to do once they get hold of China's even-more-top-secret virus research labs (as if what we've all been put through this year isn't enough). Input the three hex codes into the pyramid, and they will propagate upwards according to a secret code known only to the Programmer... and anyone else who knows how to disassemble 85 bytes of Z80 machine code held in a REM statement at the start of the program. Once the codes reach the top of the pyramid, if the final hex byte matches the one displayed above the Evil Eye, the lock will open, and the Illuminati will be destroyed - somehow, say, a bomb goes off in their headquarters, or the virus they're going to unleash turns out to be specifically targeted at themselves. (Or you make up your own story, it's not as if anyone's going to believe it anyway.) Either way, humanity is saved, and the people across the world danced and skipped in the street with delight, and feasted on popcorn, and fruit bats, and breakfast cereals, and Pan-Galactic Gargle Blasters, and... so on, and so on, you get the idea by now. Look, I didn't say it had to make sense, did I? The Illuminati's security is so weak that only 64 out of the possible 256 bytes will ever result from any of the 16,777,215 hex combinations. I would assume they're spread evenly - I wrote a Spectrum program to output them all, with even more machine code than this one, but even running on Fuse at 40 times the correct processor speed, it would take two weeks to finish. You only have 16 attempts to match the code, and it changes every time you try... but this does at least mean you have a 1 in 4 chance of cracking the code overall. If this all sounds absolutely window-licking mental, it's because it is. I've just spent a second entire month of this year confined to my house, and it looks like there's a lot more of that still to come. This has had absolutely no detrimental effects at all. Was that sarcasm? You decide. Extra bonus endorsement ----------------------- Those who want a game all about the Illuminati and weird conspiracy theories THAT'S ACTUALLY GOOD would do well to equip yourselves with a copy of Doom II, a suitable modern source port (GZDoom is the one I use), and the excellent megawad "Ancient Aliens". Points to mention are: (1) It is very hard - you *will* get mashed to a pulp, very regularly, if you play on Ultra-Violence; (2) It is very colourful - it has a completely different pallette to regular Doom wads, with bright neon lights everywhere and a lot of blue and magenta welded together; (3) It sounds *brilliant*, as every backing track was composed by Stuart Rynn, the Doom world's answer to Henri Sorvali; (4) I'm not saying it was made by aliens... but it was aliens. A second wad, Final Doomer, will add the choice of weapons appropriate to various custom megawads, and Ancient Aliens is included. Add this on top for twice the experience! Ancient Aliens deservedly won a Cacoward in 2016. Get it NOW! https://doomwiki.org/wiki/Ancient_Aliens https://www.doomworld.com/idgames/levels/doom2/Ports/megawads/aaliens Development log --------------- There isn't a lot to see here, given that it took a total of two evenings and one full day. This is still far more than most CSSCGC entries ever get, but I don't do things by halves. 24 Nov: Drew the screen, and developed a crude BASIC method of generating the pyramid (to check the results against machine code) on a Spectrum, so I could use a combination of BASin, Fuse, Spectaculator, Spin and Notepad++ to get everything right, as entering lines into a ZX81 on EightyOne is a fair bit more laborious. 25 Nov: Worked out the machine code routine to generate the pyramid on the ZX81. It's a bit simpler as A-F are immediately after 0-9 in the character set. Also discovered which final combinations in the pyramid are possible: the first digit will always be 8-F, the second will always be an odd number (inc. B,D,F). This gives a total of 64 possible combinations of the 256 two-hex-digit bytes. 26 Nov: Everything else. Tested the machine code routine, and once that was going, the rest of the game practically built itself. Wrote the routines to input the three hex codes, check that they're valid, propagate the pyramid - most of that had already been done on a Spectrum during the initial testing of the machine code - then see if we've won or not. The instructions and ludicrous backstory were bolted on right at the end when everything else was done.