2 ; Ullrich von Bassewitz, 06.08.1998
4 ; void cputcxy (unsigned char x, unsigned char y, char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
16 jsr gotoxy ; Set cursor, drop x and y
19 ; Plot a character - also used as internal function
21 _cputc: cmp #$0A ; CR?
25 beq plot ; Recalculate pointers
28 beq newline ; Recalculate pointers
30 ; Printable char of some sort
33 bcc cputdirect ; Other control char
39 bne cputdirect ; Branch always
43 jsr putchar ; Write the character to the screen
45 ; Advance cursor position
48 cpy SCR_LINELEN ; xsize-1
50 jsr newline ; new line
57 lda SCR_LINELEN ; xsize-1
58 sec ; Account for -1 above
66 ; Handle character if high bit set
71 lda #$5E ; Load screen code for PI
78 ; Set cursor position, calculate RAM pointers
87 asl SCREEN_PTR ; 80 column mode
89 @L1: ora #$80 ; Screen at $8000
94 ; Write one character to the screen without doing anything else, return X
98 ora RVS ; Set revers bit
100 sta (SCREEN_PTR),y ; Set char
103 ; Screen address tables - offset to real screen
107 ScrLo: .byte $00, $28, $50, $78, $A0, $C8, $F0, $18
108 .byte $40, $68, $90, $B8, $E0, $08, $30, $58
109 .byte $80, $A8, $D0, $F8, $20, $48, $70, $98
112 ScrHi: .byte $00, $00, $00, $00, $00, $00, $00, $01
113 .byte $01, $01, $01, $01, $01, $02, $02, $02
114 .byte $02, $02, $02, $02, $03, $03, $03, $03