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_newline, soft80_plot
22 .if SOFT80COLORVOODOO = 1
23 .export soft80_putcolor
29 jsr _gotoxy ; Set cursor, drop x
32 ; Plot a character - also used as internal function
41 ; Set cursor position, calculate RAM pointers
46 jmp soft80_kplot ; Set the new cursor
49 beq soft80_newline ; Recalculate pointers
51 ; Printable char of some sort
56 ; extra check for petscii codes 160-191, these have been moved to
64 bpl L10 ; branch always
73 jsr soft80_putchar ; Write the character to the screen
75 ; Advance cursor position
100 inc CURS_Y ; new line
126 ; Write one character to the screen without doing anything else
128 ; returns: Y: cursor X position
129 ; this function is going to be used a lot so we unroll it a bit for speed
131 .if SOFT80FASTSPACE = 1
139 .if SOFT80COLORVOODOO = 1
142 ;ldy #$00 ; is still $00
169 ; output inverted space
173 .if SOFT80COLORVOODOO = 1
177 sta (CRAM_PTR),y ; vram
209 sta tmp3 ; remember charcode
216 stx $01 ; will stay $34 for space
217 ldy #$00 ; will be $00 from now on
219 .if SOFT80FASTSPACE = 1
220 cmp #' ' ; space is a special (optimized) case
224 .if SOFT80COLORVOODOO = 1
228 sta (CRAM_PTR),y ; vram
232 ldx tmp3 ; get charcode
244 ora soft80_hi_charset+(line*$80),x
256 ora soft80_lo_charset+(line*$80),x
273 ; output inverted character
283 eor soft80_hi_charset+(line*$80),x
294 eor soft80_lo_charset+(line*$80),x
302 ;-------------------------------------------------------------------------------
304 .if SOFT80COLORVOODOO = 1
305 ;--- start color vodoo
307 ; remove color from cell, called before putting a "space" character to the bitmap
311 ;ldy #$00 ; is still $00
313 ; if the textcolor in vram is equal to the background color, then
314 ; no (visible) character is in the current cell and we can exit
316 lda (CRAM_PTR),y ; vram (textcolor)
319 jeq @l2b ; yes, vram==bgcolor
321 ; now check if the textcolor in color ram is equal the background color,
322 ; if yes then there is only one (visible) character in the current cell
324 lda (CRAM_PTR),y ; colram (2nd textcolor)
328 beq @l2s ; yes, colram==bgcolor
330 ; two characters in the current cell, of which one will get removed
334 ;lda (CRAM_PTR),y ; colram
338 ; move 2nd text color to vram
340 lda (CRAM_PTR),y ; vram
343 sta (CRAM_PTR),y ; vram
348 sta (CRAM_PTR),y ; colram
355 ; => only one char in cell used
358 bcc @l2b ; space at current position
360 ; vram (textcolor) = bgcolor
361 lda (CRAM_PTR),y ; vram
364 sta (CRAM_PTR),y ; vram
369 ; in: $01 is $34 (RAM under I/O) when entering
374 ;ldy #$00 ; is still $00
376 lda (CRAM_PTR),y ; vram
379 beq @l2s ; vram==bgcolor => first char in cell
381 ; vram!=bgcolor => second char in cell
384 lda (CRAM_PTR),y ; colram
388 bne @l2s ; colram!=bgcolor
390 ; colram==bgcolor => second char in cell or overwrite 1st char
393 bcs @l2a ; char at current position => overwrite 1st
396 lda (CRAM_PTR),y ; vram
398 sta (CRAM_PTR),y ; colram
404 ; colram!=bgcolor => alread 2 chars in cell
409 sta (CRAM_PTR),y ; vram
413 ;.export soft80_checkchar
415 ; test if there is a space or a character at current position
417 ; out: CLC: space SEC: character
421 ;ldy #$00 ; is still $00