factor out more FX routines

This commit is contained in:
4am 2024-05-28 09:42:19 -04:00
parent af538414ff
commit 90a6f55ddf
59 changed files with 137 additions and 137 deletions

View File

@ -161,6 +161,7 @@ gGlobalPrefsStore
+DEFINE_INDIRECT_VECTOR iReverseCoordinates2Bit, ReverseCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks2Bit, BuildDHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed1Bit, HGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks1Bit, BuildDHGRSparseBitmasks1Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks1Bit, BuildHGRSparseBitmasks1Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit4, RippleCoordinates1Bit4

View File

@ -192,7 +192,8 @@ iRippleCoordinates1Bit3 = iRippleCoordinates1Bit2-3
iRippleCoordinates1Bit4 = iRippleCoordinates1Bit3-3
iBuildHGRSparseBitmasks1Bit = iRippleCoordinates1Bit4-3
iBuildDHGRSparseBitmasks1Bit = iBuildHGRSparseBitmasks1Bit-3
iBuildHGRSparseBitmasks2Bit = iBuildDHGRSparseBitmasks1Bit-3
iHGRPrecomputed1Bit = iBuildDHGRSparseBitmasks1Bit-3
iBuildHGRSparseBitmasks2Bit = iHGRPrecomputed1Bit-3
iBuildDHGRSparseBitmasks2Bit = iBuildHGRSparseBitmasks2Bit-3
iReverseCoordinates2Bit = iBuildDHGRSparseBitmasks2Bit-3
iRippleCoordinates2Bit = iReverseCoordinates2Bit-3

View File

@ -24,6 +24,7 @@
; - RippleCoordinates1Bit2
; - RippleCoordinates1Bit3
; - RippleCoordinates1Bit4
; - HGRPrecomputed1Bit
; - BuildHGRSparseBitmasks2Bit
; - BuildDHGRSparseBitmasks2Bit
@ -34,6 +35,12 @@
; - ReverseCoordinates3Bit
; - RippleCoordinates3Bit
!source "src/fx/macros.hgr.a"
!source "src/fx/macros.dhgr.a"
!source "src/fx/macros.shr.a"
!source "src/fx/macros.copybit.a"
!source "src/fx/macros.misc.a"
WaitForKeyWithTimeout
; in: A = timeout length (like standard $FCA8 wait routine)
; out: A clobbered (not always 0 if key is pressed, but also not the key pressed)
@ -415,6 +422,78 @@ aslmod cmp #$1A
exit rts
}
!zone {
HGRPrecomputed1Bit
jsr BuildHGRTables
jsr BuildHGRMirrorTables
jsr BuildHGRMirrorCols
jsr BuildHGRSparseBitmasks1Bit
+COPY_TO_0 start, end
jmp InputLoop
start
!pseudopc 0 {
Exit1Bit rts
InputLoop
ldy #0
input=*+1
ldx Coordinates1Bit ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1Bit ; if > 127 then we're done
+ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES
inc input
lda (input), y
+HIGH_3_LOW_5 input
; main 1x2 block in top-left quadrant
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks1bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks1bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols, y
tay
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
mirror_src1=*+1
lda $FDFD, y
eor (<mirror_dest1), y
and mirror_copymasks1bit, x
eor (<mirror_dest1), y
mirror_dest1=*+1
sta $FDFD, y
mirror_src2=*+1
lda $FDFD, y
eor (<mirror_dest2), y
and mirror_copymasks1bit, x
eor (<mirror_dest2), y
mirror_dest2=*+1
sta $FDFD, y
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols, y
tay
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+INC_INPUT_AND_LOOP InputLoop
}
end
}
BuildHGRSparseBitmasks2Bit
lda #%10000011
sta copymasks2bit

View File

@ -7,9 +7,7 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
+FX_INITONCE_1BIT CoordinatesFile, iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "BUBBLES.DATA"

View File

@ -10,7 +10,7 @@
+FX_INITONCE_1BIT CoordinatesFile, Start
jsr iReverseCoordinates1Bit
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "BUBBLES.DATA"

View File

@ -7,9 +7,7 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
+FX_INITONCE_1BIT CoordinatesFile, iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "CORNER4.DATA"

View File

@ -10,7 +10,7 @@
+FX_INITONCE_1BIT CoordinatesFile, Start
jsr iReverseCoordinates1Bit
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "CORNER4.DATA"

View File

@ -11,7 +11,7 @@
jsr iRippleCoordinates1Bit2
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "CORNER4.DATA"

View File

@ -7,9 +7,7 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
+FX_INITONCE_1BIT CoordinatesFile, iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "IRIS.DATA"

View File

@ -10,7 +10,7 @@
+FX_INITONCE_1BIT CoordinatesFile, Start
jsr iReverseCoordinates1Bit
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "IRIS.DATA"

View File

@ -38,77 +38,6 @@ InitOnce
sta EndCoordinates1Bit
}
!macro FX_PRECOMPUTED_1BIT .coords {
jsr iBuildHGRTables
jsr iBuildHGRMirrorTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks1Bit
+COPY_TO_0 start, end
jmp InputLoop
start
!pseudopc 0 {
Exit1Bit rts
InputLoop
ldy #0
input=*+1
ldx .coords ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1Bit ; if > 127 then we're done
+ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES
inc input
lda (input), y
+HIGH_3_LOW_5 input
; main 1x2 block in top-left quadrant
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks1bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks1bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols, y
tay
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
mirror_src1=*+1
lda $FDFD, y
eor (<mirror_dest1), y
and mirror_copymasks1bit, x
eor (<mirror_dest1), y
mirror_dest1=*+1
sta $FDFD, y
mirror_src2=*+1
lda $FDFD, y
eor (<mirror_dest2), y
and mirror_copymasks1bit, x
eor (<mirror_dest2), y
mirror_dest2=*+1
sta $FDFD, y
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols, y
tay
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+INC_INPUT_AND_LOOP InputLoop
}
end
}
!macro FX_PRECOMPUTED_1BIT_DITHER .coords, .endcoords {
jsr iBuildHGRDitherMasks
jsr iBuildHGRTables

View File

@ -11,7 +11,7 @@
jsr iRippleCoordinates1Bit2
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "IRIS.DATA"

View File

@ -7,9 +7,7 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
+FX_INITONCE_1BIT CoordinatesFile, iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SLOW.STAR.DATA"

View File

@ -10,7 +10,7 @@
+FX_INITONCE_1BIT CoordinatesFile, Start
jsr iReverseCoordinates1Bit
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SLOW.STAR.DATA"

View File

@ -11,7 +11,7 @@
jsr iRippleCoordinates1Bit2
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SLOW.STAR.DATA"

View File

@ -7,9 +7,7 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
+FX_INITONCE_1BIT CoordinatesFile, iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SNOWFLAKE.DATA"

View File

@ -10,7 +10,7 @@
+FX_INITONCE_1BIT CoordinatesFile, Start
jsr iReverseCoordinates1Bit
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SNOWFLAKE.DATA"

View File

@ -11,7 +11,7 @@
jsr iRippleCoordinates1Bit2
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "SNOWFLAKE.DATA"

View File

@ -11,7 +11,7 @@
jsr iRippleCoordinates1Bit4
Start
+FX_PRECOMPUTED_1BIT Coordinates1Bit
jmp iHGRPrecomputed1Bit
CoordinatesFile
+PSTRING "CORNER4.DATA"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15865043
!be24 15861638
!le16 451

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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