Skip to navigation


Keyboard: U%

[Commodore 64 version]

Name: U% [Show more] Type: Subroutine Category: Keyboard Summary: Clear the key logger and reset a number of flight variables
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * DEATH calls U%

This routine zeroes the 17 key logger locations from KY1 to KY20 and the key variable at KL, and resets the 40 variable bytes from LSP to TYPE. Returns: A A is set to 0 Y Y is set to 0
.U% LDA #0 ; Set A to 0, as this means "key not pressed" in the ; key logger at KLO LDY #56 ; We want to clear the 16 key logger locations from KY1 ; to KY20, and we want to zero the 40 variable bytes ; from LSP to TYPE, so set a counter in Y .DKL3 STA KLO,Y ; Store 0 in the Y-th byte of the key logger DEY ; Decrement the counter BNE DKL3 ; And loop back for the next key, until we have just ; KLO+1 STA KL ; Clear KL, which is used for logging keys that don't ; appear in the keyboard table RTS ; Return from the subroutine