Disassembling my old code from 1988 – part 5


This is part 5 of a blog series I’m doing to catalog some of the programs I wrote back in 1988. I’m doing this because I like doing it, it brings back memories of how I started my career with computers, and my first attempts at programming using Z80 machine code. I’m also trying to fully understand how I programmed Disced and I’m relearning how things work on the old Amstrad CPC 6128.

This series will be as long as it takes me to complete, the other parts are listed below.

  • Disassembling my old code part 5 – Get Shift key and set translate (this part)
  • Disassembling my old code part 4 – Set cursor position and disc cache
  • Disassembling my old code part 3 – Text operations
  • Disassembling my old code part 2 – Setting screen mode and using Soft 968
  • Disassembling my old code part 1 – Getting started with WinAPE

So let’s resume where we left off, and that was going through the initial calls at the start of the program. Call L9388 is the next call that we need to understand so let’s get stuck in.

And here’s the source code in focus for that label.

From what I can make out it’s loading the C register with a value of &001A (DEC 26), and then it increases C by 1, before storing the value of C in the A register and then compares it to &0048 (DEC 72) and if so return, if not true it will make a call to the &BB30 firmware routine called KM GET SHIFT (KM=Keyboard Manager).

Now I’ll be honest, at this point I’ve no idea why I’m doing this yet but obviously it’s some sort of key press check. It’ll probably become clear later in my investigations.

Ok back to the routine. After making the call to &BB30 it does some additional instructions.

It loads the value of the A register into B, then subtracts &0041 (DEC 65) and then subtracts &001A, before jumping to L938A if C is reset, if not, it loads the C register into A and then calls the firmware &BB27 which is KM SET TRANSLATE which translates what a key should be if CTRL or SHIFT are not pressed at the same time. It then jumps back to L938A.

So based on the above, I’ll assume that this routine is for checking whether shift/ctrl are being pressed and name the routine accordingly, I can always change it later as necessary.

So here’s that routine all updated with new labels.

Resources used in this post

That’s it for this part, see you again soon in the next part !




This entry was posted in Disassemble, Disced, notepad ++, WinApe, Z80 Machine code. Bookmark the permalink.