From 5a90ba8555233d21b98ba9d3ed526be4bd171974 Mon Sep 17 00:00:00 2001 From: 4am Date: Thu, 3 Sep 2020 18:42:38 -0400 Subject: [PATCH] 15% faster SHR fizzle fade --- src/fx/fx.hgr.1bit.fizzle.a | 2 +- src/fx/fx.shr.fizzle.a | 53 ++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/fx/fx.hgr.1bit.fizzle.a b/src/fx/fx.hgr.1bit.fizzle.a index 65b30abef..87a78efa4 100755 --- a/src/fx/fx.hgr.1bit.fizzle.a +++ b/src/fx/fx.hgr.1bit.fizzle.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2017-2019 by qkumba +;(c) 2017-2020 by qkumba/4am !cpu 6502 !to "build/FX/BIT.FIZZLE",plain diff --git a/src/fx/fx.shr.fizzle.a b/src/fx/fx.shr.fizzle.a index 6df686582..9c153d0c7 100644 --- a/src/fx/fx.shr.fizzle.a +++ b/src/fx/fx.shr.fizzle.a @@ -1,16 +1,19 @@ ;license:MIT -;(c) 2019 by qkumba +;(c) 2019-2020 by qkumba/4am !cpu 6502 !to "build/FX/SHR.FIZZLE",plain *=$a000 +rnd1=$fe +rnd2=$ff + ;init RNG ldy #1 - sty @rnd1+1 + sty rnd1 dey - sty @rnd2+1 + sty rnd2 ;copy SCB and palette @@ -37,59 +40,55 @@ ;iterate @loop - ldy @rnd1+1 - ldx @rnd2+1 - lsr @rnd2+1 - ror @rnd1+1 + ldx rnd1 +@loop2 + stx $26 + stx $3c + ldx rnd2 + lsr rnd2 + ror rnd1 bcc + ;feedback polynomial forms #$4001 for period of 32767 - lda @rnd1+1 + lda rnd1 eor #1 - sta @rnd1+1 - lda @rnd2+1 + sta rnd1 + lda rnd2 eor #$40 - sta @rnd2+1 + sta rnd2 ;don't rewrite SCB or palette ;it will make the fizzle take longer than obviously needed + cpx #$7d bcs + - sty $26 - sty $3c txa ;select address - ;clc adc #$20 sta $27 sta $3d ;copy pixel from other page to this page - ldy #0 lda ($3c),y sta $c005 sta ($26),y sta $c004 - ;wait while checking for keypress ++ + ;exit conditions -+ ;ldx #2 -@wait lda $c000 + ldx rnd2 + bne @loop + + ldx $c000 bmi @exit - ;dex - ;bne @wait - ;and exit condition - -@rnd2 lda #0 - bne @loop -@rnd1 lda #0 - cmp #1 - bne @loop + ldx rnd1 + cpx #1 + bne @loop2 @exit rts