From: Piotr Fusik Date: Tue, 22 Jan 2019 23:05:31 +0000 (+0100) Subject: Optimize the conversions from Atari ASCII to screen codes. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1781a5cfe72c8de4fff66adbd08650014ef526c4;p=cc65 Optimize the conversions from Atari ASCII to screen codes. --- diff --git a/libsrc/atari/cputc.s b/libsrc/atari/cputc.s index a06daa691..6345983fe 100644 --- a/libsrc/atari/cputc.s +++ b/libsrc/atari/cputc.s @@ -1,5 +1,5 @@ ; -; Mark Keates, Christian Groessler +; Mark Keates, Christian Groessler, Piotr Fusik ; ; void cputcxy (unsigned char x, unsigned char y, char c); ; void cputc (char c); @@ -30,16 +30,13 @@ L4: cmp #$0A ; LF cmp #ATEOL ; Atari-EOL? beq newline - tay - rol a - rol a - rol a - rol a - and #3 - tax - tya - and #$9f - ora ataint,x + asl a + adc #$c0 + bpl intok + eor #$40 +intok: lsr + bcc cputdirect + eor #$80 cputdirect: ; accepts screen code jsr putchar @@ -89,6 +86,3 @@ putchar: ldy COLCRS sta (ptr4),y jmp setcursor - - .rodata -ataint: .byte 64,0,32,96 diff --git a/libsrc/atari/tgi/atari_tgi_common.inc b/libsrc/atari/tgi/atari_tgi_common.inc index cd486d91b..8c9f6c1f9 100644 --- a/libsrc/atari/tgi/atari_tgi_common.inc +++ b/libsrc/atari/tgi/atari_tgi_common.inc @@ -1110,11 +1110,8 @@ skipm: ; Loop while --dy > 0 ; locals string := tmp1 - cols := tmp3 pixels := tmp4 font := regsave -.rodata - ataint: .byte 64,0,32,96 .bss rows: .res 1 @@ -1222,32 +1219,31 @@ scvert: ldx x1 .endif ; Draw one character - ; Convert to ANTIC code -draw: tay - rol a - rol a - rol a - rol a - and #3 - tax - tya - and #$9f - ora ataint,x - ; Save and clear inverse video bit - sta inv - and #$7F +draw: + ; Extract the inverse mask + ldx #0 + asl a + bcc noinv + dex +noinv: stx inv + ; Calculate font data address + ldx CHBAS + cmp #$20*2 + bpl lowhalf + ; Semigraphic or lowercase + inx + inx +lowhalf: + asl a + bcc lowquarter + ; Letter + inx +lowquarter: + asl a sta font - lda #0 - sta font + 1 + stx font+1 - .repeat 3 - asl font - rol a - .endrepeat - - adc CHBAS - sta font + 1 ; Save old coords bit text_dir bpl hor @@ -1273,15 +1269,12 @@ cont: ldy #7 ; Put one row of the glyph putrow: sty rows lda (font),y - bit inv - bpl noinv - eor #$FF -noinv: sta pixels - lda #7 - sta cols + eor inv + sec + rol a + sta pixels ; Put one column of the row -putcol: asl pixels - bcc next_col +putcol: bcc next_col lda x1 pha lda x1 + 1 @@ -1317,8 +1310,8 @@ vertinc: sub mag_x sta y2 L2: - dec cols - bpl putcol + asl pixels + bne putcol next_row: ; Go to next row bit text_dir