2 ; Ullrich von Bassewitz, 1998-08-06, 2009-09-26
4 ; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
5 ; void __fastcall__ cputc (char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
19 jsr _gotoxy ; Set cursor, drop x
22 ; Plot a character - also used as internal function
24 _cputc: cmp #$0A ; CR?
28 beq plot ; Recalculate pointers
31 beq newline ; Recalculate pointers
33 ; Printable char of some sort
36 bcc cputdirect ; Other control char
42 bne cputdirect ; Branch always
46 jsr putchar ; Write the character to the screen
48 ; Advance cursor position
54 jsr newline ; new line
75 ; Handle character if high bit set
80 lda #$5E ; Load screen code for PI
87 ; Set cursor position, calculate RAM pointers.
92 jmp PLOT ; Set the new cursor
96 ; Write one character to the screen without doing anything else, return X
100 ora RVS ; Set revers bit
102 sta (SCREEN_PTR),y ; Set char
104 sta (CRAM_PTR),y ; Set color