factor out more FX routines

This commit is contained in:
4am 2024-05-29 12:24:29 -04:00
parent efdbb8218e
commit 70f62c2e66
60 changed files with 354 additions and 346 deletions

View File

@ -159,38 +159,40 @@ gGlobalPrefsStore
; be set to $55 as part of the 64K memory test,
; which is apparently one of the acceptable values)
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed3Bit, HGRPrecomputed3Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates3Bit, RippleCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates3Bit, ReverseCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iSetupPrecomputed3Bit, SetupPrecomputed3Bit
+DEFINE_INDIRECT_VECTOR iDHGRPrecomputed2Bit, DHGRPrecomputed2Bit
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed2Bit, HGRPrecomputed2Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates2Bit, RippleCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates2Bit, ReverseCoordinates2Bit
+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
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed2Bit, HGRPrecomputed2Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates2Bit, RippleCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates2Bit, ReverseCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks2Bit, BuildDHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iDHGRDitherPrecomputed1Bit, DHGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iDHGRPrecomputed1Bit, DHGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRDitherPrecomputed1Bit, HGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed1Bit, HGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
+DEFINE_INDIRECT_VECTOR iDHGRDitherPrecomputed1Bit, DHGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iDHGRPrecomputed1Bit, DHGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRDitherPrecomputed1Bit, HGRDitherPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iHGRPrecomputed1Bit, HGRPrecomputed1Bit
+DEFINE_INDIRECT_VECTOR iBuildDHGRSparseBitmasks1Bit, BuildDHGRSparseBitmasks1Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks1Bit, BuildHGRSparseBitmasks1Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit4, RippleCoordinates1Bit4
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit3, RippleCoordinates1Bit3
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit2, RippleCoordinates1Bit2
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit, RippleCoordinates1Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates1Bit, ReverseCoordinates1Bit
+DEFINE_INDIRECT_VECTOR iWaitForKeyWithTimeout, WaitForKeyWithTimeout
+DEFINE_INDIRECT_VECTOR iBuildDHGRDitherMasks, BuildDHGRDitherMasks
+DEFINE_INDIRECT_VECTOR iBuildHGRDitherMasks, BuildHGRDitherMasks
+DEFINE_INDIRECT_VECTOR iBuildDHGRMirrorCols, BuildDHGRMirrorCols
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorCols, BuildHGRMirrorCols
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorTables, BuildHGRMirrorTables
+DEFINE_INDIRECT_VECTOR iBuildHGRTables, BuildHGRTables
+DEFINE_INDIRECT_VECTOR iLoadFXDATA, LoadFXDATA
+DEFINE_INDIRECT_VECTOR iLoadXSingle, LoadXSingle
+DEFINE_INDIRECT_VECTOR iAddToPath, AddToPath
+DEFINE_INDIRECT_VECTOR iLoadFileDirect, LoadFileDirect
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks1Bit, BuildHGRSparseBitmasks1Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit4, RippleCoordinates1Bit4
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit3, RippleCoordinates1Bit3
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit2, RippleCoordinates1Bit2
+DEFINE_INDIRECT_VECTOR iRippleCoordinates1Bit, RippleCoordinates1Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates1Bit, ReverseCoordinates1Bit
+DEFINE_INDIRECT_VECTOR iWaitForKeyWithTimeout, WaitForKeyWithTimeout
+DEFINE_INDIRECT_VECTOR iBuildDHGRDitherMasks, BuildDHGRDitherMasks
+DEFINE_INDIRECT_VECTOR iBuildHGRDitherMasks, BuildHGRDitherMasks
+DEFINE_INDIRECT_VECTOR iBuildDHGRMirrorCols, BuildDHGRMirrorCols
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorCols, BuildHGRMirrorCols
+DEFINE_INDIRECT_VECTOR iBuildHGRMirrorTables, BuildHGRMirrorTables
+DEFINE_INDIRECT_VECTOR iBuildHGRTables, BuildHGRTables
+DEFINE_INDIRECT_VECTOR iLoadFXDATA, LoadFXDATA
+DEFINE_INDIRECT_VECTOR iLoadXSingle, LoadXSingle
+DEFINE_INDIRECT_VECTOR iAddToPath, AddToPath
+DEFINE_INDIRECT_VECTOR iLoadFileDirect, LoadFileDirect
; SMC to RTS on a II+
+DEFINE_INDIRECT_VECTOR WaitForVBL, WaitForVBL_iie
!if (RELBASE != $2000) and (* != UnwaitForVBL) { !serious "UnwaitForVBL=",*,", fix constants.a" }

View File

@ -201,8 +201,10 @@ iBuildDHGRSparseBitmasks2Bit = iBuildHGRSparseBitmasks2Bit-3
iReverseCoordinates2Bit = iBuildDHGRSparseBitmasks2Bit-3
iRippleCoordinates2Bit = iReverseCoordinates2Bit-3
iHGRPrecomputed2Bit = iRippleCoordinates2Bit-3
iDHGRPrecomputed2Bit = iHGRPrecomputed2Bit-3
iSetupPrecomputed3Bit = iDHGRPrecomputed2Bit-3
iHGRDitherPrecomputed2Bit = iHGRPrecomputed2Bit-3
iDHGRPrecomputed2Bit = iHGRDitherPrecomputed2Bit-3
iDHGRDitherPrecomputed2Bit = iDHGRPrecomputed2Bit-3
iSetupPrecomputed3Bit = iDHGRDitherPrecomputed2Bit-3
iReverseCoordinates3Bit = iSetupPrecomputed3Bit-3
iRippleCoordinates3Bit = iReverseCoordinates3Bit-3
iHGRPrecomputed3Bit = iRippleCoordinates3Bit-3

View File

@ -34,7 +34,9 @@
; - ReverseCoordinates2Bit
; - RippleCoordinates2Bit
; - HGRPrecomputed2Bit
; - HGRDitherPrecomputed2Bit
; - DHGRPrecomputed2Bit
; - DHGRDitherPrecomputed2Bit
; - SetupPrecomputed3Bit
; - ReverseCoordinates3Bit
@ -448,7 +450,7 @@ HGRPrecomputed1Bit
+ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2
inc .input
lda (.input), y
lda (<.input), y
+HIGH_3_LOW_5 .input
; main 1x2 block in top-left quadrant
@ -657,7 +659,7 @@ DHGRPrecomputed1Bit
+ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2
inc .input
lda (.input), y
lda (<.input), y
+HIGH_3_LOW_5 .input
sty <.y
clc
@ -786,7 +788,7 @@ DHGRDitherPrecomputed1Bit
+ROW_X_TO_MIRROR_ADDRESSES .mirror_src1, .mirror_src2, .mirror_dest1, .mirror_dest2
iny
lda (.input), y
lda (<.input), y
+HIGH_3_LOW_5 .input
sty <.y
clc
@ -1182,6 +1184,129 @@ HGRPrecomputed2Bit
.end
}
!zone {
HGRDitherPrecomputed2Bit
jsr BuildHGRDitherMasks
jsr BuildHGRTables
jsr BuildHGRMirrorCols
jsr BuildHGRSparseBitmasks2Bit
; phase 1 - in reverse, with additional masking (dithering)
jsr .copytozp
; set up starting coordinate for reading coordinates in reverse order
+LDADDR Coordinates2Bit-2
sta <.input
sty <.input+1
; set up EOF marker to stop reading coordinates in reverse order
lda #$00
sta Coordinates2Bit-2
; set up logic to advance to next coordinates in reverse order
ldx #(.next2_end-.next2_start-1)
- lda .next2_start, x
sta <.next, x
dex
bpl -
jsr .InputLoop
bit KBD
bmi .start
; phase 2 - in order, without additional masking
jsr .copytozp
; redirect additional masking pointers to an array that contains #$FFs (so no dithering)
lda #<no_masks
sta <.evenrow_ptr
sta <.oddrow_ptr
jmp .InputLoop
.copytozp
+COPY_TO_0 .start, .end
.start
!pseudopc 0 {
.Exit2Bit rts
.evenrow_ptr
!word evenrow_masks
.oddrow_ptr
!word oddrow_masks
.InputLoop
ldy #0
.input=*+1
ldx Coordinates2Bit ; first value: HGR row + 1
beq .Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES .src1, .src2, .dest1, .dest2
iny
lda (<.input), y
+HIGH_3_LOW_5 .input
; main 2x2 block in left half
.src1=*+1
lda $FDFD, y
eor (<.dest1), y
and copymasks2bit, x
and (<.evenrow_ptr), y
eor (<.dest1), y
.dest1=*+1
sta $FDFD, y
.src2=*+1
lda $FDFD, y
eor (<.dest2), y
and copymasks2bit, x
and (<.oddrow_ptr), y
eor (<.dest2), y
.dest2=*+1
sta $FDFD, y
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
lda (<.src1), y
eor (<.dest1), y
and mirror_copymasks2bit, x
and (<.evenrow_ptr), y
eor (<.dest1), y
sta (<.dest1), y
lda (<.src2), y
eor (<.dest2), y
and mirror_copymasks2bit, x
and (<.oddrow_ptr), y
eor (<.dest2), y
sta (<.dest2), y
.next
inc <.input
inc <.input
bne .InputLoop
bit KBD
bmi .Exit2Bit
inc <.input+1
bne .InputLoop ; always branches
}
.end
.next2_start
!pseudopc .next {
lda <.input
php
dec <.input
dec <.input
plp
bne .InputLoop
dec <.input+1
bit KBD
bpl .InputLoop
rts
}
.next2_end
}
!zone {
DHGRPrecomputed2Bit
jsr BuildDHGRSparseBitmasks2Bit
@ -1257,6 +1382,141 @@ DHGRPrecomputed2Bit
.end
}
!zone {
DHGRDitherPrecomputed2Bit
jsr BuildDHGRDitherMasks
jsr BuildDHGRSparseBitmasks2Bit
jsr BuildHGRTables
jsr BuildDHGRMirrorCols
; phase 1 - in reverse, with additional masking (dithering)
jsr .copytozp
; set up starting coordinate for reading coordinates in reverse order
+LDADDR Coordinates2Bit-2
sta <.input
sty <.input+1
; set up EOF marker to stop reading coordinates in reverse order
lda #$00
sta Coordinates2Bit-2
; set up logic to advance to next coordinates in reverse order
ldx #(.next2_end-.next2_start-1)
- lda .next2_start, x
sta <.next, x
dex
bpl -
jsr .InputLoop
bit KBD
bmi .start
; phase 2 - in order, without additional masking
jsr .copytozp
; redirect additional masking pointers to an array that contains #$FFs (so no dithering)
lda #<no_masks
sta <.evenrow_ptr
sta <.oddrow_ptr
jmp .InputLoop
.copytozp
+COPY_TO_0 .start, .end
.start
!pseudopc 0 {
.Exit2Bit rts
.evenrow_ptr
!word evenrow_masks
.oddrow_ptr
!word oddrow_masks
.InputLoop
ldy #0
.input=*+1
ldx Coordinates2Bit ; first value: HGR row + 1
beq .Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES .src1, .src2, .dest1, .dest2
iny
lda (<.input), y
+HIGH_3_LOW_5 .input
; main 2x2 block in left half
clc
- lda copymasks2bit, x
beq +
.src1=*+1
lda $FDFD, y
eor (<.dest1), y
and copymasks2bit, x
and (<.evenrow_ptr), y
eor (<.dest1), y
.dest1=*+1
sta $FDFD, y
.src2=*+1
lda $FDFD, y
eor (<.dest2), y
and copymasks2bit, x
and (<.oddrow_ptr), y
eor (<.dest2), y
.dest2=*+1
sta $FDFD, y
+ bcs +
sta READAUXMEM
sta WRITEAUXMEM
sec
bcs -
+ sta READMAINMEM
sta WRITEMAINMEM
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
clc
- lda mirror_copymasks2bit, x
beq +
+COPY_BIT_DITHER .src1, .dest1, mirror_copymasks2bit, .evenrow_ptr
+COPY_BIT_DITHER .src2, .dest2, mirror_copymasks2bit, .oddrow_ptr
+ bcs +
sta READAUXMEM
sta WRITEAUXMEM
sec
bcs -
+ sta READMAINMEM
sta WRITEMAINMEM
.next
inc <.input
inc <.input
bne +
bit KBD
bmi ++
inc <.input+1
+ jmp .InputLoop
++ rts
}
.end
.next2_start
!pseudopc .next {
lda <.input
php
dec <.input
dec <.input
plp
bne +
dec <.input+1
bit KBD
bmi ++
+ jmp .InputLoop
++ rts
}
.next2_end
}
SetupPrecomputed3Bit
; build regular HGR lookup tables, then split them
jsr BuildHGRTables

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "BUTTERFLY.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "HEART.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "MAPLE.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "SOFT.IRIS.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "STAR.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "STAR7.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "WAVY.IRIS.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iDHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "W.IR.BLOOM.DATA"

View File

@ -2,137 +2,3 @@
;(c) 2019-2020 by 4am
;
!source "src/fx/fx.hgr.precomputed.2bit.a"
!macro FX_PRECOMPUTED_2BIT_DHGR_DITHER .coords, .endcoords {
jsr iBuildDHGRDitherMasks
jsr iBuildDHGRSparseBitmasks2Bit
jsr iBuildHGRTables
jsr iBuildDHGRMirrorCols
; phase 1 - in reverse, with additional masking (dithering)
jsr copytozp
; set up starting coordinate for reading coordinates in reverse order
+LDADDR .endcoords-2
sta <input
sty <input+1
; set up EOF marker to stop reading coordinates in reverse order
lda #$00
sta .coords-2
; set up logic to advance to next coordinates in reverse order
ldx #(next2_end-next2_start-1)
- lda next2_start, x
sta <next, x
dex
bpl -
jsr InputLoop
bit KBD
bmi start
; phase 2 - in order, without additional masking
jsr copytozp
; redirect additional masking pointers to an array that contains #$FFs (so no dithering)
lda #<no_masks
sta <evenrow_ptr
sta <oddrow_ptr
jmp InputLoop
copytozp
+COPY_TO_0 start, end
start
!pseudopc 0 {
Exit2Bit rts
evenrow_ptr
!word evenrow_masks
oddrow_ptr
!word oddrow_masks
InputLoop
ldy #0
input=*+1
ldx .coords ; first value: HGR row + 1
beq Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES src1, src2, dest1, dest2
iny
lda (<input), y
+HIGH_3_LOW_5 input
; main 2x2 block in left half
clc
- lda copymasks2bit, x
beq +
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks2bit, x
and (<evenrow_ptr), y
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks2bit, x
and (<oddrow_ptr), y
eor (<dest2), y
dest2=*+1
sta $FDFD, y
+ bcs +
sta READAUXMEM
sta WRITEAUXMEM
sec
bcs -
+ sta READMAINMEM
sta WRITEMAINMEM
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
clc
- lda mirror_copymasks2bit, x
beq +
+COPY_BIT_DITHER src1, dest1, mirror_copymasks2bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks2bit, oddrow_ptr
+ bcs +
sta READAUXMEM
sta WRITEAUXMEM
sec
bcs -
+ sta READMAINMEM
sta WRITEMAINMEM
next
inc <input
inc <input
bne +
bit KBD
bmi ++
inc <input+1
+ jmp InputLoop
++ rts
}
end
next2_start
!pseudopc next {
lda <input
php
dec <input
dec <input
plp
bne +
dec <input+1
bit KBD
bmi ++
+ jmp InputLoop
++ rts
}
next2_end
}

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "BUTTERFLY.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "HEART.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "MAPLE.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "SOFT.IRIS.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "STAR.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "STAR7.DATA"

View File

@ -9,7 +9,7 @@
+FX_INITONCE_2BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_2BIT_DITHER Coordinates2Bit, EndCoordinates2Bit
jmp iHGRDitherPrecomputed2Bit
CoordinatesFile
+PSTRING "WAVY.IRIS.DATA"

View File

@ -33,125 +33,3 @@ InitOnce
lda #$00
sta EndCoordinates2Bit
}
!macro FX_PRECOMPUTED_2BIT_DITHER .coords, .endcoords {
jsr iBuildHGRDitherMasks
jsr iBuildHGRTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks2Bit
; phase 1 - in reverse, with additional masking (dithering)
jsr copytozp
; set up starting coordinate for reading coordinates in reverse order
+LDADDR .endcoords-2
sta <input
sty <input+1
; set up EOF marker to stop reading coordinates in reverse order
lda #$00
sta .coords-2
; set up logic to advance to next coordinates in reverse order
ldx #(next2_end-next2_start-1)
- lda next2_start, x
sta <next, x
dex
bpl -
jsr InputLoop
bit KBD
bmi start
; phase 2 - in order, without additional masking
jsr copytozp
; redirect additional masking pointers to an array that contains #$FFs (so no dithering)
lda #<no_masks
sta <evenrow_ptr
sta <oddrow_ptr
jmp InputLoop
copytozp
+COPY_TO_0 start, end
start
!pseudopc 0 {
Exit2Bit rts
evenrow_ptr
!word evenrow_masks
oddrow_ptr
!word oddrow_masks
InputLoop
ldy #0
input=*+1
ldx .coords ; first value: HGR row + 1
beq Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES src1, src2, dest1, dest2
iny
lda (<input), y
+HIGH_3_LOW_5 input
; main 2x2 block in left half
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks2bit, x
and (<evenrow_ptr), y
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks2bit, x
and (<oddrow_ptr), y
eor (<dest2), y
dest2=*+1
sta $FDFD, y
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
lda (src1), y
eor (dest1), y
and mirror_copymasks2bit, x
and (<evenrow_ptr), y
eor (dest1), y
sta (dest1), y
lda (src2), y
eor (dest2), y
and mirror_copymasks2bit, x
and (<oddrow_ptr), y
eor (dest2), y
sta (dest2), y
next
inc <input
inc <input
bne InputLoop
bit KBD
bmi Exit2Bit
inc <input+1
bne InputLoop ; always branches
}
end
next2_start
!pseudopc next {
lda <input
php
dec <input
dec <input
plp
bne InputLoop
dec <input+1
bit KBD
bpl InputLoop
rts
}
next2_end
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15845380
!be24 15841807
!le16 473

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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