ridiculously fast DHGR fizzle fade

This commit is contained in:
4am 2020-09-06 14:44:37 -04:00
parent 735d057736
commit 9dafce5ae8

View File

@ -1,84 +1,58 @@
;license:MIT ;license:MIT
;(c) 2017-2020 by qkumba/4am ;(c) 2017-2020 by qkumba/4am/John Brooks
; ;
!cpu 6502 !cpu 6502
!to "build/FX/DHGR.FIZZLE",plain !to "build/FX/DHGR.FIZZLE",plain
*=$6000 *=$6000
rnd1=$fe ldx #(end-start) ; copy LFSR code to zero page
rnd2=$ff - lda start-1, x
sta $0, x
dex
bne -
txa
tay
pha
pha
rts
; performance notes: start
; old: 10657266..12247971 = 1590705 !pseudopc 1 {
; new: 10196445..11493278 = 1296833 ; in: X,Y=0
loop txa
jsr CopySelfToAuxmem loop1 eor #$35 ; LFSR form 0x3500 with period 16383
tax
;init RNG loop2 lda addrs, x
bpl +
ldy #1 and #$7F
sty rnd1 sta $C003
dey sta $C005
sty rnd2 + sta <dst+2
;iterate
ldx rnd2
@loop
lda rnd1
@loop2
eor #$ff
sta $26
sta $3c
lsr rnd2
ror rnd1
bcc +
;feedback polynomial forms #$2015 for period of 16383
lda rnd1
eor #$15
sta rnd1
lda rnd2
eor #$20
sta rnd2
;little hack to avoid missing offset zero
;screen hole at $xxFF is missed instead
+ txa
and #$1f
;target page 1
ora #$20
sta $27
eor #$60 eor #$60
sta $3d sta <src+2
src lda $FD00, y
;copy pixel from other page to this page dst sta $FD00, y
sta $C002
cpx #$20 sta $C004
bcc + txa
sta $c003 lsr
sta $c005 tax
+ lda ($3c),y tya
sta ($26),y ror
sta $c002 tay
sta $c004 bcc loop2
bne loop
;exit conditions bit $C000
bmi exit
ldx rnd2 txa
bne @loop bne loop1
exit lda $4000 ; last lousy byte (because LFSR never hits 0)
lda $c000 sta $2000
bmi @exit rts
}
lda rnd1 end
cmp #1 addrs
bne @loop2 !byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F
!byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
@exit rts !byte $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF
!byte $B0,$B1,$B2,$B3,$B4,$B5,$B6,$B7,$B8,$B9,$BA,$BB,$BC,$BD,$BE,$BF
!source "src/fx/fx.dhgr.common.a"