mirror of
https://github.com/a2-4am/4cade.git
synced 2024-06-14 03:29:38 +00:00
151 lines
2.7 KiB
Plaintext
151 lines
2.7 KiB
Plaintext
;license:MIT
|
|
;(c) 2017-2018 by qkumba
|
|
;
|
|
!cpu 6502
|
|
!to "build/FX/DHGR.FIZZLEWH",plain
|
|
*=$6000
|
|
|
|
jsr CopySelfToAuxmem
|
|
jsr FizzleToWhite
|
|
jmp FizzleCopy
|
|
|
|
FizzleToWhite
|
|
;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 #$2015 for period of 16383
|
|
|
|
lda @rnd1+1
|
|
eor #$15
|
|
sta @rnd1+1
|
|
lda @rnd2+1
|
|
eor #$20
|
|
sta @rnd2+1
|
|
|
|
;little hack to avoid missing offset zero
|
|
;screen hole at $xxFF is missed instead
|
|
|
|
+ tya
|
|
eor #$ff
|
|
sta $26
|
|
sta $3c
|
|
txa
|
|
and #$1f
|
|
|
|
;target page 1
|
|
|
|
ora #$20
|
|
sta $27
|
|
eor #$60
|
|
sta $3d
|
|
|
|
;set pixel to white
|
|
|
|
ldy #0
|
|
cpx #$20
|
|
bcc +
|
|
sta $c003
|
|
sta $c005
|
|
+ lda #$FF
|
|
sta ($26),y
|
|
sta $c002
|
|
sta $c004
|
|
|
|
;check for keypress
|
|
|
|
lda $c000
|
|
bmi @exit
|
|
|
|
;and exit condition
|
|
|
|
@rnd2 lda #0
|
|
bne @loop
|
|
@rnd1 lda #0
|
|
cmp #1
|
|
bne @loop
|
|
|
|
@exit rts
|
|
|
|
FizzleCopy
|
|
;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 #$2015 for period of 16383
|
|
|
|
lda @rnd1+1
|
|
eor #$15
|
|
sta @rnd1+1
|
|
lda @rnd2+1
|
|
eor #$20
|
|
sta @rnd2+1
|
|
|
|
;little hack to avoid missing offset zero
|
|
;screen hole at $xxFF is missed instead
|
|
|
|
+ tya
|
|
eor #$ff
|
|
sta $26
|
|
sta $3c
|
|
txa
|
|
and #$1f
|
|
|
|
;target page 1
|
|
|
|
ora #$20
|
|
sta $27
|
|
eor #$60
|
|
sta $3d
|
|
|
|
;copy pixel from other page to this page
|
|
|
|
ldy #0
|
|
cpx #$20
|
|
bcc +
|
|
sta $c003
|
|
sta $c005
|
|
+ lda ($3c),y
|
|
sta ($26),y
|
|
sta $c002
|
|
sta $c004
|
|
|
|
;check for keypress
|
|
|
|
lda $c000
|
|
bmi @exit
|
|
|
|
;and exit condition
|
|
|
|
@rnd2 lda #0
|
|
bne @loop
|
|
@rnd1 lda #0
|
|
cmp #1
|
|
bne @loop
|
|
|
|
@exit rts
|
|
|
|
!source "src/fx/fx.dhgr.common.a"
|