factor out more FX routines

This commit is contained in:
4am 2024-05-29 18:52:01 -04:00
parent 965d7bed5f
commit 3a5d2d3830
53 changed files with 157 additions and 158 deletions

View File

@ -163,7 +163,6 @@ gGlobalPrefsStore
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed3Bit, HGRPrecomputed3Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates3Bit, RippleCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates3Bit, ReverseCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iSetupPrecomputed3Bit, SetupPrecomputed3Bit
+DEFINE_INDIRECT_VECTOR iDHGRDitherPrecomputed2Bit, DHGRDitherPrecomputed2Bit
+DEFINE_INDIRECT_VECTOR iDHGRPrecomputed2Bit, DHGRPrecomputed2Bit
+DEFINE_INDIRECT_VECTOR iHGRDitherPrecomputed2Bit, HGRDitherPrecomputed2Bit
@ -174,6 +173,7 @@ gGlobalPrefsStore
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iDHGRDitherPrecomputed1Bit, DHGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iDHGRPrecomputed1Bit, DHGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRRadialPrecomputed1Bit, HGRRadialPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRDitherPrecomputed1Bit, HGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed1Bit, HGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks1Bit, BuildDHGRSparseBitmasks1Bit

View File

@ -229,7 +229,8 @@ iBuildHGRSparseBitmasks1Bit = iRippleCoordinates1Bit4-3
iBuildDHGRSparseBitmasks1Bit = iBuildHGRSparseBitmasks1Bit-3
iHGRPrecomputed1Bit = iBuildDHGRSparseBitmasks1Bit-3
iHGRDitherPrecomputed1Bit = iHGRPrecomputed1Bit-3
iDHGRPrecomputed1Bit = iHGRDitherPrecomputed1Bit-3
iHGRRadialPrecomputed1Bit = iHGRDitherPrecomputed1Bit-3
iDHGRPrecomputed1Bit = iHGRRadialPrecomputed1Bit-3
iDHGRDitherPrecomputed1Bit = iDHGRPrecomputed1Bit-3
iBuildHGRSparseBitmasks2Bit = iDHGRDitherPrecomputed1Bit-3
iBuildDHGRSparseBitmasks2Bit = iBuildHGRSparseBitmasks2Bit-3
@ -239,8 +240,7 @@ iHGRPrecomputed2Bit = iRippleCoordinates2Bit-3
iHGRDitherPrecomputed2Bit = iHGRPrecomputed2Bit-3
iDHGRPrecomputed2Bit = iHGRDitherPrecomputed2Bit-3
iDHGRDitherPrecomputed2Bit = iDHGRPrecomputed2Bit-3
iSetupPrecomputed3Bit = iDHGRDitherPrecomputed2Bit-3
iReverseCoordinates3Bit = iSetupPrecomputed3Bit-3
iReverseCoordinates3Bit = iDHGRDitherPrecomputed2Bit-3
iRippleCoordinates3Bit = iReverseCoordinates3Bit-3
iHGRPrecomputed3Bit = iRippleCoordinates3Bit-3
iHGRDitherPrecomputed3Bit = iHGRPrecomputed3Bit-3

View File

@ -26,6 +26,7 @@
; - RippleCoordinates1Bit4
; - HGRPrecomputed1Bit
; - HGRDitherPrecomputed1Bit
; - HGRRadialPrecomputed1Bit
; - DHGRPrecomputed1Bit
; - DHGRDitherPrecomputed1Bit
@ -38,7 +39,6 @@
; - DHGRPrecomputed2Bit
; - DHGRDitherPrecomputed2Bit
; - SetupPrecomputed3Bit
; - ReverseCoordinates3Bit
; - RippleCoordinates3Bit
; - HGRPrecomputed3Bit
@ -732,6 +732,85 @@ DHGRPrecomputed1Bit
.end
}
!zone {
HGRRadialPrecomputed1Bit
.mirror_src1 = $E8 ; word
.mirror_dest1 = $EA ; word
.mirror_src2 = $EC ; word
.mirror_dest2 = $EE ; word
.src1 = $F0 ; word
.dest1 = $F2 ; word
.src2 = $F4 ; word
.dest2 = $F6 ; word
.reverse_input = $FC ; word
.input = $FE ; word
jsr BuildHGRMirrorCols
jsr BuildHGRTables
jsr BuildHGRMirrorTables
jsr BuildHGRSparseBitmasks1Bit
+LDADDR Coordinates1Bit
+ST16 .input
+LDADDR EndCoordinates1Bit-2
+ST16 .reverse_input
+HIDE_NEXT_BYTE
.Exit rts
.Loop ldy #0
lda (.input),y
bmi .Exit
tax
+ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2
+ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2
inc .input
lda (.input),y
+HIGH_3_LOW_5 .input
; top-left quadrant (original row, original column, original input order)
+COPY_BIT .src1, .dest1, copymasks1bit
+COPY_BIT .src2, .dest2, copymasks1bit
; bottom-right quadrant (opposite row, opposite column, original input order)
lda mirror_cols,y
tay
+COPY_BIT .mirror_src1, .mirror_dest1, mirror_copymasks1bit
+COPY_BIT .mirror_src2, .mirror_dest2, mirror_copymasks1bit
ldy #0
lda (.reverse_input),y
tax
+ROW_X_TO_BASE_ADDRESSES .src1, .src2, .dest1, .dest2
+ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2
iny
lda (.reverse_input),y
+HIGH_3_LOW_5 .reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT .mirror_src1, .mirror_dest1, copymasks1bit
+COPY_BIT .mirror_src2, .mirror_dest2, copymasks1bit
; top-right quadrant (same row, opposite column, reverse input order)
lda mirror_cols,y
tay
+COPY_BIT .src1, .dest1, mirror_copymasks1bit
+COPY_BIT .src2, .dest2, mirror_copymasks1bit
inc .input
bne +
inc .input+1
+ lda .reverse_input
php
dec .reverse_input
dec .reverse_input
plp
bne +
dec .reverse_input+1
bit KBD
bmi ++
+ jmp .Loop
++ rts
}
!zone {
DHGRDitherPrecomputed1Bit
jsr BuildDHGRDitherMasks

View File

@ -6,12 +6,12 @@
*=$6000
!source "src/fx/fx.hgr.precomputed.1bit.a"
!source "src/fx/fx.hgr.radial.common.a"
!if * and 1 {
!byte 0
}
Coordinates
!source "src/fx/fx.hgr.full.of.stars.data.a"
EndCoordinates
!byte $80
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "FULL.STARS.DATA"
Coordinates=Coordinates1Bit
EndCoordinates=EndCoordinates1Bit

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/FULL.STARS.DATA",plain
*=$8600
!byte $18,%00000101
!byte $0E,%11010011
!byte $48,%11001110

View File

@ -6,12 +6,10 @@
*=$6000
!source "src/fx/fx.hgr.precomputed.1bit.a"
!source "src/fx/fx.hgr.radial.common.a"
!if * and 1 {
!byte 0
}
Coordinates
!source "src/fx/fx.hgr.pinwheels.data.a"
EndCoordinates
!byte $80
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "PINWHEELS.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/PINWHEELS.DATA",plain
*=$8600
!byte $0C,%11000100
!byte $24,%11010011
!byte $5E,%01110001

View File

@ -6,12 +6,10 @@
*=$6000
!source "src/fx/fx.hgr.precomputed.1bit.a"
!source "src/fx/fx.hgr.radial.common.a"
!if * and 1 {
!byte 0
}
Coordinates
!source "src/fx/fx.hgr.radbubbles.data.a"
EndCoordinates
!byte $80
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "RADBUBBLES.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/RADBUBBLES.DATA",plain
*=$8600
!byte $16,%11000100
!byte $18,%00000101
!byte $18,%00001111

View File

@ -1,79 +0,0 @@
;license:MIT
;(c) 2019-2022 by 4am
;
mirror_src1 = $E8 ; word
mirror_dest1 = $EA ; word
mirror_src2 = $EC ; word
mirror_dest2 = $EE ; word
src1 = $F0 ; word
dest1 = $F2 ; word
src2 = $F4 ; word
dest2 = $F6 ; word
reverse_input = $FC ; word
input = $FE ; word
jsr iBuildHGRMirrorCols
jsr iBuildHGRTables
jsr iBuildHGRMirrorTables
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR Coordinates
+ST16 input
+LDADDR EndCoordinates-2
+ST16 reverse_input
+HIDE_NEXT_BYTE
Exit rts
Loop ldy #0
lda (input),y
bmi Exit
tax
+ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2
+ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2
inc input
lda (input),y
+HIGH_3_LOW_5 input
; top-left quadrant (original row, original column, original input order)
+COPY_BIT src1, dest1, copymasks1bit
+COPY_BIT src2, dest2, copymasks1bit
; bottom-right quadrant (opposite row, opposite column, original input order)
lda mirror_cols,y
tay
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
ldy #0
lda (reverse_input),y
tax
+ROW_X_TO_BASE_ADDRESSES src1, src2, dest1, dest2
+ROW_X_TO_MIRROR_ADDRESSES mirror_src1, mirror_src2, mirror_dest1, mirror_dest2
iny
lda (reverse_input),y
+HIGH_3_LOW_5 reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
; top-right quadrant (same row, opposite column, reverse input order)
lda mirror_cols,y
tay
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
inc input
bne +
inc input+1
+ lda reverse_input
php
dec reverse_input
dec reverse_input
plp
bne +
dec reverse_input+1
bit $c000
bmi ++
+ jmp Loop
++ rts

View File

@ -11,9 +11,7 @@
jsr iRippleCoordinates1Bit
Start
!source "src/fx/fx.hgr.radial.common.a"
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "RADIAL.DATA"
Coordinates=Coordinates1Bit
EndCoordinates=EndCoordinates1Bit

View File

@ -11,9 +11,7 @@
jsr iRippleCoordinates1Bit2
Start
!source "src/fx/fx.hgr.radial.common.a"
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "RADIAL.DATA"
Coordinates=Coordinates1Bit
EndCoordinates=EndCoordinates1Bit

View File

@ -11,9 +11,7 @@
jsr iRippleCoordinates1Bit3
Start
!source "src/fx/fx.hgr.radial.common.a"
jmp iHGRRadialPrecomputed1Bit
CoordinatesFile
+PSTRING "RADIAL.DATA"
Coordinates=Coordinates1Bit
EndCoordinates=EndCoordinates1Bit

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15885374
!be24 15883695
!le16 5130

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15830032
!be24 15828288
!le16 5732

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15761799
!be24 15760055
!le16 4194

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15776513
!be24 15774769
!le16 4652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15795228
!be24 15793484
!le16 5621

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15816269
!be24 15814525
!le16 6199

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15891258
!be24 15889579
!le16 449

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 12658017
!be24 12656273
!le16 1652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15838404
!be24 15836660
!le16 1640

View File

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

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15883735
!be24 15882056
!le16 1426

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15868501
!be24 15866822
!le16 557

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15835764
!be24 15834020
!le16 2640

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15840402
!le16 473
!be24 15838658
!le16 538

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15840875
!be24 15839196
!le16 7564

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15885161
!be24 15883482
!le16 154

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15869058
!be24 15867379
!le16 4334

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15873392
!be24 15871713
!le16 1733

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15875125
!be24 15873446
!le16 1181

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15876306
!be24 15874627
!le16 3394

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15879700
!be24 15878021
!le16 3429

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15883129
!be24 15881450
!le16 479

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15883608
!be24 15881929
!le16 127

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15853844
!be24 15852165
!le16 5083

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15858927
!be24 15857248
!le16 2485

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15822468
!be24 15820724
!le16 7564

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15752216
!be24 15750472
!le16 9583

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15765993
!be24 15764249
!le16 10520

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15781165
!be24 15779421
!le16 14063

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15800849
!be24 15799105
!le16 15420

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15840044
!be24 15838300
!le16 358

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15848439
!be24 15846760
!le16 5405

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15861412
!be24 15859733
!le16 7089

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15747868
!be24 15746124
!le16 4348