2 ; Ullrich von Bassewitz, 06.08.1998
4 ; void cputcxy (unsigned char x, unsigned char y, char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
14 .include "../cbm/cbm.inc"
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
34 bne newline ; Recalculate pointers
36 ; Printable char of some sort
39 bcc cputdirect ; Other control char
45 bne cputdirect ; Branch always
49 jsr putchar ; Write the character to the screen
51 ; Advance cursor position
69 ; Handle character if high bit set
74 lda #$5E ; Load screen code for PI
81 ; Set cursor position, calculate RAM pointers
90 asl SCREEN_PTR ; 80 column mode
92 @L1: ora #$80 ; Screen at $8000
97 ; Write one character to the screen without doing anything else, return X
101 ora revers ; Set revers bit
103 sta (SCREEN_PTR),y ; Set char
106 ; Screen address tables - offset to real screen
110 ScrLo: .byte $00, $28, $50, $78, $A0, $C8, $F0, $18
111 .byte $40, $68, $90, $B8, $E0, $08, $30, $58
112 .byte $80, $A8, $D0, $F8, $20, $48, $70, $98
115 ScrHi: .byte $00, $00, $00, $00, $00, $00, $00, $01
116 .byte $01, $01, $01, $01, $01, $02, $02, $02
117 .byte $02, $02, $02, $02, $03, $03, $03, $03