6 ms·
My first Z80 assembly language program
- _joel 5y agoKudos, I think this trumps me writing my name in a goto loop in qbasic that I did when I was 9. Still the sense of accomplishment dictated the next 30 years of my life so not bad I guess :)
- JoeAltmaier 5y agoMy first 8080 game was 'fly', where an X would flit around the screen and turn 45 degrees left when you hit the space bar. You tried to keep it on the screen and not touching some obstacle (a wall that extended down the top about 1/3 the way across?). Pointless but fun to write!
- thom 5y agoAlways like seeing Oscar's site pop up here, so that I can tell people to check out the lovely annotated source code for Toledo Nanochess, his IOCCC-winning tiny chess engine: https://nanochess.org/chess3.html#book https://nanochess.org/chess3.html#book
- KingOfCoders 5y agoMy first larger code was the towers of Hanoi on CPC, where I found the algorithm while experimenting with coins of different sizes, somewhere around 12. Still very proud that I found a solution algorithm.
- jkh1 5y agoThis brings back memories. My first Z80 assembly program was a jetpac game for the Sinclair ZX80 around 1984 because I couldn't get a ZX Spectrum to play it. I don't think any written copy still exists but there's still a copy on a cassette tape.
- tyingq 5y agoIf you download his MSX rom, from https://nanochess.org/archive/karate2.zip https://nanochess.org/archive/karate2.zip and then unzip, and extract the karate2_msx.rom file, you can play it online. https://webmsx.org/ https://webmsx.org/ is an online MSX emulator. Just click the "load files" link and give it the ROM file. Space bar and arrow keys for controls.
- JKCalhoun 5y agoYes, I found it is simplest to drag the 'karate2_msx.rom' to your browser and select 'Cartidge 1' from the popup.
- canada_dry 5y agoI have a very similar stack of lined graph paper with my Z80 'trek' game that I developed when I was ~15yo. I found this book [i] to be a fantastic resource - it taught me so much about microprocessor and computer architecture. [i] https://archive.org/details/programmingz8000zaks https://archive.org/details/programmingz8000zaks
- KingOfCoders 5y agoIf you do Z80, best book (one of the books I love most) "Z80 Assembly Language Subroutines"
- elvis70 5y agoI agree, https://archive.org/details/bitsavers_osborneboogeSubroutines1983_24203802/page/n3/mode/2up https://archive.org/details/bitsavers_osborneboogeSubroutine...
- varyherb 5y ago> I was 9 years old and I wanted to write amazing games...After four years of writing games in BASIC language, I felt like I was stopped by the slowness inherent to an interpreted language. Wasn't sure I was reading this correctly, so I navigated to the About Me page: > Born in 1978, I started programming at age 5 in BASIC, learnt assembly language by age 9
- kragen 5y agoI was in a similar situation, and I think the slowness inherent to an interpreted language was a big frustration to all of us kids programming in BASIC in the 01980s. Unfortunately I didn't have the guidance and direction Oscar Toledo G. had—my father did what he could, but he's just not an educator, and he's also not the same level of wizard as his father Oscar Toledo E.—so I didn't learn assembly until I was about 13, and then I learned from a book. (Also, I suspect Oscar Toledo G. has more innate aptitude than I do, but I think that in this case my lack of practice and feedback is what was holding me back.) I didn't write my first playable game until I was 29, which was http://canonical.org/~kragen/sw/inexorable-misc/tetris http://canonical.org/~kragen/sw/inexorable-misc/tetris. (I wrote some games earlier, but they were just unplayably bad.)
- Schiphol 5y agoI have a question for people reading this article. Where did you get ahold of the relevant docs, back in the 80s? I remember being dimly aware that there was something called 'machine code' which was like BASIC but much faster. But that was it.
- pmontra 5y agoNot the author but I bought a book about assembler for my Sinclair ZX81. I just discovered it's got a Wikipedia page https://en.wikipedia.org/wiki/Programming_the_Z80 https://en.wikipedia.org/wiki/Programming_the_Z80 Edit: wow, see this comment of elvis70 > The author has made his book freely available : http://www.z80.info/zaks.html http://www.z80.info/zaks.html
- Schiphol 5y agoThanks! I might just learn it, 35 years after the fact :)
- elvis70 5y agoPersonally, it was books!
- jacquesm 5y agoLeventhal's CPU series was pretty good, also every manufacturer makes reference manuals for their instruction sets. I still have mine (pretty dog eared, just for sentimental value, unlikely to ever be used again).
- Doctor_Fegg 5y agoThe Sinclair ZX81 manual had the full list of Z80 opcodes in it - Appendix A in http://zxnext.narod.ru/manuals/ZX81_Manual.pdf http://zxnext.narod.ru/manuals/ZX81_Manual.pdf . So with that you could start PEEKing and POKEing and experimenting. I never really did any Z80 coding on the ZX81 itself, but that section of the manual came in really useful when I got an Amstrad CPC, which is what I learned Z80 on. To that I added The Ins & Outs of the Amstrad (https://cpcrulez.fr/book_english-the_ins_and_outs_of_the_amstrad.htm https://cpcrulez.fr/book_english-the_ins_and_outs_of_the_ams...), which documented the firmware and other CPC-specific stuff.
- the_af 5y agoHis whole website is pretty cool and filled with retro gaming goodness. Thanks for sharing!
- zh3 5y agoBack in '78 or so, my first computer was a hand-assembled Nascom I (2MHz Z80)[0] with 1kb of RAM. No assemblers, no disk drives, not even a cassette tape. Just a keyboard and a simple ROM that let you load hex values in memory. The low-res video display was memory-mapped, so after much study of circuit diagrams,the Mostek Z80 manual and the ROM I got to understand memory addressing, where the screen was and how the hardware worked. So my first Z80 program was just 3 instructions entered as hex opcodes; all it did was splat an asterisk on the screen but what a buzz I got at the time :) ld a,2a # Load ASCII '*' in to acc ld hl,d80 # Set HL to point to video-mapped RAM ld (hl),a # Put character on screen. Some years later I wrote one of the first multi-user games, picked up by British Telecom to run on their Prestel/Micronet network. By that time I've graduated to 4MHz Z80s, with home-made 2MB RAM disks and 256Kb of main RAM accessed with a crude TTL MMU; we got up to 64 users per Z80, albeit accessing the system via 1200/75 baud modems. [0] It graced the cover of Issue #1 of Personal Computer World; I still have a copy.
- Renaud 5y agoWe should have a site where these experiences are retained. My teen years were in the 80s and I was mad about the Z80 in my cheap Laser 200 but was too isolated to have access to much information and equipment. Yet, I reversed engineered the schematic of my little, made my own memory expansion (I couldn't afford the official one) out of stacked SRAM chips, mapped the ROM, build my own crude tools to see what was going on in the hardware, coded assembler by hand and poked the memory to store the programs, one byte at a time... It taught me about electronics, fundamentals of gate logic and how microprocessors worked, programming (and no I wasn't ruined by BASIC), and those constant discoveries drove me to want to know more. It was such a formative and fun experience for a curious teen to explore something in depth -with no help other than a few magazine and books- and uncovering the layers of what made a computer tick, however minimal that computer was.
- gzalo 5y agoThis guy's family is quite odd: http://www.biyubi.com/eng_principal.html http://www.biyubi.com/eng_principal.html They designed their own hardware, operating systems and utilities back in the 70s, and they seem to really like optimizing software so they must run quite fast. But they say they have been "silenced" by big corporations, and that the mexican government doesn't like them and that's why they haven't been able to sell their computers. I wish that they would release most of their hardware/software with a free license. I imagine their stuff can be used for educational purposes.
- mgkimsal 5y agoExtremely impressive. I had a ZX81 when I was around his age, and was dimly aware of 'machine code', but couldn't quite get my head around doing anything substantial with it - BASIC was where I mostly stayed. Moved to a 128, then later the PC world (a Sanyo 550 - almost PC compatible!), and mostly stuck with BASIC in those in the 80s. I did get in to some assembly stuff on the C128 side of things, as it came with a built-in assembler. I understood assembly basics, but didn't do much productive with it. I could move some boxes around the screen via keys, and I did do a bit with the '80 col' monochrome mode trying to do some custom sprite stuff (learned a lot about XOR) - but that's about as far as I got by my mid teens. Reading stories like the OP make me feel inadequate...