mirror of
https://github.com/a2-4am/4cade.git
synced 2024-05-29 03:41:30 +00:00
61 lines
1.3 KiB
Plaintext
61 lines
1.3 KiB
Plaintext
;license:MIT
|
|
;(c) 2019-2020 by qkumba/4am/John Brooks
|
|
|
|
!cpu 6502
|
|
!to "build/SHR.FIZZLE",plain
|
|
*=$A000
|
|
|
|
addrs=$80 ; [128 bytes]
|
|
|
|
ldx #(end-start) ; copy LFSR code to zero page
|
|
- lda start-1, x
|
|
sta $FF, x
|
|
dex
|
|
bne -
|
|
lda #$A0 ; create address lookup table
|
|
tax
|
|
tay
|
|
- dey
|
|
sty addrs-$21, x
|
|
dex
|
|
bne -
|
|
sta $C005
|
|
- lda $9D00, y ; pre-copy SHR SCB and palette
|
|
sta $9D00, y
|
|
lda $9E00, y
|
|
sta $9E00, y
|
|
lda $9F00, y
|
|
sta $9F00, y
|
|
iny
|
|
bne -
|
|
jmp loop
|
|
|
|
start
|
|
!pseudopc 0 {
|
|
loop txa
|
|
loop1 eor #$60 ; LFSR form 0x6000 with period 32767
|
|
tax
|
|
loop2 lda addrs, x
|
|
sta <src+1
|
|
src=*+1
|
|
lda $FD00, y ; SMC high byte
|
|
sta (<src), y
|
|
txa
|
|
lsr
|
|
tax
|
|
tya
|
|
ror
|
|
tay
|
|
bcc loop2
|
|
bne loop
|
|
bit $C000
|
|
bmi exit
|
|
txa
|
|
bne loop1
|
|
exit lda $2000 ; last lousy byte (because LFSR never hits 0)
|
|
sta $2000
|
|
sta $C004
|
|
rts
|
|
}
|
|
end
|