]> git.sur5r.net Git - cc65/blob - libsrc/c128/cputc.s
Return 0 if color not found
[cc65] / libsrc / c128 / cputc.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ;
4 ; void cputcxy (unsigned char x, unsigned char y, char c);
5 ; void cputc (char c);
6 ;
7
8         .export         _cputcxy, _cputc, cputdirect, putchar
9         .export         newline, plot
10         .constructor    initcputc
11         .destructor     donecputc
12         .import         popa, _gotoxy
13         .import         PLOT
14
15         .include        "c128.inc"
16
17
18 _cputcxy:
19         pha                     ; Save C
20         jsr     popa            ; Get Y
21         jsr     _gotoxy         ; Set cursor, drop x
22         pla                     ; Restore C
23         jmp     PRINT
24
25 ; Plot a character - also used as internal function
26
27 _cputc          = PRINT         ; let the kernal handle it
28
29 cputdirect      = $c33b
30
31 newline:
32         lda     #17
33         jmp     PRINT
34
35 ; Set cursor position, calculate RAM pointers
36
37 plot:   ldy     CURS_X
38         ldx     CURS_Y
39         clc
40         jmp     PLOT            ; Set the new cursor
41
42 ; Write one character to the screen without doing anything else, return X
43 ; position in Y
44
45 putchar = $CC2F
46
47 ;--------------------------------------------------------------------------
48 ; Module constructor/destructor
49
50 initcputc:
51         lda     #$C0
52         .byte   $2C
53 donecputc:
54         lda     #$00
55         sta     SCROLL
56         rts
57