Skip to navigation

Keyboard: U%

[Elite Demonstration Disc]

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

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 KL LDY #15 \ We want to clear the 15 key logger locations from \ KY1 to KY19, so set a counter in Y .DKL3 STA KL,Y \ Store 0 in the Y-th byte of the key logger DEY \ Decrement the counter \ --- Mod: Code removed for Demonstration Disc: -------> \BNE DKL3 \ And loop back for the next key, until we have just \ \ cleared KL+1. We don't want to clear the first key \ \ logger location at KL, as the keyboard table at KYTB \ \ starts with offset 1, not 0, so KL is not technically \ \ part of the key logger (it's actually used for logging \ \ keys that don't appear in the keyboard table, and \ \ which therefore don't use the key logger) \ --- And replaced by: --------------------------------> BPL DKL3 \ And loop back for the next key, until we have just \ cleared KL, so this not only clears the key logger, \ but also the value at KL that is used for logging keys \ that don't appear in the keyboard table \ --- End of replacement ------------------------------> RTS \ Return from the subroutine