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
15 .import ktmp: zp, crtc: zp, CURS_X: zp, CURS_Y: zp, RVS: zp
23 jsr gotoxy ; Set cursor, drop x and y
26 ; Plot a character - also used as internal function
28 _cputc: cmp #$0A ; CR?
32 beq plot ; Recalculate pointers
35 beq newline ; Recalculate pointers
37 ; Printable char of some sort
40 bcc cputdirect ; Other control char
46 bne cputdirect ; Branch always
50 jsr putchar ; Write the character to the screen
52 ; Advance cursor position
58 jsr newline ; new line
73 ; Handle character if high bit set
78 lda #$5E ; Load screen code for PI
81 bne cputdirect ; Branch always
83 ; Write one character to the screen without doing anything else, return X
90 ora RVS ; Set revers bit
92 sta (CharPtr),y ; Set char
96 ; Set cursor position, calculate RAM pointers
135 ; -------------------------------------------------------------------------
136 ; Cleanup routine that sets the kernal cursor position to ours
144 jmp PLOT ; Set the new cursor
146 ; -------------------------------------------------------------------------
147 ; Low bytes of the start address of the screen lines
152 .byte $00,$50,$A0,$F0,$40,$90,$E0,$30
153 .byte $80,$D0,$20,$70,$C0,$10,$60,$B0
154 .byte $00,$50,$A0,$F0,$40,$90,$E0,$30
156 ; -------------------------------------------------------------------------
157 ; High bytes of the start address of the screen lines
160 .byte $D0,$D0,$D0,$D0,$D1,$D1,$D1,$D2
161 .byte $D2,$D2,$D3,$D3,$D3,$D4,$D4,$D4
162 .byte $D5,$D5,$D5,$D5,$D6,$D6,$D6,$D7