2 ; cputc/cputcxy for Challenger 1P
3 ; Based on PET/CBM implementation
5 ; void cputcxy (unsigned char x, unsigned char y, char c);
8 .export _cputcxy, _cputc, cputdirect, putchar
18 jsr _gotoxy ; Set cursor, drop x
21 ; Plot a character - also used as internal function
23 _cputc: cmp #$0A ; CR?
27 beq plot ; Recalculate pointers
30 beq newline ; Recalculate pointers
33 jsr putchar ; Write the character to the screen
35 ; Advance cursor position
38 cpy SCR_LINELEN ; xsize-1
40 jsr newline ; new line
47 lda SCR_LINELEN ; xsize-1
48 sec ; Account for -1 above
63 ; Write one character to the screen without doing anything else, return X
68 sta (SCREEN_PTR),y ; Set char
71 ; Screen address tables - offset to real screen
75 ScrLo: .byte $83, $A3, $C3, $E3, $03, $23, $43, $63
76 .byte $83, $A3, $C3, $E3, $03, $23, $43, $63
77 .byte $83, $A3, $C3, $E3, $03, $23, $43, $63
80 ScrHi: .byte $D0, $D0, $D0, $D0, $D1, $D1, $D1, $D1
81 .byte $D1, $D1, $D1, $D1, $D2, $D2, $D2, $D2
82 .byte $D2, $D2, $D2, $D2, $D3, $D3, $D3, $D3