2 ; Ullrich von Bassewitz, 06.08.1998
4 ; void cputcxy (unsigned char x, unsigned char y, char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
10 .destructor setsyscursor
16 .import ktmp: zp, crtc: zp, CURS_X: zp, CURS_Y: zp, RVS: zp
25 jsr _gotoxy ; Set cursor, drop x
28 ; Plot a character - also used as internal function
30 _cputc: cmp #$0A ; CR?
34 beq plot ; Recalculate pointers
37 beq newline ; Recalculate pointers
39 ; Printable char of some sort
42 bcc cputdirect ; Other control char
48 bne cputdirect ; Branch always
52 jsr putchar ; Write the character to the screen
54 ; Advance cursor position
60 jsr newline ; new line
75 ; Handle character if high bit set
80 lda #$5E ; Load screen code for PI
83 bne cputdirect ; Branch always
85 ; Write one character to the screen without doing anything else, return X
92 ora RVS ; Set revers bit
94 sta (CharPtr),y ; Set char
98 ; Set cursor position, calculate RAM pointers
137 ; -------------------------------------------------------------------------
138 ; Cleanup routine that sets the kernal cursor position to ours
146 jmp PLOT ; Set the new cursor
148 ; -------------------------------------------------------------------------
149 ; Low bytes of the start address of the screen lines
154 .byte $00,$50,$A0,$F0,$40,$90,$E0,$30
155 .byte $80,$D0,$20,$70,$C0,$10,$60,$B0
156 .byte $00,$50,$A0,$F0,$40,$90,$E0,$30
158 ; -------------------------------------------------------------------------
159 ; High bytes of the start address of the screen lines
162 .byte $D0,$D0,$D0,$D0,$D1,$D1,$D1,$D2
163 .byte $D2,$D2,$D3,$D3,$D3,$D4,$D4,$D4
164 .byte $D5,$D5,$D5,$D5,$D6,$D6,$D6,$D7