It can be really hard to warm up to coding in Assembly. But this tutorial looks to make it understandable and (almost) easy. It focuses on programming a game for the ZX Spectrum. But you won’t need the hardware on hand as you can just use the ZX Spin emulator as you work your way through the code.
Ostensibly this is a 30-minute tutorial but that’s a gross underestimate. We finished a cursory read of the tutorial and the building blocks are certainly clear and easy to understand. But we like to make sure we understand every line of code and plan to spread that out over the coming weekend.
The first chapter eases us into machine code by combining it with a bit of BASIC. You’ll see how to manipulate the ZX Spectrum memory and then pluck that value back out into the BASIC program. But once chapter 2 hits it’s pretty much all assembly from there on out. The nice thing is that as you go along you learn how the hardware works and there are quite a few references to pages in the manual so you can do some extra learning along the way.
[Thanks Mathilda]
ZXSpin hasn’t been developed for quite some time now and has quite a few known bugs which can be quite frustrating. Personally I mostly use a win32 build of Fuse (The Free Unix Spectrum Emulator) but there are several very good emulators under active development.
Oh, the Z80 brings back great memories!
If you want to go (quite) a bit further then hgave ahunt around on the web for a copy of “The Art of Assembly” by Randall Hyde. Yes, there is a printed book available, but the author put the whole work up for free many years ago, so you’re buying convenience, not pirating. It takes you one step further, on to dealing with the Intel x86 architecture (which is about as far, if not further than you need to go unless you are getting paid for it), and will do wonders for your programming technique even if you don’t make it past Chapter 1.
If you’re feeling adventurous:
http://dac.escet.urjc.es/~csanchez/pfcs/zxspectrum/CompleteSpectrumROMDisassemblyThe.pdf
Edsim 51 is probably the most full featured way to learn assembly, totally free and has lots of peripherals you can experiment with along with lessons.
http://www.edsim51.com/
I still have my copy of “Programming the Z80” by Rodnay Zaks on my bookshelf – I haven’t done any Z80 assembler for nearly 30 years and the book is falling part, but I can’t find it in myself to throw it away – mind you, new on Amazon it costs an astonishing £115GBP, or $130USD.
A great book indeed.
That is a book I’ve always wanted. At $130 I’m still going to always want it…
I have “Z80 Applications” and “Z80 Assembly Language Subroutines” and also wanted the Zaks book. I learned a lot from the second book and used part of it as a template for other assembly languages that I have learned.
It showed a ton of examples of how to do “atomic” operations. Three different ways to clear the accumulator. How to do a 10’s compliment. How to compare greater than vs. greater/equal using each of the registers or register pairs and memory. Tons of variations on testing/branching. Bunches of examples on looping.
The Z80 Assembly Language Subroutines book was the basis for becoming proficient at a lot of other assembly languages. At the time I programmed mainly in assembly the book was worth its weight in gold.
And if you happen to own z80 ASM on a Spectrum, you can also start writing TI-83+/84+ ASM programs, also in z80!
Probably you want to build a Spectrum Emulator to try the programming:
http://www.jcwolfram.de/projekte/avr/ax82/main.php
http://www.mikrocontroller.net/topic/272500
Emulator Schmemulator. Nothing like typing code on the rubber keys then hoping that all your hard work did actually get saved to the cassette.
Looks like a NOR gate to me.
That’s what I thought at first — but then I realized I thought that because it IS a nor gate :)
https://dl.dropbox.com/u/2364614/hackz.PNG
I just completed the whole Nand2Tetris 12-chapter textbook this week, after 6 months of on-again, off-again work. Incredibly educational!
A) Elements of computing SYSTEMS
B) Reading that book over the summer (on the beach, in between sandcastle building, of course) was the best decision I made all summer! Love it.