2 ; void cputcxy (unsigned char x, unsigned char y, char c);
6 .export soft80_cputcxy, soft80_cputc
7 .export soft80_cputdirect, soft80_putchar
8 .export soft80_putcolor
9 .export soft80_newline, soft80_plot
14 .import __bgcolor ; FIX/CHECK
26 jsr _gotoxy ; Set cursor, drop x
29 ; Plot a character - also used as internal function
38 ; Set cursor position, calculate RAM pointers
43 jmp soft80_kplot ; Set the new cursor
46 beq soft80_newline ; Recalculate pointers
48 ; Printable char of some sort
59 jsr soft80_putchar ; Write the character to the screen
61 ; Advance cursor position
112 ; Write one character to the screen without doing anything else
114 ; returns: Y: cursor X position
115 ; this function is going to be used a lot so we unroll it a bit for speed
117 ;--- start color vodoo
119 ; remove color from cell
123 ;ldy #$00 ; is still $00
125 lda (CRAM_PTR),y ; vram
128 jeq @l2b ; vram==bgcolor
131 lda (CRAM_PTR),y ; colram
135 beq @l2s ; colram==bgcolor
139 ;lda (CRAM_PTR),y ; colram
144 lda (CRAM_PTR),y ; vram
147 sta (CRAM_PTR),y ; vram
152 sta (CRAM_PTR),y ; colram
159 ; => only one char in cell used
162 bcc @l2b ; space at current position
165 lda (CRAM_PTR),y ; vram
168 sta (CRAM_PTR),y ; vram
176 ;ldy #$00 ; is still $00
178 lda (CRAM_PTR),y ; vram
181 beq @l2s ; vram==bgcolor => first char in cell
183 ; vram!=bgcolor => second char in cell
186 lda (CRAM_PTR),y ; colram
190 bne @l2s ; colram!=bgcolor
192 ; colram==bgcolor => second char in cell or overwrite 1st char
195 bcs @l2a ; char at current position => overwrite 1st
198 lda (CRAM_PTR),y ; vram
200 sta (CRAM_PTR),y ; colram
206 ; colram!=bgcolor => alread 2 chars in cell
211 sta (CRAM_PTR),y ; vram
218 .export soft80_checkchar
220 ; test if there is a space or a character at current position
221 ; CLC: space SEC: character
224 ;ldy #$00 ; is still $00
274 ;ldy #$00 ; is still $00
301 ; output inverted space
342 stx $01 ; will stay $34 for space
343 ldy #$00 ; will be $00 from now on
345 cmp #' ' ; space is a special (optimized) case
364 ora soft80_hi_charset+(line*$80),x
376 ora soft80_lo_charset+(line*$80),x
393 ; output inverted character
403 eor soft80_hi_charset+(line*$80),x
414 eor soft80_lo_charset+(line*$80),x