Optimized size to 682

This commit is contained in:
Michaelangel007 2017-07-17 20:12:41 -07:00
parent 1dcddb2569
commit 1a91c374f0
4 changed files with 44 additions and 57 deletions

View File

@ -3,7 +3,7 @@
Linux Logo in 6502 assembly language. Linux Logo in 6502 assembly language.
Size: 692 ($2B4) bytes Size: 682 ($2AA) bytes
# Screenshots # Screenshots
@ -23,7 +23,7 @@ Size: 692 ($2B4) bytes
* Cleaned up fugly logo by Albert Lai * Cleaned up fugly logo by Albert Lai
* Logo is 70 chars wide * Logo is 70 chars wide
* Logo is bit packed 2 bits/char; expands 70 chars * 4 px = 280 px * Logo is bit packed 2 bits/char; expands 70 chars * 4 px = 280 px
* Logo takes up 70*12*2/8 = 210 bytes compared to 80*12 = 960 bytes * Logo takes up 70*12*2/8 = 210 bytes compared to 79*12 = 948 bytes
* X is now symmetrical * X is now symmetrical
* Fixed L,i,n kerning * Fixed L,i,n kerning
* Fixed x Penguin kerning * Fixed x Penguin kerning

BIN
linuxlogo

Binary file not shown.

View File

@ -8,9 +8,9 @@ zCursorY = $25 ; CH
zHgrPtr = $26 ; GBASL = Dst zHgrPtr = $26 ; GBASL = Dst
zTxtPtr = $28 ; BASL = Dst zTxtPtr = $28 ; BASL = Dst
zSaveX = $F9 zDstOffset = $F9 ; unpack[ iDst ]
zSaveY = $FA zSaveY = $FA
zMask = $FB ; 16-bit but Acc has low zMask = $FB ; adjacent byte for next pixels
zSrcShift = $FC ; i mod 8 zSrcShift = $FC ; i mod 8
zDstShift = $FD ; i mod 7 zDstShift = $FD ; i mod 7
zUnpackBits = $FE ; 16-bit unpack zUnpackBits = $FE ; 16-bit unpack
@ -34,7 +34,7 @@ MACHINEID2 = $FBC0
MACHINEID3 = $FBBF ; //c version MACHINEID3 = $FBBF ; //c version
; Config ; Config
UnpackAddr = $3FD0 ; Y=191, $28 bytes at Keyboard buffer UnpackAddr = $3FD0 ; Y=191, $28 bytes
CONFIG_PROBE_CPUINFO = 1 CONFIG_PROBE_CPUINFO = 1
CONFIG_PRINT_CPUINFO = 1 CONFIG_PRINT_CPUINFO = 1
@ -170,11 +170,11 @@ Unpack
lda #7 ; will INC, $0428 (Text) + $1C00 => $2028 (HGR) lda #7 ; will INC, $0428 (Text) + $1C00 => $2028 (HGR)
sta zCursorY ; Start Row=8 sta zCursorY ; Start Row=8
DrawRow
lda #0 lda #0
tay tay
tax ; DstOffset within page tax ; SrcShift=0
sta zDstShift sta zDstShift
sta zDstOffset
lda PackedBits lda PackedBits
sta zUnpackBits+0 sta zUnpackBits+0
@ -182,9 +182,9 @@ DrawRow
NextSrcShift NextSrcShift
lda PackedBits+1,Y lda PackedBits+1,Y
sta zUnpackBits+1 sta zUnpackBits+1
lda #0 ldx #0
UpdateSrcShift UpdateSrcShift
sta zSrcShift stx zSrcShift
jsr Unpack2Bits ; hhggffee C=? ddccbbaa jsr Unpack2Bits ; hhggffee C=? ddccbbaa
bcs UnpackDone bcs UnpackDone
@ -194,13 +194,13 @@ UpdateSrcShift
lsr zUnpackBits+1 ; 00hhggff C=e eddccbba lsr zUnpackBits+1 ; 00hhggff C=e eddccbba
ror zUnpackBits+0 ; 00hhggff c=e eeddccbb ror zUnpackBits+0 ; 00hhggff c=e eeddccbb
lda zSrcShift ldx zSrcShift
clc inx
adc #2 inx
cmp #8 ; have 8 input bits? cpx #8 ; have 8 input bits?
bne UpdateSrcShift bne UpdateSrcShift
iny ; src++ iny ; src++
bne NextSrcShift bne NextSrcShift ; always, since packed data length < 256
UnpackDone UnpackDone
@ -208,9 +208,10 @@ UnpackDone
DO CONFIG_PRINT_CPUINFO DO CONFIG_PRINT_CPUINFO
txa ; (2) A=0 from (1) Unpack2Bits
ldx #0 ldx #0
PrintText PrintText
jsr BASCALC ; jsr BASCALC
ldy #0 ldy #0
CopyTextLine CopyTextLine
lda TextLine,X lda TextLine,X
@ -245,7 +246,6 @@ ModelPlus
Unpack2Bits Unpack2Bits
; DoublePixel ; DoublePixel
stx zSaveX
sty zSaveY sty zSaveY
lda zUnpackBits lda zUnpackBits
@ -259,46 +259,44 @@ Unpack2Bits
ldx #0 ldx #0
stx zMask stx zMask
ldx zDstShift ldy zDstShift ;
beq NoShiftSherlock beq NoShiftSherlock
MakeShiftMask MakeShiftMask
asl asl
rol zMask rol zMask
dex dey
bne MakeShiftMask bne MakeShiftMask
NoShiftSherlock NoShiftSherlock
asl ; 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
sec ; MSB=1 color=blue/orange sec ; MSB=1 color=blue/orange
ror ror
ldx zDstOffset
ldy zDstShift ; x={0,1,2} + 4 < 7
cpy #3 ; all bits fit into dest byte?
ldx zSaveX
ora UnpackAddr,X ; do all bits that fit ora UnpackAddr,X ; do all bits that fit
sta UnpackAddr,X sta UnpackAddr,X
bcc UpdateDestOffset
lda zDstShift ; x={0,1,2} + 4 < 7
clc
adc #4
cmp #7 ; all bits fit into dest byte?
bcc FitSameByte
; Update partial next byte of dest ; Update partial next byte of dest
inx ; x = x + 4 - 7
stx zSaveX ; x = x - 3
cpx #$28 ; C = x < 28 sbc #7 ; C=1
tay ; push zDstShift
inx
stx zDstOffset
lda zMask lda zMask
ora #$80
ora UnpackAddr,X ora UnpackAddr,X
sta UnpackAddr,X sta UnpackAddr,X
; x = x + 4 - 7 tya ; pop zDstShift
; x = x - 3 cpx #$28 ; C = x < 28
ldy zDstShift bcc FitSameByte ; C = x < 28
dey
dey
dey
bcc LineNotDone ; C = x < 28
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Copy Buffer to HGR ; Copy Buffer to HGR
@ -339,27 +337,16 @@ CopyNextByte
adc #$04 adc #$04
sta zHgrPtr+1 sta zHgrPtr+1
stx zSaveX ; X=0 last loop iteration stx zDstOffset ; X=0 last loop iteration
txa ; A=0 zDstShift
dex dex
bpl Draw8Rows bpl Draw8Rows
iny ; Y=0 -> zDstShift ldx zCursorY ; (3) X=13
cpx #$14 ; Y=$40 .. $A0, Rows $8..$13 (inclusive)
lda zCursorY FitSameByte
cmp #$14 ; Y=$40 .. $A0, Rows $8..$13 (inclusive) sta zDstShift
bcs OuputDone ldy zSaveY ; NOTE: C=0 from CMPs above
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
@ -400,7 +387,7 @@ TextLine ;0123456789012345678901234567890123456789
; NOTE: Generated by ascii2hgr2bit ; NOTE: Generated by ascii2hgr2bit
; ASCII: 70*12 = 840 chars ; ASCII: 70*12 = 840 chars
; Packed 2bits/2pixel: 70 chars * 2 bits/char / 8 bits/byte = 140 bits / 8 = 17.5 bytes ; Packed 2bits/2pixel: 70 chars * 2 bits/char / 8 bits/byte = 140 bits / 8 = 17.5 bytes/scanline
; 840 chars * 2 bits/color / 8 bits/byte = 210 bytes ; 840 chars * 2 bits/color / 8 bits/byte = 210 bytes
PUT packedlogo.s PUT packedlogo.s

Binary file not shown.