Keyboard Reading Routines - HoraceAndTheSpider/Bloodwych-68k GitHub Wiki

The keyboard routine starts at $5D6 [CheckKeyboard:]

The game reads the keyboard and stores the result at memory location $5D1 where it is read in later.

  • it loads $bfe001 into reg a0
  • it then does a move.b ($c00,a0),d0
  • This is equivalent to move.b $bfec01,d0
  • which moves the raw keycode into d0

Code

         lea  $656,a0               ; Copy address into a0
         moveq  #b,d1               ; For loop, checking 12 things
         cmp.b  (a0)+,d0            ; check to see if the contents of mem location a0 are same as d0
                                    ; and increment the address at a0 by 1 byte (first time a0 would change to $657)
         beq  $063a                 ; If they match lets branch
         dbf  d1,$630               ; decrease d1 by 1 and loop
         rts                        ; return from routine