shave some bytes

This commit is contained in:
4am 2021-12-14 14:20:16 -05:00
parent 29512ad021
commit 4a4e78923b
38 changed files with 91 additions and 125 deletions

View File

@ -49,7 +49,7 @@ dst sta $FD00, y ; SMC high byte
bmi exit
txa
bne loop1
lda (src+1), y
lda (src+1), y ; last lousy byte
sta (dst+1), y
exit rts
}

View File

@ -1,100 +1,66 @@
;license:MIT
;(c) 2017-2019 by qkumba and 4am
;(c) 2017-2021 by qkumba/4am/John Brooks
!cpu 6502
!to "build/FX.INDEXED/PALETTE.FIZZLE",plain
*=$6000
copymask_even = $f0
copymask_odd = $f1
counter = $f2
!source "src/fx/macros.a" ; no code in here
!source "src/fx/macros.a"
;init masks
lda #%11010101
sta copymask_even
lda #%10101010
sta copymask_odd
lda #2
sta counter
@outerloop
;init RNG
ldx #1
stx @rnd1+1
ldx #(end-start+1) ; copy LFSR code to zero page
- ldy start-2, x
sty $FE, x
dex
stx @rnd2+1
;iterate
@loop
ldy @rnd1+1
ldx @rnd2+1
lsr @rnd2+1
ror @rnd1+1
bcc +
;feedback polynomial forms #$100D for period of 8191
lda @rnd1+1
eor #$0d
sta @rnd1+1
lda @rnd2+1
eor #$10
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
;target page 1
bne -
bit <exit
jmp loop
start
!pseudopc 0 {
;X=0
;Y=0
loop txa
loop1 eor #$1B ; LFSR form 0x1B00 with period 8191
wait dex
bpl wait
tax
loop2 txa
ora #$20
sta $27
sta <dst+2
eor #$60
sta $3d
;copy pixel from other page to this page
ldy #0
lda $26
sta <src+2
tya
ror
bcs @odd
lda ($26),y
eor ($3c),y
and copymask_even
eor ($26),y
sta ($26),y
jmp @next
@odd
lda ($26),y
eor ($3c),y
and copymask_odd
eor ($26),y
sta ($26),y
@next
lda $c000
bmi @exit
;and exit condition
@rnd2 lda #0
bne @loop
@rnd1 lda #0
cmp #1
bne @loop
lda #$FF
sta copymask_even
sta copymask_odd
dec counter
+LBNE @outerloop
@exit rts
bcs odd
even lda #%11010101 ; SMC
bne + ; always branches
odd lda #%10101010 ; SMC
+ sta <mask+1
src and $FD00, y ; SMC high byte
eor (dst+1), y
mask and #$FD ; SMC
eor (dst+1), y
dst sta $FD00, y ; SMC high byte
txa
lsr
tax
tya
ror
tay
bcc loop2
bne loop
lda $C000
bmi exit
txa
bne loop1
bvc llb
lda #%11111111
sta <even+1
sta <odd+1
clv
bvc loop ; always branches
llb lda (src+1), y ; last lousy byte
sta (dst+1), y
exit rts
}
end

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10949076
!be24 10949039
!le16 4281

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10901862
!be24 10901825
!le16 5239

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10844721
!be24 10844684
!le16 3586

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10857091
!be24 10857054
!le16 3946

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10872490
!be24 10872453
!le16 4998

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10890142
!be24 10890105
!le16 5571

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10953357
!be24 10953320
!le16 410

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10954111
!be24 10954074
!le16 448

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10954559
!be24 10954522
!le16 303

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10909247
!be24 10909210
!le16 1242

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10953843
!be24 10953806
!le16 67

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10949017
!be24 10948980
!le16 59

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947687
!be24 10947650
!le16 1249

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10933677
!be24 10933640
!le16 464

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10907101
!be24 10907064
!le16 2146

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10910720
!be24 10910683
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10953767
!be24 10953730
!le16 76

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10948936
!be24 10948899
!le16 81

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10953910
!be24 10953873
!le16 201

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10934141
!be24 10934104
!le16 4407

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10938548
!be24 10938511
!le16 1533

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10940081
!be24 10940044
!le16 1040

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10941121
!be24 10941084
!le16 3237

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10944358
!be24 10944321
!le16 2764

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947122
!be24 10947085
!le16 460

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947582
!be24 10947545
!le16 105

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10954862
!be24 10954825
!le16 2370

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10921782
!be24 10921745
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10895713
!be24 10895676
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10836689
!be24 10836652
!le16 8032

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10848307
!be24 10848270
!le16 8784

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10861037
!be24 10861000
!le16 11453

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10877488
!be24 10877451
!le16 12654

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10910489
!be24 10910452
!le16 231

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10916869
!be24 10916832
!le16 4913

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10927931
!be24 10927894
!le16 5746