shave another 262407 cycles

This commit is contained in:
4am
2020-09-04 00:20:56 -04:00
parent 35228e9183
commit 87dd4f4e4b

View File

@@ -5,71 +5,61 @@
!to "build/FX/BIT.FIZZLE",plain !to "build/FX/BIT.FIZZLE",plain
*=$6000 *=$6000
rnd1=$fe jsr swap
rnd2=$ff inx
;init RNG
ldy #1 ldy #1
sty rnd1 sty+1 rnd1+1
dey dey
sty rnd2 sty+1 rnd2+1
jsr $0
swap ldx #(End-Start-1)
- lda $0, x
pha
lda Start, x
sta $0, x
pla
sta Start, x
dex
bpl -
rts
;iterate Start
!pseudopc 0 {
ldx #0 loop lda+1 rnd1+1
@loop loop2 eor #$ff
lda rnd1 sta+1 dst+1
@loop2 sta+1 src+1
eor #$ff lsr+1 rnd2+1
sta $26 ror+1 rnd1+1
sta $3c
lsr rnd2
ror rnd1
bcc + bcc +
lda+1 rnd1+1
;feedback polynomial forms #$8016 for period of 65535
lda rnd1
eor #$16 eor #$16
sta rnd1 sta+1 rnd1+1
lda rnd2 lda+1 rnd2+1
eor #$80 eor #$80
sta rnd2 sta+1 rnd2+1
+ lda addrs, x
+ lda @addrs, x sta+1 dst+2
sta $27
eor #$60 eor #$60
sta $3d sta+1 src+2
lda+1 (dst+1), y
;copy pixel from other page to this page src eor $FDFD
and copymasks, x
lda ($26), y eor+1 (dst+1), y
eor ($3c), y ; merge source and destination bits dst sta $FDFD
and @copymasks, x ; isolate the bits to replace, zero the rest rnd2 ldx #$FD
eor ($26), y ; unmerge source and destination bits, leaves "to keep" destination bits intact bne loop
sta ($26), y ; write the result
;exit condition 1
ldx rnd2
bne @loop
;wait while checking for keypress
lda $c000 lda $c000
bmi @exit bmi exit
rnd1 lda #$FD
;exit condition 2
lda rnd1
cmp #1 cmp #1
bne @loop2 bne loop2
exit rts
}
End
@exit rts !align 255, 0
copymasks
!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 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 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 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
@@ -78,7 +68,7 @@ rnd2=$ff
!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 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 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 !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 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