1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Optimize the conversions from Atari ASCII to screen codes.

This commit is contained in:
Piotr Fusik 2019-01-23 00:05:31 +01:00
parent cd72f816d3
commit 1781a5cfe7
2 changed files with 37 additions and 50 deletions

View File

@ -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 cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c); ; void cputc (char c);
@ -30,16 +30,13 @@ L4: cmp #$0A ; LF
cmp #ATEOL ; Atari-EOL? cmp #ATEOL ; Atari-EOL?
beq newline beq newline
tay asl a
rol a adc #$c0
rol a bpl intok
rol a eor #$40
rol a intok: lsr
and #3 bcc cputdirect
tax eor #$80
tya
and #$9f
ora ataint,x
cputdirect: ; accepts screen code cputdirect: ; accepts screen code
jsr putchar jsr putchar
@ -89,6 +86,3 @@ putchar:
ldy COLCRS ldy COLCRS
sta (ptr4),y sta (ptr4),y
jmp setcursor jmp setcursor
.rodata
ataint: .byte 64,0,32,96

View File

@ -1110,11 +1110,8 @@ skipm: ; Loop while --dy > 0
; locals ; locals
string := tmp1 string := tmp1
cols := tmp3
pixels := tmp4 pixels := tmp4
font := regsave font := regsave
.rodata
ataint: .byte 64,0,32,96
.bss .bss
rows: .res 1 rows: .res 1
@ -1222,32 +1219,31 @@ scvert: ldx x1
.endif .endif
; Draw one character ; Draw one character
; Convert to ANTIC code draw:
draw: tay ; Extract the inverse mask
rol a ldx #0
rol a asl a
rol a bcc noinv
rol a dex
and #3 noinv: stx inv
tax
tya
and #$9f
ora ataint,x
; Save and clear inverse video bit
sta inv
and #$7F
; Calculate font data address ; 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 sta font
lda #0 stx font+1
sta font + 1
.repeat 3
asl font
rol a
.endrepeat
adc CHBAS
sta font + 1
; Save old coords ; Save old coords
bit text_dir bit text_dir
bpl hor bpl hor
@ -1273,15 +1269,12 @@ cont: ldy #7
; Put one row of the glyph ; Put one row of the glyph
putrow: sty rows putrow: sty rows
lda (font),y lda (font),y
bit inv eor inv
bpl noinv sec
eor #$FF rol a
noinv: sta pixels sta pixels
lda #7
sta cols
; Put one column of the row ; Put one column of the row
putcol: asl pixels putcol: bcc next_col
bcc next_col
lda x1 lda x1
pha pha
lda x1 + 1 lda x1 + 1
@ -1317,8 +1310,8 @@ vertinc:
sub mag_x sub mag_x
sta y2 sta y2
L2: L2:
dec cols asl pixels
bpl putcol bne putcol
next_row: next_row:
; Go to next row ; Go to next row
bit text_dir bit text_dir