; > Hardware

        GBLL    MouseHiNibble   ; TRUE <=> mouse quadrature is in top 4 bits

MouseHiNibble SETL {TRUE}       ; new configuration

; Bits in TCON (Timer/Counter Control Register)

TF1     Bit     TCON, 7
TR1     Bit     TCON, 6
TF0     Bit     TCON, 5
TR0     Bit     TCON, 4
IE1     Bit     TCON, 3
IT1     Bit     TCON, 2
IE0     Bit     TCON, 1
IT0     Bit     TCON, 0

; Bits in SCON (Serial Port Control Register)

SM0     Bit     SCON, 7
SM1     Bit     SCON, 6
SM2     Bit     SCON, 5
REN     Bit     SCON, 4
TB8     Bit     SCON, 3
RB8     Bit     SCON, 2
TI      Bit     SCON, 1
RI      Bit     SCON, 0

; Bits in IE (Interrupt Enable Register)

EA      Bit     IE, 7
ES      Bit     IE, 4
ET1     Bit     IE, 3
EX1     Bit     IE, 2
ET0     Bit     IE, 1
EX0     Bit     IE, 0

MainInput1      *       P1      ; input from first half of key matrix
MainInput2      *       P2      ; input from 2nd half (only 12 columns)

MouseInput      *       P3
MatrixOutput    *       P0

MouseMask       *       &F0

SerialDataIn    Bit     P3, 0   ; but not needed as the chip gives us a byte
SerialDataOut   Bit     P3, 1   ; ditto

CapsLockLED     Bit     P0, 5
ScrollLockLED   Bit     P0, 4
NumLockLED      Bit     P0, 6

NumMask         *       &40
CapMask         *       &20
ScrollMask      *       &10

MouseButton1    Bit     P3, 6
MouseButton2    Bit     P3, 7
MouseButton3    Bit     P2, 7
MouseButtonInput1 *      P3
MouseButtonInput2 *      P2
MouseButtonMask   *      &E0
LEDMask           *      &70

        END
