A82: Port 1, the keyboard port.


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

A82: Port 1, the keyboard port.



Tell me if this routine for checking the keyboard port is correct.
 ld a, %01111100 ; masks out all keys except
 out (1), a            ;ENTER + - * / ^ CLEAR UP DOWN LEFT RIGHT
 in a, (1)              ;Returns the bits read from the keypad 
 push AF             ;af saved in stack
 bit 6, a               ;load bit 6 of a into a
 jr nz, quit            ; if a is 1 the key pressed is clear, jump to quit
 pop AF               ;reload AF from the stack
 push AF             ;store AF back into the stack
 bit 2, a               ;load bit 2 of a into a
 jr nz, move_right  ; if a is 1 the key pressed is right, jump to move right
 pop AF               ;reload AF from the stack
 bit 1, a                ; load bit 1 of a into a
 jr nz, move_left    ; if  a is 1 the key pressed is left, jump to move left
I got the keypad port information from 82ports.txt.
BTW thanks for the display port routine Dines. What does RCL L do?
 How much faster is writing 16 bits directly to the display port rather than
using      
 Dines's point_on and point_off
PLEASE tell me of any mistakes that I might have made in the code.
Thanx
Gerad
                  Dark Light Enterprises
               Hurting programmers around the world
                  Just Kidding Thomas!!!


Follow-Ups: