[A83] Re: direct input


[Prev][Next][Index][Thread]

[A83] Re: direct input




You have to send a mask for each row.  You might try something like the code
below.  Keys is a seven byte variable.  It starts with row six, and goes to
row zero.  If you want it to go the other way, then reverse the mask and the
rotate.  This code is not tested.  Each bit is set according to the value
from the port.  The comments will be aligned if viewed in a monospaced font:

ReadKeys:
 ld b,7              ; there are seven rows
 ld c,%01111111      ; mask will be rotated before first read
 ld hl,Keys          ; point to variable
ReadKeysLoop:
 ld a,c              ; get mask
 rrca                ; rotate mask
 ld c,a              ; save mask
 res 7,a             ; clear high bit of mask
 out (1),a           ; send mask to port
 nop                 ; two nop's should be sufficient
 nop                 ; ...
 in a,(1)            ; read key mask from port
 ld (hl),a           ; save mask to variable
 inc hl              ; point to next byte in variable
 djnz ReadKeysLoop   ; read all the key rows

> In a program using direct input, is it possible to activate the whole
> keyboard with one command or do you have to do it with separate commands?
> The reason is because I want the program to recognize multiple keypresses
> from all over the keyboard. Thanks.





References: