Ok, I wanted this to be a C# and XNA blog but, as a related aside, I’ve been wanting to learn Assembly Language since I first became aware of it as a 7 year old. It was the language all the great 8-bit games were written in and nearly 30 years later my interest hasn’t really diminished. I’ve always felt that knowing how the machine under the hood processes your code is going to be a help in writing more efficient programs in whatever your language of choice is. I just never really got around to it. I’ve been toying with remaking Laser Squad for years. It’s a personal favourite and still very playable some 23 years later. Extracting the stats and learning how some of the pathfinding routines work would require some reverse engineering meaning I’d need to learn Assembly.

Anyway, a few weeks ago I asked fellow members of RR if they knew of some good resources to learn Z80 Assembler for the Amstrad or Spectrum. Emulators are freely available and generally have some excellent features so I thought that if I could get hold of some tutorials, I could have a read during my lunchbreaks and pick up the language over a number of weeks. I’ve done computing at GCSE, A-Level and degree level and knew loads of theory but never actually got taught how to write Assembler code. Lessons on “Twos Compliment” and “Binary Coded Decimal” as well as learning what a mantissa is, understanding how stacks and linked lists work is… Yawn-o-rama! I expected it to be a hard trek but…

THERE IS NOTHING TO IT!

All those lessons. All that boring theory. What would have helped? Giving a bloody context as to why we were learning all this. I expected numbers and things to be stored automagically in these formats and I had to be aware of them. I was also very confused as to how we’d know what was stored in which format. If the lecturer had simply said, “These are not mandatory, they are just efficient ways to storing numbers on a computer. It is up to YOU as to which you use, when and why you use them” I’d have probably learnt Assembly language years ago. I can sum up Assembler as the following bullet points:

    – You move numbers around using memory addresses and registers
    – Some registers are more important/useful than others
    – There are flags indicating something has happened
    – You can change bits using AND, OR and XOR
    – There are conditional jumps – basically ‘goto’ and ‘gosub’
    – You can call firmware routines directly to do stuff
    – There is a stack to store information while you use a register for something else

That’s pretty much it! If you want to store numbers as 16-bit values or 8-bit twos compliment, IT’S UP TO YOU! Naturally it requires a lot of coding to do some very simple stuff but you are poking about with the giblets of the machine and that’s delicate.

If you’ve been thinking about learning it for a while and have (like me) been put off by A-level teachers teaching theory without explaining its purpose, give it a go! The thread is easy enough to find on RR, the Amstrad tutorials are great and WinAPE is incredibly powerful. If you have any problems, drop me a line and I’ll try and point you in the right direction.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)