Disassembling my old code from 1988 – part 5

Introduction

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.

Other parts of this series, including this one are listed below.

  • Disassembling my old code part 1 – Getting started with WinAPE
  • Disassembling my old code part 2 – Setting screen mode & Soft 968
  • Disassembling my old code part 3 – Text operations
  • Disassembling my old code part 4 – Set cursor position & disc cache
  • Disassembling my old code part 5 – Get Shift key and set translate <—- you are here
  • Disassembling my old code part 6 – Processing disc activities
  • Disassembling my old code part 7 – Drawing rectangles
  • Disassembling my old code part 8 – Processing HEX in the left pane

 

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 !

cheers

niall

 

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

7 Responses to Disassembling my old code from 1988 – part 5

  1. Pingback: Disassembling my old code from 1988 – part 4 | Amstrad noob

  2. Pingback: Disassembling my old code from 1988 – part 3 | Amstrad noob

  3. Pingback: Disassembling my old code from 1988 – Part 2 | Amstrad noob

  4. Pingback: Disassembling my old code from 1988 – Part 1 | Amstrad noob

  5. Pingback: Disassembling my old code part 6 – Processing disc activities | Amstrad noob

  6. Pingback: Disassembling my old code part 7 – Drawing rectangles | Amstrad noob

  7. Pingback: Disassembling my old code part 8 – Processing HEX text in the left pane | Amstrad noob

Leave a Reply

Your email address will not be published. Required fields are marked *