1
0
mirror of https://github.com/a2-4am/4cade.git synced 2025-02-19 05:30:51 +00:00

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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