2019-07-14 16:57:04 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2019 by qkumba
|
|
|
|
|
|
|
|
!cpu 6502
|
2021-11-17 19:21:41 +00:00
|
|
|
!to "build/GR.FIZZLE",plain
|
2021-11-09 18:39:16 +00:00
|
|
|
*=$6000
|
2019-07-14 16:57:04 +00:00
|
|
|
|
|
|
|
;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 #$402 for period of 2047
|
|
|
|
|
|
|
|
lda @rnd1+1
|
|
|
|
eor #2
|
|
|
|
sta @rnd1+1
|
|
|
|
lda @rnd2+1
|
|
|
|
eor #4
|
|
|
|
sta @rnd2+1
|
|
|
|
|
|
|
|
;little hack to avoid missing offset zero
|
|
|
|
;screen hole at $xxFF is missed instead
|
|
|
|
|
|
|
|
+ tya
|
|
|
|
eor #$ff
|
|
|
|
sta $26
|
|
|
|
sta $3c
|
|
|
|
and #$78
|
|
|
|
cmp #$78
|
2019-07-15 15:21:24 +00:00
|
|
|
beq @rnd2
|
2019-07-14 16:57:04 +00:00
|
|
|
txa
|
|
|
|
and #3
|
|
|
|
|
|
|
|
;target page 1
|
|
|
|
|
|
|
|
ora #4
|
|
|
|
sta $3d
|
2021-11-09 18:39:16 +00:00
|
|
|
eor #$44
|
2019-07-15 15:42:05 +00:00
|
|
|
sta $27
|
2019-07-14 16:57:04 +00:00
|
|
|
|
|
|
|
;set mask according to offset
|
|
|
|
|
|
|
|
lda #$0f
|
|
|
|
cpx #4
|
|
|
|
bcc @src
|
|
|
|
lda #$f0
|
|
|
|
|
|
|
|
;copy half-pixel from other page to this page
|
|
|
|
|
|
|
|
@src sta @mask+1
|
|
|
|
ldy #0
|
|
|
|
and ($26),y ; isolate source half
|
|
|
|
eor ($3c),y ; merge with whole target
|
|
|
|
@mask and #$d1 ; SMC isolate merged half
|
|
|
|
eor ($3c),y ; unmerge half of target
|
|
|
|
sta ($3c),y ; store both halves
|
|
|
|
|
|
|
|
;wait while checking for keypress
|
|
|
|
|
2019-07-15 15:42:05 +00:00
|
|
|
ldx #$10
|
2019-07-14 16:57:04 +00:00
|
|
|
@wait lda $c000
|
|
|
|
bmi @exit
|
|
|
|
dex
|
|
|
|
bne @wait
|
|
|
|
|
|
|
|
;and exit condition
|
|
|
|
|
|
|
|
@rnd2 lda #0
|
|
|
|
bne @loop
|
|
|
|
@rnd1 lda #0
|
|
|
|
cmp #1
|
|
|
|
bne @loop
|
|
|
|
|
|
|
|
@exit rts
|