Inlined GetDestAddr, 692 bytes

This commit is contained in:
Michaelangel007 2017-07-17 15:32:06 -07:00
parent 352bd06453
commit 1dcddb2569
3 changed files with 61 additions and 67 deletions

View File

@ -3,7 +3,7 @@
Linux Logo in 6502 assembly language. Linux Logo in 6502 assembly language.
Size: 696 ($2B8) bytes Size: 692 ($2B4) bytes
# Screenshots # Screenshots

View File

@ -246,14 +246,15 @@ Unpack2Bits
; DoublePixel ; DoublePixel
stx zSaveX stx zSaveX
sty zSaveY
lda zUnpackBits lda zUnpackBits
and #3 ; A=000000ba asl ; A=?????ba0
pha asl ; A=????ba00
asl ; A=00000ba0 eor zUnpackBits ; A=????xxyy
asl ; A=0000ba00 and #%00001100 ; A=????xx00
sta zMask eor zUnpackBits ; A=????baba
pla and #%00001111 ; A=0000baba
ora zMask ; A=0000baba
ldx #0 ldx #0
stx zMask stx zMask
@ -267,14 +268,16 @@ MakeShiftMask
bne MakeShiftMask bne MakeShiftMask
NoShiftSherlock NoShiftSherlock
cmp #$80 ; msb of byte0 set? asl ; msb of byte0 set?
rol zMask ; shift in to lsb of byte1 rol zMask ; shift in to lsb of byte1
ldx zDstShift ; x={0,1,2} + 4 < 7 sec ; MSB=1 color=blue/orange
cpx #3 ; all bits fit into dest byte? ror
ldy zDstShift ; x={0,1,2} + 4 < 7
cpy #3 ; all bits fit into dest byte?
ldx zSaveX ldx zSaveX
ora #$80
ora UnpackAddr,X ; do all bits that fit ora UnpackAddr,X ; do all bits that fit
sta UnpackAddr,X sta UnpackAddr,X
bcc UpdateDestOffset bcc UpdateDestOffset
@ -291,71 +294,20 @@ NoShiftSherlock
; x = x + 4 - 7 ; x = x + 4 - 7
; x = x - 3 ; x = x - 3
ldx zDstShift ldy zDstShift
dex dey
dex dey
dex dey
bcc LineNotDone ; C = x < 28 bcc LineNotDone ; C = x < 28
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Copy Buffer to HGR ; Copy Buffer to HGR
sty zSaveY
inc zCursorY inc zCursorY
jsr GetDestAddr
ldx #7 ; Repeat each scanline 8 times
Draw8Rows
ldy #0
CopyScanLine
lda UnpackAddr,Y
sta (zHgrPtr),Y
cpx #0 ; Clear source on last scanline copy
bne CopyNextByte
txa
sta UnpackAddr,Y
CopyNextByte
iny
cpy #40 ; 280/7 = 40 bytes/scanline
bne CopyScanLine
clc ; y = y+1
lda zHgrPtr+1 ; addr_y+1 = addr_y + $0400
adc #$04
sta zHgrPtr+1
dex
bpl Draw8Rows
ldy zSaveY
lda zCursorY
cmp #$14 ; Y=$40 .. $A0, Rows $8..$13 (inclusive)
bcs OuputDone
ldx #0
stx zSaveX
beq LineNotDone ; Next Scan Line, start at dst bit 0
UpdateDestOffset
ldx zDstShift
inx
inx
inx
inx
LineNotDone
stx zDstShift
clc
ldx zSaveX
OuputDone
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Udpate the Text Address ; Udpate the Text Address
; Update the HGR scanline Address ; Update the HGR scanline Address
; Clear the Text buffer
GetDestAddr
lda zCursorY lda zCursorY
jsr BASCALC jsr BASCALC
@ -366,9 +318,51 @@ GetDestAddr
clc ; every 8 HGR scanline address clc ; every 8 HGR scanline address
adc #$1c ; is Text Page $04 + $1C = HGR Page $20 adc #$1c ; is Text Page $04 + $1C = HGR Page $20
sta zHgrPtr+1 sta zHgrPtr+1
; ------------------------------------------------------------------------
ldx #7 ; Repeat each scanline 8 times
Draw8Rows
ldy #39 ; 280/7 = 40 bytes/scanline
CopyScanLine
lda UnpackAddr,Y
sta (zHgrPtr),Y
txa ; Clear source on last scanline copy
bne CopyNextByte
sta UnpackAddr,Y
CopyNextByte
dey
bpl CopyScanLine
clc ; y = y+1
lda zHgrPtr+1 ; HGR addr_y+1 = addr_y + $0400
adc #$04
sta zHgrPtr+1
stx zSaveX ; X=0 last loop iteration
dex
bpl Draw8Rows
iny ; Y=0 -> zDstShift
lda zCursorY
cmp #$14 ; Y=$40 .. $A0, Rows $8..$13 (inclusive)
bcs OuputDone
bcc LineNotDone ; Next Scan Line, start at dst bit 0
UpdateDestOffset ; C=0 from NoShiftSherlock
iny
iny
iny
iny
LineNotDone
sty zDstShift
ldx zSaveX ; NOTE: C=0 from CMPs above
ldy zSaveY
OuputDone
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
CpuType = * + 13 + 40 CpuType = * + 13 + 40

Binary file not shown.