]> git.sur5r.net Git - cc65/blob - libsrc/apple2/cgetc.s
Add interrupt handling code from Stefan Haubenthal
[cc65] / libsrc / apple2 / cgetc.s
1         ;;
2         ;; Kevin Ruland
3         ;;
4         ;; char cgetc (void);
5         ;;
6         ;; If open_apple key is pressed then the high-bit of the
7         ;; key is set.
8         
9         .export _cgetc
10
11         .include "apple2.inc"
12
13 _cgetc:
14         lda     KBD
15         bpl     _cgetc          ; if < 128, no key pressed
16         ;; At this time, the high bit of the key pressed
17         ;; is set
18         bit     KBDSTRB         ; clear keyboard strobe
19         bit     BUTN0           ; check if OpenApple is down
20         bmi     pressed 
21         and     #$7F            ; If not down, then clear high bit
22 pressed:        
23         ldx     #$00
24         rts
25