2 ; 2003-04-13, Ullrich von Bassewitz
3 ; 2013-07-16, Greg King
5 ; void cputcxy (unsigned char x, unsigned char y, char c);
9 .export _cputcxy, _cputc
10 .export setscrptr, putchar
20 jsr popax ; Get X and Y
25 ; Plot a character - also used as internal function
27 _cputc: cmp #$0D ; CR?
30 sta CURS_X ; Carriage return
38 ; Output the character, then advance the cursor position
52 ; ------------------------------------------------------------------------
53 ; Set ptr2 to the screen, load the X offset into Y
58 ldy CURS_Y ; Get line number into Y
59 lda ScrTabLo,y ; Get low byte of line address
61 lda ScrTabHi,y ; Get high byte of line address
63 ldy CURS_X ; Get X offset
68 ; ------------------------------------------------------------------------
69 ; Write one character to the screen without doing anything else, return X
75 ora rvs ; Set revers bit
77 jsr setscrptr ; Set ptr2 to the screen
78 pla ; Restore the character
79 sta (ptr2),y ; Set char
84 ; ------------------------------------------------------------------------
85 ; Screen address table
89 .repeat SCREEN_YSIZE, Line
90 .byte <(SCREEN + Line * SCREEN_XSIZE)
94 .repeat SCREEN_YSIZE, Line
95 .byte >(SCREEN + Line * SCREEN_XSIZE)