2021-12-11 02:50:10 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2017-2021 by qkumba/4am/John Brooks
|
|
|
|
;
|
|
|
|
!cpu 6502
|
|
|
|
!to "build/DGR.FIZZLE",plain
|
|
|
|
*=$6000
|
|
|
|
|
2021-12-13 03:13:46 +00:00
|
|
|
ldx #(end-start+1) ; copy LFSR code to zero page
|
|
|
|
- ldy start-2, x
|
|
|
|
sty $81, x
|
2021-12-11 05:56:05 +00:00
|
|
|
dex
|
2021-12-12 19:05:36 +00:00
|
|
|
bne -
|
2021-12-11 05:56:05 +00:00
|
|
|
|
2021-12-12 19:05:36 +00:00
|
|
|
jmp loop
|
2021-12-11 05:56:05 +00:00
|
|
|
|
|
|
|
start
|
2021-12-13 03:13:46 +00:00
|
|
|
!pseudopc $83 {
|
2021-12-11 05:56:05 +00:00
|
|
|
;X=0
|
|
|
|
;Y=0
|
|
|
|
loop txa
|
|
|
|
loop1 eor #$05 ; LFSR form 0x0500 with period 2047
|
2021-12-13 03:13:46 +00:00
|
|
|
wait inx
|
|
|
|
bpl wait
|
2021-12-11 05:56:05 +00:00
|
|
|
tax
|
|
|
|
loop2 tya
|
2021-12-11 02:50:10 +00:00
|
|
|
and #$78
|
|
|
|
cmp #$78
|
2021-12-11 05:56:05 +00:00
|
|
|
beq next
|
2021-12-12 21:56:51 +00:00
|
|
|
txa
|
|
|
|
ora #$04
|
2021-12-12 19:05:36 +00:00
|
|
|
sta <dst+2
|
2021-12-13 03:13:46 +00:00
|
|
|
txa
|
|
|
|
;C=0
|
|
|
|
adc #$7C
|
|
|
|
bpl aux
|
2021-12-11 02:50:10 +00:00
|
|
|
sta $C004
|
2021-12-13 03:13:46 +00:00
|
|
|
!byte $24
|
|
|
|
aux sta $C005
|
|
|
|
setsrc sta <src+2
|
2021-12-12 19:05:36 +00:00
|
|
|
src lda $FD00, y ; SMC high byte
|
|
|
|
dst sta $FD00, y ; SMC high byte
|
2021-12-11 05:56:05 +00:00
|
|
|
next txa
|
|
|
|
lsr
|
|
|
|
tax
|
|
|
|
tya
|
|
|
|
ror
|
|
|
|
tay
|
|
|
|
bcc loop2
|
|
|
|
bne loop
|
|
|
|
bit $C000
|
|
|
|
bmi exit
|
|
|
|
txa
|
|
|
|
bne loop1
|
2021-12-13 03:13:46 +00:00
|
|
|
exit lda $7C00 ; last lousy byte (because LFSR never hits 0)
|
|
|
|
!if *+1 != $C0 {
|
|
|
|
!error *
|
|
|
|
}
|
2021-12-11 05:56:05 +00:00
|
|
|
sta $0400
|
|
|
|
sta $C004
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
end
|