Gee-k.net

First delves into Assembly


Created on: 04-07-2020  By Gee
A good while ago I wrote my first BASIC program for the Amstrad CPC series. It's the first I wrote since I was a child copying from the CPC 6128 manual anyway. Back then I was too young to even know I was coding never mind know that the language was BASIC. After writing that and trying to condense the code down a bit, which I managed partially (It could still be better), I decided that I would try remake it in assembly language.
Why assembly? no real reason other than to learn another coding language. Also, if I can learn assembly then I should then be able to make more complex programs and possibly even games in the future. I think that would be great.
My first port of call was watching Assembly tutorial videos by ChibiAkumas. Keith has made so many tutorials on learning Assembly for all sorts of different computers and CPU's. They're easy to follow and if you get a little stuck you can either Check out Keith's assembly tutorial website or join the ChibiAkumas forums and ask questions there.

The next thing I done was work out how I wanted the program to flow. Unlike the BASIC program where I just started coding and making things work as I went along, which led to a bit of bloat in the code. So I made a flow chart and this really helped me work out where I would need loops and variables etc.

I made a start to the program by just working out how to change the border, background and pen colours. To do this I used the firmware routines I found in an Amstrad CPC firmware guide. I ran into an issue with one part of the guide as it had missed out a register letter and I didn't notice. But that was solved after help on the ChibiAkumas forums. I have since made a bit more of this conversion to assembly and put it on the back burner. Something I do a lot of as other things peek my interest.

After having done a bit of coding on an emulator I got to thinking about how people must have coded in asm back in the 80’s and 90’s. I done a bit of research and found some books and cassettes with assemblers on them. Hopefully I can use those to code assembly on the very machines themselves, as it would have been done. This comes with the risks of needing to save my work frequently so that if I manage to freeze the machine up or overwrite the RAM in a location I shouldn’t have, I don’t loose any work.
The first guide I got (with cassettes) was The Complete Machine Code Tutor which I felt was a bit lacking. The booklet consists of 22 pages to help you through the instructions that are all on cassette. There are 2 cassettes which is where most of the content is. Sometimes trying to read that on the amstrad screen is fairy sore on the eyes.

The next book (with cassette) was the Amstrad Assembly Language Course by Tim Herbertson. This book is so much more in depth and the cassette has an assembler on it. So I feel that in the future, when I’m coding on the machines themselves, this is the book and software that I will use.

Once my office has been completed (loft conversion), I am looking to have all my most frequently used machines set up ready to go. One (or more) of which will be an amstrad CPC that I will be able to code on. I am very much looking forward to this time. I might even live stream my nerding out as I go through the book and learn how to code in assembly on a vintage machine.