mirror of
https://github.com/a2-4am/4cade.git
synced 2024-10-20 18:23:58 +00:00
90 lines
1.4 KiB
Plaintext
90 lines
1.4 KiB
Plaintext
;license:MIT
|
|
;(c) 2020 by qkumba
|
|
;
|
|
|
|
coord = $FE
|
|
Coordinates = $7000 ; about $700 bytes, can be anywhere
|
|
|
|
!source "src/fx/macros.a"
|
|
|
|
!macro BUILD_BLOCK_FIZZLE_DATA {
|
|
+LDADDR Coordinates
|
|
+ST16 coord
|
|
|
|
;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 #$204 for period of 1023
|
|
|
|
lda @rnd1+1
|
|
eor #4
|
|
sta @rnd1+1
|
|
lda @rnd2+1
|
|
eor #2
|
|
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 #24
|
|
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
|
|
bne ++ ; always branches
|
|
|
|
@stainc
|
|
ldy #0
|
|
sta (coord), y
|
|
inc coord
|
|
bne +
|
|
inc coord+1
|
|
+ rts
|
|
|
|
++
|
|
}
|