2 ; Ullrich von Bassewitz, 06.08.1998
4 ; void cputcxy (unsigned char x, unsigned char y, char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
17 jsr _gotoxy ; Set cursor, drop x
20 ; Plot a character - also used as internal function
22 _cputc: cmp #$0A ; CR?
26 beq plot ; Recalculate pointers
29 beq newline ; Recalculate pointers
31 ; Printable char of some sort
34 bcc cputdirect ; Other control char
40 bne cputdirect ; Branch always
44 jsr putchar ; Write the character to the screen
46 ; Advance cursor position
49 cpy SCR_LINELEN ; xsize-1
51 jsr newline ; new line
58 lda SCR_LINELEN ; xsize-1
59 sec ; Account for -1 above
67 ; Handle character if high bit set
72 lda #$5E ; Load screen code for PI
79 ; Set cursor position, calculate RAM pointers
88 asl SCREEN_PTR ; 80 column mode
90 @L1: ora #$80 ; Screen at $8000
95 ; Write one character to the screen without doing anything else, return X
99 ora RVS ; Set revers bit
101 sta (SCREEN_PTR),y ; Set char
104 ; Screen address tables - offset to real screen
108 ScrLo: .byte $00, $28, $50, $78, $A0, $C8, $F0, $18
109 .byte $40, $68, $90, $B8, $E0, $08, $30, $58
110 .byte $80, $A8, $D0, $F8, $20, $48, $70, $98
113 ScrHi: .byte $00, $00, $00, $00, $00, $00, $00, $01
114 .byte $01, $01, $01, $01, $01, $02, $02, $02
115 .byte $02, $02, $02, $02, $03, $03, $03, $03