fast dhgr.fizzle.white, upgrade radial5.white

This commit is contained in:
Peter Ferrie 2020-11-17 21:19:25 -08:00
parent daa1989ede
commit 16f4ecc717
3 changed files with 53 additions and 3989 deletions

View File

@ -1,150 +1,61 @@
;license:MIT
;(c) 2017-2018 by qkumba
;(c) 2017-2020 by qkumba/4am/John Brooks
;
!cpu 6502
!to "build/FX/DHGR.FIZZLEWH",plain
*=$6000
!source "src/fx/fx.dhgr.common.a"
addrs=$C0 ; [$40 bytes]
+COPY_SELF_TO_AUXMEM
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
ldx #$1F ; build address lookup table
- txa
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
sta addrs, x
eor #$80
sta addrs+$20, x
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
bpl -
ldx #(end-start) ; copy LFSR code to zero page
- lda start-1, x
sta $0, x
dex
bne -
txa
and #$1f
tay
pha
pha
rts
;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
start
!pseudopc 1 {
; in: X,Y=0
loop txa
loop1 eor #$35 ; LFSR form 0x3500 with period 16383
tax
loop2 lda addrs, x
bpl +
and #$7F
sta $C003
sta $C005
+ sta <dst+2
lda #$FF
dst sta $FD00, y
sta $C002
sta $C004
txa
lsr
tax
tya
ror
tay
bcc loop2
bne loop
bit $C000
bmi exit
txa
bne loop1
exit lda #$FF ; last lousy byte (because LFSR never hits 0)
sta $2000
rts
}
end

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
!source "src/fx/fx.dhgr.precomputed.a"
+FX_INITONCE_DHGR CoordinatesFile, PostInit
+FX_RADIAL5_DHGR Coordinates
+COPY_SELF_TO_AUXMEM
PostInit
+FX_PRECOMPUTED_DHGR HGRHalfBlockToWhite, Coordinates, $0
@ -17,5 +18,5 @@ PostInit
Coordinates=CoordinatesDHGR
CoordinatesFile
!byte 17
!text "FX/DHGR.RAD5.DATA"
!byte 16
!text "FX/DHGR.RAD.DATA"