From 8a4792a5b0cbd6aa2af5b9f4f616118a8470962e Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 30 Nov 2020 21:58:42 -0500 Subject: [PATCH] construct half block fizzle data at runtime --- src/fx/fx.hgr.halfblock.fizzle.a | 156 +++++++++++++++++++++++-------- 1 file changed, 115 insertions(+), 41 deletions(-) diff --git a/src/fx/fx.hgr.halfblock.fizzle.a b/src/fx/fx.hgr.halfblock.fizzle.a index dce3c2688..ba23e4564 100644 --- a/src/fx/fx.hgr.halfblock.fizzle.a +++ b/src/fx/fx.hgr.halfblock.fizzle.a @@ -1,41 +1,115 @@ -;license:MIT -;(c) 2018 by 4am -; -!cpu 6502 -!to "build/FX/HALF.FIZZLE",plain -*=$6000 - -coord = $FE - - lda #<@coords - sta coord - lda #>@coords - sta coord+1 -@loop - ldy #0 - lda (coord),y - bmi @exit - tax - iny - lda (coord),y - tay - txa - jsr HGRHalfBlockCopy - lda #$07 - jsr WaitForKeyWithTimeout - bmi @exit - inc coord - bne + - inc coord+1 -+ inc coord - bne + - inc coord+1 -+ bne @loop -@exit rts - -@coords - !source "src/fx/fx.hgr.halfblock.fizzle.data.a" - - !source "src/wait.a" - !source "src/fx/fx.hgr.common.a" - +HGR_HALF_BLOCK_COPY_ROUTINES +;license:MIT +;(c) 2018-2020 by 4am/qkumba +; +!cpu 6502 +!to "build/FX/HALF.FIZZLE",plain +*=$6000 + +coord = $FE + + lda #Coordinates + sta coord+1 + + ;init RNG + + ldx #1 + stx @rnd1+1 + dex + stx @rnd2+1 + + ;iterate + +@loop + ldy @rnd1+1 + ldx @rnd2+1 + lsr @rnd2+1 + ror @rnd1+1 + bcc + + + ;feedback polynomial forms #$500 for period of 2047 + + lda @rnd2+1 + eor #5 + sta @rnd2+1 + ++ tya + eor #$ff + ldy #0 +- cpx #0 + bne + + cmp #40 + bcc ++ ++ sbc #40 + pha + txa + sbc #0 + tax + pla + iny + bne - + +++ cpy #48 + bcs @rnd2 + tax + tya + jsr @stainc + txa + jsr @stainc + +@rnd2 lda #0 + bne @loop +@rnd1 lda #0 + cmp #1 + bne @loop + + ;include the missing point + + lda #6 + jsr @stainc + lda #15 + jsr @stainc + + lda #$ff + jsr @stainc + + lda #Coordinates + sta coord+1 +@loop2 + ldy #0 + lda (coord),y + bmi @exit + tax + iny + lda (coord),y + tay + txa + jsr HGRHalfBlockCopy + lda #$07 + jsr WaitForKeyWithTimeout + bmi @exit + inc coord + bne + + inc coord+1 ++ inc coord + bne + + inc coord+1 ++ bne @loop2 +@exit rts + +@stainc + ldy #0 + sta (coord), y + inc coord + bne + + inc coord+1 ++ rts + + !source "src/wait.a" + !source "src/fx/fx.hgr.common.a" + +HGR_HALF_BLOCK_COPY_ROUTINES + +Coordinates