ret
;check if there is a key is down at (HL);only the first key found is returned
;return carry is a key is down
;return key code in A : key code = (line*8)+bit
GetPressed
push HL
ld C,10.loop_col
ld B,8
ld A,(HL++).loop_bit rla jr nc,.pressed
djnz .loop_bit
dec C
rrca
rrca
ld E,A ld D,0
add HL,DE
;so we get the address
pop AF;now get the
and 7
inc A
.loop
rra ;get bit in carry
djnz .loop
ccf ;reverse bit
pop HL
ENDMODULE</pre>
[[Category:Programming]]