shave another 131070 cycles, build lookup tables

This commit is contained in:
4am 2020-09-04 10:21:59 -04:00
parent e4a54d87c7
commit 4585ea49a7

View File

@ -5,48 +5,64 @@
!to "build/FX/BIT.FIZZLE",plain
*=$6000
src=$fc
dst=$fe
copymasks = $6100 ; [256 bytes]
addrs = $6200 ; [256 bytes]
jsr swap
ldx #1
stx+1 rnd1+1
dex
stx+1 rnd2+1
stx src
stx dst
jsr swapzp
ldx #0
lda #1
-- ldy #$20
- sta copymasks, x
inx
dey
bne -
asl
bne --
clc
-- ldy #$20
tya
- sta addrs, x
adc #$1
inx
dey
bne -
txa
bne --
sty <rnd2+1
iny
sty <rnd1+1
jsr $0
swap ldx #(End-Start-1)
swapzp ldx #(end-start-1)
- lda $0, x
pha
lda Start, x
lda start, x
sta $0, x
pla
sta Start, x
sta start, x
dex
bpl -
rts
Start
start
!pseudopc 0 {
loop lda+1 rnd1+1
loop lda <rnd1+1
loop2 eor #$ff
tay
lsr+1 rnd2+1
ror+1 rnd1+1
lsr <rnd2+1
ror <rnd1+1
bcc +
lda+1 rnd2+1
lda <rnd2+1
eor #$B4
sta+1 rnd2+1
sta <rnd2+1
+ lda addrs, x
sta dst+1
sta <dst+2
eor #$60
sta src+1
lda (dst), y
eor (src), y
sta <src+2
lda (<dst+1), y
src eor $FD00, y
and copymasks, x
eor (dst), y
sta (dst), y
eor (<dst+1), y
dst sta $FD00, y
rnd2 ldx #$FD
bne loop
lda $c000
@ -56,24 +72,4 @@ rnd1 lda #$FD
bne loop2
exit rts
}
End
!align 255, 0
copymasks
!byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
!byte 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
!byte 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
!byte 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
!byte 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
!byte 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
!byte 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64
!byte 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
addrs
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
!byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
end