shave some bytes

This commit is contained in:
4am 2020-09-07 16:56:40 -04:00
parent 3b0149f9e9
commit a249b986e9
3 changed files with 24 additions and 28 deletions

View File

@ -10,11 +10,10 @@ copymasks = $6200 ; [256 bytes, page-aligned]
ldx #(end-start) ; copy LFSR code to zero page ldx #(end-start) ; copy LFSR code to zero page
- lda start-1, x - lda start-1, x
sta $0, x sta $FF, x
dex dex
bne - bne -
lda #%00000001 ; create copymask lookup table -- ldy #$20 ; create copymask table
-- ldy #$20
ora #%10000000 ora #%10000000
- sta copymasks, x - sta copymasks, x
inx inx
@ -37,8 +36,9 @@ copymasks = $6200 ; [256 bytes, page-aligned]
rts ; exit via LFSR code on zero page rts ; exit via LFSR code on zero page
start start
!pseudopc 1 { !pseudopc 0 {
; in: X,Y=0 ; in: X,Y=0
!byte %00000001
loop txa loop txa
loop1 eor #$B4 ; LFSR form 0xB400 with period 65535 loop1 eor #$B4 ; LFSR form 0xB400 with period 65535
tax ; X is LFSR high byte, Y is LFSR low byte tax ; X is LFSR high byte, Y is LFSR low byte

View File

@ -10,11 +10,10 @@ copymasks = $6200 ; [128 bytes, should not cross page boundar
ldx #(end-start) ; copy LFSR code to zero page ldx #(end-start) ; copy LFSR code to zero page
- lda start-1, x - lda start-1, x
sta $0, x sta $FF, x
dex dex
bne - bne -
lda #%00000011 ; create copymask lookup table -- ldy #$20 ; create copymask table
-- ldy #$20
ora #%10000000 ora #%10000000
- sta copymasks, x - sta copymasks, x
inx inx
@ -25,7 +24,7 @@ copymasks = $6200 ; [128 bytes, should not cross page boundar
bne -- bne --
pha pha
pha pha
tax ; X=0 tax
clc clc
-- ldy #$20 ; create address lookup table -- ldy #$20 ; create address lookup table
tya tya
@ -39,8 +38,9 @@ copymasks = $6200 ; [128 bytes, should not cross page boundar
rts ; exit via LFSR code on zero page rts ; exit via LFSR code on zero page
start start
!pseudopc 1 { !pseudopc 0 {
; in: X,Y=0 ; in: X,Y=0
!byte %00000011
loop txa loop txa
loop1 eor #$60 ; LFSR form 0x6000 with period 32767 loop1 eor #$60 ; LFSR form 0x6000 with period 32767
tax ; X is LFSR high byte, Y is LFSR low byte tax ; X is LFSR high byte, Y is LFSR low byte

View File

@ -33,7 +33,6 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
inx inx
cpx #$C0 cpx #$C0
bne - bne -
ldx #0 ; create shapemask table ldx #0 ; create shapemask table
-- lda hgrlo, x -- lda hgrlo, x
sta $FE sta $FE
@ -71,26 +70,12 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
inx inx
cpx #$C0 cpx #$C0
bne -- bne --
ldx #(end-start) ; copy LFSR code to zero page ldx #(end-start) ; copy LFSR code to zero page
- lda start-1, x - lda start-1, x
sta $0, x sta $FF, x
dex dex
bne - bne -
-- ldy #$20 ; create copymask lookup table
clc ; create shapemaskaddrs lookup table
-- ldy #$20
lda #>shapemask
- sta shapemaskaddrs, x
adc #1
inx
dey
bne -
txa
bne --
lda #%00000011 ; create copymask lookup table
-- ldy #$20
ora #%10000000 ora #%10000000
- sta copymasks, x - sta copymasks, x
inx inx
@ -99,11 +84,21 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
asl asl
asl asl
bne -- bne --
tax ; X=0 tax
clc clc
-- ldy #$20 ; create address lookup table -- ldy #$20 ; create address lookup table
tya tya
- sta addrs, x - sta addrs, x
adc #1
inx
dey
bne -
txa
bne --
clc ; create shapemaskaddrs lookup table
-- ldy #$20
lda #>shapemask
- sta shapemaskaddrs, x
adc #1 adc #1
inx inx
dey dey
@ -118,8 +113,9 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
jmp $1 jmp $1
start start
!pseudopc 1 { !pseudopc 0 {
; in: X,Y=0 ; in: X,Y=0
!byte %00000011
loop txa loop txa
loop1 eor #$60 ; LFSR form 0x6000 with period 32767 loop1 eor #$60 ; LFSR form 0x6000 with period 32767
tax ; X is LFSR high byte, Y is LFSR low byte tax ; X is LFSR high byte, Y is LFSR low byte