        .CR     65C02
        .TF     readkey.hex,INT
        .LF     readkey.list
;
; SMALL PROGRAM FOR THE BE6502 COMPUTER THAT SEEKS TO DEMONSTRATE THE GET KEY
; ROUTINE FROM CH1 - ESSENTIALLY WE ATTEMPT TO READ THE KEY AND JUST OUTPUT
; IT ONTO THE ONBOARD LEDS. THE BOOK ACTUALLY DETAILS THE USE OF A SYM-1
; COMPUTER, SO WHATEVER BUGS YOU MAY FIND SHOULD PROBABLY BE BLAMED ON ME AND
; NOT THE AUTHOR OF THE BOOK.
;
; NOTE THAT ALL OF THE PARTS BELONGING TO THE GAME BOARD ASSUMES A TIMING OF
; 1 MHZ, SO ANY MANUAL CLOCKING AND SLOW CLOCKS ARE NOT APPLICABLE.
;
VIA0    .EQ     $6000       ; VIA FOUND ON THE BE6502 ITSELF
VIA1    .EQ     $4000       ; GAME BOARD (VIA #1)
VIA3    .EQ     $4C00       ; GAME BOARD (VIA #3)
PORT0B  .EQ     VIA0
DDR0B   .EQ     VIA0+2
DDR3A   .EQ     VIA3+3
DDR3B   .EQ     VIA3+2
PORT3A  .EQ     VIA3+1
PORT3B  .EQ     VIA3

        .OR     $8000
        .TA     $0000        
BE6502  LDA     #$FF
        STA     DDR0B
        JSR     INITKEY
LOOP    JSR     GETKEY      ; GET THE KEY USING THE SUB-ROUTINE FROM THE BOOK,
        STA     PORT0B      ;  IT'LL BE IN IN A SO PUT ON LEDS FOR DISPLAY.
        JMP     LOOP        ; DO IT ALL AGAIN

        .IN     ../../common/CH01-Getkey/getkey_routine.asm
;
; STORE CPU INITIALIZATION VECTORS AT THE END OF THE EEPROM.
;
        .NO     $FFFA,$FF
        .DA     BE6502      ; NMI VECTOR
        .DA     BE6502      ; RESET VECTOR
        .DA     BE6502      ; IRQ VECTOR