]> git.sur5r.net Git - cc65/blob - libsrc/cbm510/cgetc.s
Adding CBM510 support
[cc65] / libsrc / cbm510 / cgetc.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ;
4 ; char cgetc (void);
5 ;
6
7         .export         _cgetc
8         .import         plot, write_crtc
9         .import         cursor
10
11         .include        "zeropage.inc"
12         .include        "page3.inc"
13
14
15 ; ------------------------------------------------------------------------
16
17 .proc   _cgetc
18
19 L1:     lda     KeyIndex
20         beq     L1
21
22 L2:     ldx     #$00            ; Get index
23         ldy     KeyBuf          ; Get first character in the buffer
24         sei
25 L3:     lda     KeyBuf+1,x      ; Move up the remaining chars
26         sta     KeyBuf,x
27         inx
28         cpx     KeyIndex
29         bne     L3
30         dec     KeyIndex
31         cli
32
33         ldx     #$00            ; High byte
34         tya                     ; First char from buffer
35         rts
36
37 .endproc
38