factor out more FX routines

This commit is contained in:
4am 2024-05-27 13:32:07 -04:00
parent 711de29099
commit 99dcc896d1
68 changed files with 684 additions and 642 deletions

View File

@ -154,54 +154,30 @@ gGlobalPrefsStore
; be set to $55 as part of the 64K memory test,
; which is apparently one of the acceptable values)
!if (RELBASE != $2000) and (* != iRippleCoordinates3Bit) { !serious "iRippleCoordinates3Bit=",*,", fix constants.a" }
jmp RippleCoordinates3Bit
!if (RELBASE != $2000) and (* != iReverseCoordinates3Bit) { !serious "iReverseCoordinates3Bit=",*,", fix constants.a" }
jmp ReverseCoordinates3Bit
!if (RELBASE != $2000) and (* != iRippleCoordinates2Bit) { !serious "iRippleCoordinates2Bit=",*,", fix constants.a" }
jmp RippleCoordinates2Bit
!if (RELBASE != $2000) and (* != iReverseCoordinates2Bit) { !serious "iReverseCoordinates2Bit=",*,", fix constants.a" }
jmp ReverseCoordinates2Bit
!if (RELBASE != $2000) and (* != iRippleCoordinates1Bit4) { !serious "iRippleCoordinates1Bit4=",*,", fix constants.a" }
jmp RippleCoordinates1Bit4
!if (RELBASE != $2000) and (* != iRippleCoordinates1Bit3) { !serious "iRippleCoordinates1Bit3=",*,", fix constants.a" }
jmp RippleCoordinates1Bit3
!if (RELBASE != $2000) and (* != iRippleCoordinates1Bit2) { !serious "iRippleCoordinates1Bit2=",*,", fix constants.a" }
jmp RippleCoordinates1Bit2
!if (RELBASE != $2000) and (* != iRippleCoordinates1Bit) { !serious "iRippleCoordinates1Bit=",*,", fix constants.a" }
jmp RippleCoordinates1Bit
!if (RELBASE != $2000) and (* != iReverseCoordinates1Bit) { !serious "iReverseCoordinates1Bit=",*,", fix constants.a" }
jmp ReverseCoordinates1Bit
!if (RELBASE != $2000) and (* != iWaitForKeyWithTimeout) { !serious "iWaitForKeyWithTimeout=",*,", fix constants.a" }
jmp WaitForKeyWithTimeout
!if (RELBASE != $2000) and (* != iBuildHGRTables) { !serious "iBuildHGRTables=",*,", fix constants.a" }
jmp BuildHGRTables
!if (RELBASE != $2000) and (* != iLoadFXDATA) { !serious "iLoadFXDATA=",*,", fix constants.a" }
jmp LoadFXDATA
!if (RELBASE != $2000) and (* != iLoadXSingle) { !serious "iLoadXSingle=",*,", fix constants.a" }
jmp LoadXSingle
!if (RELBASE != $2000) and (* != iAddToPath) { !serious "iAddToPath=",*,", fix constants.a" }
jmp AddToPath
!if (RELBASE != $2000) and (* != iLoadFileDirect) { !serious "iLoadFileDirect=",*,", fix constants.a" }
jmp LoadFileDirect
!if (RELBASE != $2000) and (* != WaitForVBL) { !serious "WaitForVBL=",*,", fix constants.a" }
jmp WaitForVBL_iie ; SMC to RTS on a II+
+DEFINE_INDIRECT_VECTOR iRippleCoordinates3Bit, RippleCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates3Bit, ReverseCoordinates3Bit
+DEFINE_INDIRECT_VECTOR iSetupPrecomputed3Bit, SetupPrecomputed3Bit
+DEFINE_INDIRECT_VECTOR iRippleCoordinates2Bit, RippleCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iReverseCoordinates2Bit, ReverseCoordinates2Bit
+DEFINE_INDIRECT_VECTOR iBuildHGRSparseBitmasks2Bit, BuildHGRSparseBitmasks2Bit
+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 iBuildHGRDitherMasks, BuildHGRDitherMasks
+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" }
rts ; SMC to JMP on a IIc
!word iUnwaitForVBL

View File

@ -56,7 +56,7 @@
; MAIN MEMORY DURING GAME LAUNCH
; 0100..0105 - re-entry code
; 0106..01BF - prelaunch code
; 0400..7FFF - text screen cleared
; 0400..07FF - text screen cleared
; 2000..5FFF - hi-res screens cleared
; A000.. - prelaunch index file
;
@ -172,23 +172,30 @@ gSearchCache = $A000
; LC RAM 1 & 2
; these are defined here because they are also called by other targets
; that are assembled separately, e.g. prelaunchers, demo launchers, and graphic effects
iRippleCoordinates3Bit = $FFBE
iReverseCoordinates3Bit = $FFC1
iRippleCoordinates2Bit = $FFC4
iReverseCoordinates2Bit = $FFC7
iRippleCoordinates1Bit4 = $FFCA
iRippleCoordinates1Bit3 = $FFCD
iRippleCoordinates1Bit2 = $FFD0
iRippleCoordinates1Bit = $FFD3
iReverseCoordinates1Bit = $FFD6
iWaitForKeyWithTimeout = $FFD9
iBuildHGRTables = $FFDC
iLoadFXDATA = $FFDF
iLoadXSingle = $FFE2
iAddToPath = $FFE5
iLoadFileDirect = $FFE8 ; note: you really want LC RAM 2 banked in before calling this
WaitForVBL = $FFEB
UnwaitForVBL = $FFEE
UnwaitForVBL = $FFEE
WaitForVBL = UnwaitForVBL-3
iLoadFileDirect = WaitForVBL-3 ; note: you really want LC RAM 2 banked in before calling this
iAddToPath = iLoadFileDirect-3
iLoadXSingle = iAddToPath-3
iLoadFXDATA = iLoadXSingle-3
iBuildHGRTables = iLoadFXDATA-3
iBuildHGRMirrorTables = iBuildHGRTables-3
iBuildHGRMirrorCols = iBuildHGRMirrorTables-3
iBuildHGRDitherMasks = iBuildHGRMirrorCols-3
iWaitForKeyWithTimeout = iBuildHGRDitherMasks-3
iReverseCoordinates1Bit = iWaitForKeyWithTimeout-3
iRippleCoordinates1Bit = iReverseCoordinates1Bit-3
iRippleCoordinates1Bit2 = iRippleCoordinates1Bit-3
iRippleCoordinates1Bit3 = iRippleCoordinates1Bit2-3
iRippleCoordinates1Bit4 = iRippleCoordinates1Bit3-3
iBuildHGRSparseBitmasks1Bit = iRippleCoordinates1Bit4-3
iBuildDHGRSparseBitmasks1Bit = iBuildHGRSparseBitmasks1Bit-3
iBuildHGRSparseBitmasks2Bit = iBuildDHGRSparseBitmasks1Bit-3
iReverseCoordinates2Bit = iBuildHGRSparseBitmasks2Bit-3
iRippleCoordinates2Bit = iReverseCoordinates2Bit-3
iSetupPrecomputed3Bit = iRippleCoordinates2Bit-3
iReverseCoordinates3Bit = iSetupPrecomputed3Bit-3
iRippleCoordinates3Bit = iReverseCoordinates3Bit-3
MockingboardStuff = $FFF8 ; bit 7 = 1 if SC-01 speech chip present (Speech I)
; bit 6 = 1 if SSI-263 speech chip present (Mockingboard "B"-"D")
@ -253,14 +260,38 @@ PrelaunchInit = $EB
; addresses used by graphic effects
hgrlo = $0201 ; $C0 bytes
mirror_cols = $02C1 ; $28 bytes
hgrhi = $0301 ; $C0 bytes
hgr1hi = hgrhi
Coordinates1Bit= $8600 ; $3481 bytes ($3480 on disk + 1 byte EOF marker added at runtime)
EndCoordinates1Bit = Coordinates1Bit + $3480
Coordinates2Bit= $8100 ; $3C01 bytes ($3C00 on disk + 1 byte EOF marker added at runtime)
EndCoordinates2Bit = Coordinates2Bit + $3C00
Coordinates3Bit= $6B00 ; $5001 bytes ($5000 on disk + 1 byte EOF marker added at runtime)
Coordinates3Bit= $6D00 ; $5001 bytes ($5000 on disk + 1 byte EOF marker added at runtime)
EndCoordinates3Bit = Coordinates3Bit + $5000
hgrlomirror = $BB01 ; $C0 bytes
hgr1himirror = $BC01 ; $C0 bytes
dithermasks = $BDA8 ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
copymasks1bit = $BE00 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0
copymasks2bit = copymasks1bit ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00,$20,$40,$60,$80
copymasks3bit = copymasks1bit ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00,$20,$40,$60,$80,$A0,$C0,$E0
mirror_copymasks1bit = copymasks1bit+1
mirror_copymasks2bit = copymasks2bit+1
hgrlo3a = $6A00 ; $80 bytes
hgrlo3b = $6A80 ; $80 bytes
hgrlo3c = $6B00 ; $80 bytes
hgrhi3a = $6B80 ; $80 bytes
hgrhi3b = $6C00 ; $80 bytes
hgrhi3c = $BD01 ; $80 bytes
extra_cols = $BEF8 ; $08 bytes
_CONSTANTS_=*
}

View File

@ -8,6 +8,43 @@
; these routines indirectly via the vectors defined in constants.a,
; e.g. iBuildHGRTables instead of BuildHGRTables.
;
; Public functions:
; - WaitForKeyWithTimeout
; - BuildHGRTables
; - BuildHGRMirrorTables
; - BuildHGRMirrorCols
; - BuildHGRDitherMasks
; - BuildHGRSparseBitmasks1Bit
; - BuildDHGRSparseBitmasks1Bit
; - ReverseCoordinates1Bit
; - RippleCoordinates1Bit
; - RippleCoordinates1Bit2
; - RippleCoordinates1Bit3
; - RippleCoordinates1Bit4
; - BuildHGRSparseBitmasks2Bit
; - ReverseCoordinates2Bit
; - RippleCoordinates2Bit
; - SetupPrecomputed3Bit
; - ReverseCoordinates3Bit
; - RippleCoordinates3Bit
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)
; X/Y preserved
sec
@wait1 pha
@wait2 sbc #1
bne @wait2
pla
bit KBD
bmi @exit
sbc #1
bne @wait1
@exit rts
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
@ -41,20 +78,140 @@ BuildHGRTables
bne -
rts
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)
; X/Y preserved
sec
@wait1 pha
@wait2 sbc #1
bne @wait2
pla
bit KBD
bmi @exit
sbc #1
bne @wait1
@exit rts
BuildHGRMirrorTables
ldx #$C0
ldy #0
- tya
and #$F8
bpl +
ora #5
+ asl
bpl +
ora #5
+ asl
asl
sta hgrlomirror-1, x
tya
and #7
rol
asl hgrlomirror-1, x
rol
ora #$20
sta hgr1himirror-1, x
iny
dex
bne -
rts
BuildHGRMirrorCols
; in: none
; out: mirror_cols populated with lookup table to get $27-y for y in $00..$27
; all registers and flags clobbered
ldx #$27
ldy #$00
- tya
sta mirror_cols, x
iny
dex
bpl -
rts
BuildHGRDitherMasks
ldy #40
- lda #%10110011
sta dithermasks, y
lda #%11100110
sta dithermasks+1, y
lda #%11001100
sta dithermasks+2, y
lda #%10011001
sta dithermasks+3, y
dey
dey
dey
dey
bpl -
ldy #43
lda #$FF
- sta no_masks, y
dey
bpl -
rts
BuildHGRSparseBitmasks1Bit
lda #%10000001
sta copymasks1bit
sta mirror_copymasks1bit+$C0
lda #%10000010
sta copymasks1bit+$20
sta mirror_copymasks1bit+$A0
lda #%10000100
sta copymasks1bit+$40
sta mirror_copymasks1bit+$80
lda #%10001000
sta copymasks1bit+$60
sta mirror_copymasks1bit+$60
lda #%10010000
sta copymasks1bit+$80
sta mirror_copymasks1bit+$40
lda #%10100000
sta copymasks1bit+$A0
sta mirror_copymasks1bit+$20
lda #%11000000
sta copymasks1bit+$C0
sta mirror_copymasks1bit
rts
BuildDHGRSparseBitmasks1Bit
; out: X=0
ldx #$00
txa
- sta copymasks1bit, x
sta $C005
sta copymasks1bit, x
sta $C004
inx
bne -
; X=0
lda #%00000111
sta copymasks1bit+$80
sta mirror_copymasks1bit+$40
lda #%00011000
sta copymasks1bit+$A0
sta mirror_copymasks1bit+$20
lda #%01100000
sta copymasks1bit+$C0
sta mirror_copymasks1bit
sta $C005
lda #%10000011
sta copymasks1bit
sta mirror_copymasks1bit+$C0
lda #%10001100
sta copymasks1bit+$20
sta mirror_copymasks1bit+$A0
lda #%10110000
sta copymasks1bit+$40
sta mirror_copymasks1bit+$80
lda #%11000000
sta copymasks1bit+$60
sta mirror_copymasks1bit+$60
sta $C004
rts
ReverseCoordinates1Bit
ldy #0 ; <Coordinates1Bit
@ -195,6 +352,40 @@ aslmod cmp #$1A
exit rts
}
BuildHGRSparseBitmasks2Bit
lda #%10000011
sta copymasks2bit
sta mirror_copymasks2bit+$E0
lda #%10001100
sta copymasks2bit+$20
sta mirror_copymasks2bit+$C0
lda #%10110000
sta copymasks2bit+$40
sta mirror_copymasks2bit+$A0
lda #%11000000
sta copymasks2bit+$60
sta mirror_copymasks2bit+$80
lda #%10000001
sta copymasks2bit+$80
sta mirror_copymasks2bit+$60
lda #%10000110
sta copymasks2bit+$A0
sta mirror_copymasks2bit+$40
lda #%10011000
sta copymasks2bit+$C0
sta mirror_copymasks2bit+$20
lda #%11100000
sta copymasks2bit+$E0
sta mirror_copymasks2bit
rts
ReverseCoordinates2Bit
ldy #0 ; <Coordinates2Bit
sty $f0
@ -357,7 +548,70 @@ RippleCoordinates2Bit
!word 2194, 6582
@zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee
;!macro FX_REVERSE_3BIT {
SetupPrecomputed3Bit
; build regular HGR lookup tables, then split them
jsr BuildHGRTables
ldx #$BF
ldy #$3F
- lda hgrlo, x
sta hgrlo3c, y
sta hgrlo3c+$40, y
lda hgrhi, x
sta hgrhi3c, y
sta hgrhi3c+$40, y
dex
lda hgrlo, x
sta hgrlo3b, y
sta hgrlo3b+$40, y
lda hgrhi, x
sta hgrhi3b, y
sta hgrhi3b+$40, y
dex
lda hgrlo, x
sta hgrlo3a, y
sta hgrlo3a+$40, y
lda hgrhi, x
sta hgrhi3a, y
sta hgrhi3a+$40, y
dex
dey
bpl -
; build lookup table to get $20+y for y in $00..$07
ldx #$07
ldy #$27
- tya
sta extra_cols-$20, y
dey
dex
bpl -
; build sparse lookup tables for bitmasks
lda #%10000011
sta copymasks3bit
lda #%10001100
sta copymasks3bit+$20
lda #%10110000
sta copymasks3bit+$40
lda #%11000000
sta copymasks3bit+$60
lda #%10000001
sta copymasks3bit+$80
lda #%10000110
sta copymasks3bit+$A0
lda #%10011000
sta copymasks3bit+$C0
lda #%11100000
sta copymasks3bit+$E0
rts
ReverseCoordinates3Bit
ldy #0 ; <Coordinates3Bit
sty $f0
@ -396,7 +650,6 @@ ReverseCoordinates3Bit
bcc -- ; always branches
++ rts
;!macro FX_RIPPLE_3BIT {
RippleCoordinates3Bit
ldx #$1B
- lda @ripplezp, x

View File

@ -25,9 +25,9 @@ input = $FE ; word
Start
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4
@ -56,10 +56,10 @@ LoopBL ; bottom-left quadrant (opposite row, origi
lda (input),y
+HIGH_3_LOW_5 input
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
+ bcs +
sta $C003
sta $C005
@ -82,10 +82,10 @@ LoopTL ; top-left quadrant
lda (input),y
+HIGH_3_LOW_5 input
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
+ bcs +
sta $C003
sta $C005
@ -110,10 +110,10 @@ LoopTR ; top-right quadrant (same row, opposite co
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
+ bcs +
sta $C003
sta $C005
@ -138,10 +138,10 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
+ bcs +
sta $C003
sta $C005

View File

@ -16,9 +16,9 @@ reverse_input = $FC ; word
input = $FE ; word
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4
@ -52,10 +52,10 @@ Loop ldy #0
; top-left quadrant (original row, original column, original input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
+ bcs +
sta $C003
sta $C005
@ -68,10 +68,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
+ bcs +
sta $C003
sta $C005
@ -91,10 +91,10 @@ Loop ldy #0
; bottom-left quadrant (opposite row, original column, reverse input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
+ bcs +
sta $C003
sta $C005
@ -107,10 +107,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
+ bcs +
sta $C003
sta $C005

View File

@ -4,55 +4,10 @@
!source "src/fx/fx.hgr.precomputed.1bit.a"
!macro BUILD_SPARSE_BITMASKS_1BIT_DHGR .copymasks, .mirror_copymasks {
; build sparse lookup tables for bitmasks
ldx #$00
txa
- sta .copymasks, x
sta $C005
sta .copymasks, x
sta $C004
inx
bne -
lda #%00000111
sta .copymasks+$80
sta .mirror_copymasks+$40
lda #%00011000
sta .copymasks+$A0
sta .mirror_copymasks+$20
lda #%01100000
sta .copymasks+$C0
sta .mirror_copymasks
sta $C005
lda #%10000011
sta .copymasks
sta .mirror_copymasks+$C0
lda #%10001100
sta .copymasks+$20
sta .mirror_copymasks+$A0
lda #%10110000
sta .copymasks+$40
sta .mirror_copymasks+$80
lda #%11000000
sta .copymasks+$60
sta .mirror_copymasks+$60
sta $C004
; X=0
}
!macro FX_PRECOMPUTED_1BIT_DHGR .coords {
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_0 start, end
jmp InputLoop
@ -73,7 +28,7 @@ input=*+1
sty <y
clc
bankloop
lda copymasks, x
lda copymasks1bit, x
beq +
sta <copymask
@ -99,7 +54,7 @@ dest2=*+1
+COPY_BIT_ZP mirror_src2, mirror_dest2, copymask
+
lda mirror_copymasks, x ; exists at the same address in mainmem and auxmem but each is different
lda mirror_copymasks1bit, x ; exists at the same address in mainmem and auxmem but each is different
beq +
sta <mirror_copymask
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
@ -142,9 +97,9 @@ end
!macro FX_PRECOMPUTED_1BIT_DHGR_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
; phase 1 - in reverse, with additional masking
@ -201,7 +156,7 @@ input=*+1
sty <y
clc
bankloop
lda copymasks, x
lda copymasks1bit, x
beq +
sta <copymask
@ -229,7 +184,7 @@ dest2=*+1
+COPY_BIT_ZP_DITHER mirror_src2, mirror_dest2, copymask, evenrow_ptr
+
lda mirror_copymasks, x
lda mirror_copymasks1bit, x
beq +
sta <mirror_copymask
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)

View File

@ -3,56 +3,56 @@
;
!source "src/fx/fx.hgr.precomputed.2bit.a"
!macro BUILD_SPARSE_BITMASKS_2BIT_DHGR .copymasks, .mirror_copymasks {
!macro BUILD_SPARSE_BITMASKS_2BIT_DHGR .copymasks2bit, .mirror_copymasks2bit {
; build sparse lookup tables for bitmasks
ldx #$00
txa
- sta .copymasks, x
- sta .copymasks2bit, x
sta $C005
sta .copymasks, x
sta .copymasks2bit, x
sta $C004
inx
bne -
lda #%10011111
sta .copymasks+$40
sta .mirror_copymasks+$A0
sta .copymasks2bit+$40
sta .mirror_copymasks2bit+$A0
lda #%11100000
sta .copymasks+$60
sta .mirror_copymasks+$80
sta .copymasks2bit+$60
sta .mirror_copymasks2bit+$80
lda #%10000111
sta .copymasks+$C0
sta .mirror_copymasks+$20
sta .copymasks2bit+$C0
sta .mirror_copymasks2bit+$20
lda #%11111000
sta .copymasks+$E0
sta .mirror_copymasks
sta .copymasks2bit+$E0
sta .mirror_copymasks2bit
sta $C005
lda #%10001111
sta .copymasks
sta .mirror_copymasks+$E0
sta .copymasks2bit
sta .mirror_copymasks2bit+$E0
lda #%11110000
sta .copymasks+$20
sta .mirror_copymasks+$C0
sta .copymasks2bit+$20
sta .mirror_copymasks2bit+$C0
lda #%10000011
sta .copymasks+$80
sta .mirror_copymasks+$60
sta .copymasks2bit+$80
sta .mirror_copymasks2bit+$60
lda #%11111100
sta .copymasks+$A0
sta .mirror_copymasks+$40
sta .copymasks2bit+$A0
sta .mirror_copymasks2bit+$40
sta $C004
}
!macro FX_PRECOMPUTED_2BIT_DHGR .coords {
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks, mirror_copymasks
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks2bit, mirror_copymasks2bit
jsr iBuildHGRTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_0 start, end
@ -74,19 +74,19 @@ input=*+1
; main 2x2 block in left half
clc
- lda copymasks, x
- lda copymasks2bit, x
beq +
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks2bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks2bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
@ -102,10 +102,10 @@ dest2=*+1
lda mirror_cols, y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks2bit, x
beq +
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks2bit
+COPY_BIT src2, dest2, mirror_copymasks2bit
+ bcs +
sta $C003
sta $C005
@ -127,7 +127,7 @@ end
!macro FX_PRECOMPUTED_2BIT_DHGR_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks, mirror_copymasks
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks2bit, mirror_copymasks2bit
jsr iBuildHGRTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
@ -187,12 +187,12 @@ input=*+1
; main 2x2 block in left half
clc
- lda copymasks, x
- lda copymasks2bit, x
beq +
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks2bit, x
and (<evenrow_ptr), y
eor (<dest1), y
dest1=*+1
@ -200,7 +200,7 @@ dest1=*+1
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks2bit, x
and (<oddrow_ptr), y
eor (<dest2), y
dest2=*+1
@ -217,10 +217,10 @@ dest2=*+1
lda mirror_cols, y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks2bit, x
beq +
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks2bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks2bit, oddrow_ptr
+ bcs +
sta $C003
sta $C005

View File

@ -22,9 +22,9 @@ input = $FE ; word
sta Coordinates1Bit-2
Start
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4
+LDADDR EndCoordinates1Bit-2
@ -39,10 +39,10 @@ LoopBL ; bottom-left quadrant (opposite row, origi
lda (input),y
+HIGH_3_LOW_5 input
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -65,10 +65,10 @@ LoopTL ; top-left quadrant
lda (input),y
+HIGH_3_LOW_5 input
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+COPY_BIT src1, dest1, copymasks1bit
+COPY_BIT src2, dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -93,10 +93,10 @@ LoopTR ; top-right quadrant (same row, opposite co
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -121,10 +121,10 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005

View File

@ -13,9 +13,9 @@ dest2 = $F6 ; word
reverse_input = $FC ; word
input = $FE ; word
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4
@ -37,10 +37,10 @@ Loop ldy #0
; top-left quadrant (original row, original column, original input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+COPY_BIT src1, dest1, copymasks1bit
+COPY_BIT src2, dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -53,10 +53,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -76,10 +76,10 @@ Loop ldy #0
; bottom-left quadrant (opposite row, original column, reverse input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -92,10 +92,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005

View File

@ -21,9 +21,9 @@ input = $FE ; word
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
jsr iBuildDHGRSparseBitmasks1Bit
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
jsr iBuildHGRMirrorTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4
@ -45,10 +45,10 @@ Loop ldy #0
; top-left quadrant (original row, original column, original input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+COPY_BIT src1, dest1, copymasks1bit
+COPY_BIT src2, dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -61,10 +61,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -84,10 +84,10 @@ Loop ldy #0
; bottom-left quadrant (opposite row, original column, reverse input order)
clc
- lda copymasks, x
- lda copymasks1bit, x
beq +
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+ bcs +
sta $C003
sta $C005
@ -100,10 +100,10 @@ Loop ldy #0
lda mirror_cols,y
tay
clc
- lda mirror_copymasks, x
- lda mirror_copymasks1bit, x
beq +
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
+ bcs +
sta $C003
sta $C005

View File

@ -24,11 +24,11 @@ input = $FE ; word
sta Coordinates1Bit-2
Start
+BUILD_DITHER_MASKS dithermasks
jsr iBuildHGRDitherMasks
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR evenrow_masks
+ST16 evenrow_ptr
@ -54,8 +54,8 @@ LoopBL ; bottom-left quadrant (opposite row, origi
iny
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
+DEC_INPUT_AND_LOOP LoopBL
DoneBL
@ -70,8 +70,8 @@ LoopTL ; top-left quadrant
inc input
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
+INC_INPUT_AND_LOOP LoopTL
DoneTL
@ -88,8 +88,8 @@ LoopTR ; top-right quadrant (same row, opposite co
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
+DEC_INPUT_AND_LOOP LoopTR
DoneTR
@ -106,8 +106,8 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
+INC_INPUT_AND_LOOP LoopBR
DoneBR
rts

View File

@ -15,11 +15,11 @@ dest2 = $F6 ; word
reverse_input = $FC ; word
input = $FE ; word
+BUILD_DITHER_MASKS dithermasks
+BUILD_MIRROR_COLS mirror_cols
jsr iBuildHGRDitherMasks
jsr iBuildHGRMirrorCols
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR evenrow_masks
+ST16 evenrow_ptr
@ -50,14 +50,14 @@ Loop ldy #0
+HIGH_3_LOW_5 input
; top-left quadrant (original row, original column, original input order)
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, copymasks1bit, oddrow_ptr
; bottom-right quadrant (opposite row, opposite column, original input order)
lda mirror_cols,y
tay
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks1bit, evenrow_ptr
ldy #0
lda (reverse_input),y
@ -69,14 +69,14 @@ Loop ldy #0
+HIGH_3_LOW_5 reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
; top-right quadrant (same row, opposite column, reverse input order)
lda mirror_cols,y
tay
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
inc input
bne +

View File

@ -1,52 +1,29 @@
;license:MIT
;(c) 2019-2022 by 4am
;(c) 2019-2024 by 4am
;
;hgrlo = $0201 ; $C0 bytes (defined in constants.a)
mirror_cols = $02C1 ; $28 bytes
;hgr1hi = $0301 ; $C0 bytes (defined in constants.a)
dithermasks = $BBA8 ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
hgrlomirror = $BC01 ; $C0 bytes
hgr1himirror = $BD01 ; $C0 bytes
copymasks = $BE00 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00, $20, $40, $60, $80, $A0, $C0
mirror_copymasks = copymasks+1
;------------------------------------------------------------------------------
; YE OLDE GRAND UNIFIED MEMORY MAP
;
; 0201..02C0 - hgrlo
; 02C1..02E8 - mirror_cols
; 02E9..0300
; 0301..03C0 - hgrhi
; 03C1..03EE
; 6000.. - module code (length varies)
; 85FE..B880 - Coordinates1Bit
; B881..BB00
; BB01..BBC0 - hgrlomirror
; BBC1..BC00
; BC01..BCC0 - hgr1himirror
; BCC1..BDA9
; BDA8..BDFF - dithermasks
; BE00..BEFF - copymasks1bit
; BF00..BFFF - ProRWTS glue
;
!source "src/fx/macros.a"
!macro BUILD_SPARSE_BITMASKS_1BIT {
; build sparse lookup tables for bitmasks
lda #%10000001
sta copymasks
sta mirror_copymasks+$C0
lda #%10000010
sta copymasks+$20
sta mirror_copymasks+$A0
lda #%10000100
sta copymasks+$40
sta mirror_copymasks+$80
lda #%10001000
sta copymasks+$60
sta mirror_copymasks+$60
lda #%10010000
sta copymasks+$80
sta mirror_copymasks+$40
lda #%10100000
sta copymasks+$A0
sta mirror_copymasks+$20
lda #%11000000
sta copymasks+$C0
sta mirror_copymasks
}
!macro FX_INITONCE_1BIT .CoordinatesFile, .Start {
InitOnce
bit .Start
@ -63,9 +40,9 @@ InitOnce
!macro FX_PRECOMPUTED_1BIT .coords {
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks1Bit
+COPY_TO_0 start, end
jmp InputLoop
start
@ -87,14 +64,14 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks1bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks1bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
@ -102,21 +79,21 @@ dest2=*+1
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols, y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+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_copymasks, x
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_copymasks, x
and mirror_copymasks1bit, x
eor (<mirror_dest2), y
mirror_dest2=*+1
sta $FDFD, y
@ -124,8 +101,8 @@ mirror_dest2=*+1
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols, y
tay
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+INC_INPUT_AND_LOOP InputLoop
}
@ -133,11 +110,11 @@ end
}
!macro FX_PRECOMPUTED_1BIT_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS dithermasks
jsr iBuildHGRDitherMasks
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks1Bit
; phase 1 - in reverse, with additional masking
+COPY_TO_0 start, end
@ -195,7 +172,7 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks1bit, x
and (<evenrow_ptr), y
eor (<dest1), y
dest1=*+1
@ -203,7 +180,7 @@ dest1=*+1
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks1bit, x
and (<oddrow_ptr), y
eor (<dest2), y
dest2=*+1
@ -212,14 +189,14 @@ dest2=*+1
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols, y
tay
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
+COPY_BIT_DITHER src1, dest1, mirror_copymasks1bit, evenrow_ptr
+COPY_BIT_DITHER src2, dest2, mirror_copymasks1bit, oddrow_ptr
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
mirror_src1=*+1
lda $FDFD, y
eor (<mirror_dest1), y
and mirror_copymasks, x
and mirror_copymasks1bit, x
and (<oddrow_ptr), y
eor (<mirror_dest1), y
mirror_dest1=*+1
@ -227,7 +204,7 @@ mirror_dest1=*+1
mirror_src2=*+1
lda $FDFD, y
eor (<mirror_dest2), y
and mirror_copymasks, x
and mirror_copymasks1bit, x
and (<evenrow_ptr), y
eor (<mirror_dest2), y
mirror_dest2=*+1
@ -236,8 +213,8 @@ mirror_dest2=*+1
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols, y
tay
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks1bit, oddrow_ptr
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks1bit, evenrow_ptr
next
inc <input

View File

@ -1,54 +1,25 @@
;license:MIT
;(c) 2019-2022 by 4am
;(c) 2019-2024 by 4am
;
;hgrlo = $0201 ; $C0 bytes (defined in constants.a)
mirror_cols = $02C1 ; $28 bytes
;hgr1hi = $0301 ; $C0 bytes (defined in constants.a)
dithermasks = $BDA8 ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
copymasks = $BE00 ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00, $20, $40, $60, $80
mirror_copymasks = copymasks+1
;------------------------------------------------------------------------------
; YE OLDE GRAND UNIFIED MEMORY MAP
;
; 0201..02C0 - hgrlo
; 02C1..02E8 - mirror_cols
; 02E9..0300
; 0301..03C0 - hgrhi
; 03C1..03EE
; 6000.. - module code (length varies)
; 8100..BD00 - Coordinates2Bit
; BD01..BDA9
; BDA8..BDFF - dithermasks
; BE00..BEFF - copymasks2bit
; BF00..BFFF - ProRWTS glue
;
!source "src/fx/macros.a"
!macro BUILD_SPARSE_BITMASKS_2BIT .copymasks, .mirror_copymasks {
; build sparse lookup tables for bitmasks
lda #%10000011
sta .copymasks
sta .mirror_copymasks+$E0
lda #%10001100
sta .copymasks+$20
sta .mirror_copymasks+$C0
lda #%10110000
sta .copymasks+$40
sta .mirror_copymasks+$A0
lda #%11000000
sta .copymasks+$60
sta .mirror_copymasks+$80
lda #%10000001
sta .copymasks+$80
sta .mirror_copymasks+$60
lda #%10000110
sta .copymasks+$A0
sta .mirror_copymasks+$40
lda #%10011000
sta .copymasks+$C0
sta .mirror_copymasks+$20
lda #%11100000
sta .copymasks+$E0
sta .mirror_copymasks
}
!macro ROW_X_TO_2BIT_BASE_ADDRESSES {
; X = $01..$C0, mapping to row 0..191
lda hgrlo-1, x
@ -83,8 +54,8 @@ InitOnce
!macro FX_PRECOMPUTED_2BIT .coords {
jsr iBuildHGRTables
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks2Bit
+COPY_TO_0 start, end
jmp InputLoop
start
@ -105,14 +76,14 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks2bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks2bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
@ -120,8 +91,8 @@ dest2=*+1
; corresponding 2x2 block in right half (same row, opposite column)
lda mirror_cols, y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks2bit
+COPY_BIT src2, dest2, mirror_copymasks2bit
inc <input
bne InputLoop
@ -134,10 +105,10 @@ end
}
!macro FX_PRECOMPUTED_2BIT_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS dithermasks
jsr iBuildHGRDitherMasks
jsr iBuildHGRTables
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks2Bit
; phase 1 - in reverse, with additional masking (dithering)
jsr copytozp
@ -197,7 +168,7 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks2bit, x
and (<evenrow_ptr), y
eor (<dest1), y
dest1=*+1
@ -205,7 +176,7 @@ dest1=*+1
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks2bit, x
and (<oddrow_ptr), y
eor (<dest2), y
dest2=*+1
@ -216,14 +187,14 @@ dest2=*+1
tay
lda (src1), y
eor (dest1), y
and mirror_copymasks, x
and mirror_copymasks2bit, x
and (<evenrow_ptr), y
eor (dest1), y
sta (dest1), y
lda (src2), y
eor (dest2), y
and mirror_copymasks, x
and mirror_copymasks2bit, x
and (<oddrow_ptr), y
eor (dest2), y
sta (dest2), y

View File

@ -1,94 +1,33 @@
;license:MIT
;(c) 2019-2022 by 4am
;(c) 2019-2024 by 4am
;
tmplo = hgrlo ; $C0 bytes (hgrlo=$0201, defined in constants.a)
tmphi = hgrhi ; $C0 bytes (hgrhi=$0301, defined in constants.a)
copymasks = $BB01 ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00, $20, $40...
extra_cols = $BBF8 ; $08 bytes
hgrlo3a = $BC00 ; $80 bytes
hgrlo3b = $BC80 ; $80 bytes
hgrlo3c = $BD00 ; $80 bytes
hgrhi3a = $BD80 ; $80 bytes
hgrhi3b = $BE00 ; $80 bytes
hgrhi3c = $BE80 ; $80 bytes
dither1_lo = $6900 ; $80 bytes
dither2_lo = $6980 ; $80 bytes
dither3_lo = $6A00 ; $80 bytes
dithermasks = $6A80 ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
;------------------------------------------------------------------------------
; YE OLDE GRAND UNIFIED MEMORY MAP
;
; 0201..02C0 - hgrlo
; 02C1..02E8 - mirror_cols
; 02E9..0300
; 0301..03C0 - hgrhi
; 03C1..03EE
; 6000.. - module code (length varies)
; 6880..6C7F - dither123_lo, hgrlo3abc, hgrhi3ab
; 6C80..6CFD
; 6CFE..BD00 - Coordinates3Bit (dither variants clobber Coordinates3Bit-2)
; BD01..BD80 - hgrhi3c
; BD81..BDA9
; BDA8..BDFF - dithermasks
; BE00..BEE0 - copymasks3bit
; BEF8..BEFF - extra_cols
; BF00..BFFF - ProRWTS glue
;
dither1_lo = $6880 ; $80 bytes
dither2_lo = $6900 ; $80 bytes
dither3_lo = $6980 ; $80 bytes
!source "src/fx/macros.a"
!macro BUILD_EXTRA_COLS {
; build lookup table to get $20+y for y in $00..$07
ldx #$07
ldy #$27
- tya
sta extra_cols-$20, y
dey
dex
bpl -
}
!macro BUILD_SPARSE_BITMASKS_3BIT {
; build sparse lookup tables for bitmasks
lda #%10000011
sta copymasks
lda #%10001100
sta copymasks+$20
lda #%10110000
sta copymasks+$40
lda #%11000000
sta copymasks+$60
lda #%10000001
sta copymasks+$80
lda #%10000110
sta copymasks+$A0
lda #%10011000
sta copymasks+$C0
lda #%11100000
sta copymasks+$E0
}
!macro BUILD_3BIT_HGR_LOOKUP_TABLES {
jsr iBuildHGRTables
ldx #$BF
ldy #$3F
- lda tmplo, x
sta hgrlo3c, y
sta hgrlo3c+$40, y
lda tmphi, x
sta hgrhi3c, y
sta hgrhi3c+$40, y
dex
lda tmplo, x
sta hgrlo3b, y
sta hgrlo3b+$40, y
lda tmphi, x
sta hgrhi3b, y
sta hgrhi3b+$40, y
dex
lda tmplo, x
sta hgrlo3a, y
sta hgrlo3a+$40, y
lda tmphi, x
sta hgrhi3a, y
sta hgrhi3a+$40, y
dex
dey
bpl -
}
!macro ROW_X_TO_3BIT_BASE_ADDRESSES {
; X = $00..$3F, mapping to row 0, 3, 6, 9, 12, ... 189
lda hgrlo3a, x
@ -129,9 +68,7 @@ InitOnce
}
!macro FX_PRECOMPUTED_3BIT .coords {
+BUILD_3BIT_HGR_LOOKUP_TABLES
+BUILD_EXTRA_COLS
+BUILD_SPARSE_BITMASKS_3BIT
jsr iSetupPrecomputed3Bit
+COPY_TO_0 start, end
jmp InputLoop
start
@ -162,21 +99,21 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks3bit, x
eor (<dest1), y
dest1=*+1
sta $FDFD, y
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks3bit, x
eor (<dest2), y
dest2=*+1
sta $FDFD, y
src3=*+1
lda $FDFD, y
eor (<dest3), y
and copymasks, x
and copymasks3bit, x
eor (<dest3), y
dest3=*+1
sta $FDFD, y
@ -192,10 +129,8 @@ end
}
!macro FX_PRECOMPUTED_3BIT_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS dithermasks
+BUILD_3BIT_HGR_LOOKUP_TABLES
+BUILD_EXTRA_COLS
+BUILD_SPARSE_BITMASKS_3BIT
jsr iBuildHGRDitherMasks
jsr iSetupPrecomputed3Bit
; phase 1 - in reverse, with additional masking
+COPY_TO_0 start, end
@ -286,7 +221,7 @@ input=*+1
src1=*+1
lda $FDFD, y
eor (<dest1), y
and copymasks, x
and copymasks3bit, x
and (dither1_ptr), y
eor (<dest1), y
dest1=*+1
@ -294,7 +229,7 @@ dest1=*+1
src2=*+1
lda $FDFD, y
eor (<dest2), y
and copymasks, x
and copymasks3bit, x
and (dither2_ptr), y
eor (<dest2), y
dest2=*+1
@ -302,7 +237,7 @@ dest2=*+1
src3=*+1
lda $FDFD, y
eor (<dest3), y
and copymasks, x
and copymasks3bit, x
and (dither3_ptr), y
eor (<dest3), y
dest3=*+1

View File

@ -23,9 +23,9 @@ input = $FE ; word
Start
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRMirrorCols
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR EndCoordinates1Bit-2
+ST16 input
@ -38,8 +38,8 @@ LoopBL ; bottom-left quadrant (opposite row, origi
iny
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+COPY_BIT mirror_src1, mirror_dest1, copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, copymasks1bit
+DEC_INPUT_AND_LOOP LoopBL
DoneBL
@ -54,8 +54,8 @@ LoopTL ; top-left quadrant
inc input
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+COPY_BIT src1, dest1, copymasks1bit
+COPY_BIT src2, dest2, copymasks1bit
+INC_INPUT_AND_LOOP LoopTL
DoneTL
@ -72,8 +72,8 @@ LoopTR ; top-right quadrant (same row, opposite co
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
+DEC_INPUT_AND_LOOP LoopTR
DoneTR
@ -90,8 +90,8 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
+INC_INPUT_AND_LOOP LoopBR
DoneBR
rts

View File

@ -13,10 +13,10 @@ dest2 = $F6 ; word
reverse_input = $FC ; word
input = $FE ; word
+BUILD_MIRROR_COLS mirror_cols
jsr iBuildHGRMirrorCols
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR Coordinates
+ST16 input
@ -35,14 +35,14 @@ Loop ldy #0
+HIGH_3_LOW_5 input
; top-left quadrant (original row, original column, original input order)
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+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_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
ldy #0
lda (reverse_input),y
@ -54,14 +54,14 @@ Loop ldy #0
+HIGH_3_LOW_5 reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+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_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
inc input
bne +

View File

@ -21,10 +21,10 @@ input = $FE ; word
+FX_INITONCE_1BIT CoordinatesFile, Start
Start
+BUILD_MIRROR_COLS mirror_cols
jsr iBuildHGRMirrorCols
jsr iBuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT
jsr iBuildHGRMirrorTables
jsr iBuildHGRSparseBitmasks1Bit
+LDADDR Coordinates1Bit
+ST16 input
+LDADDR EndCoordinates1Bit-2
@ -42,14 +42,14 @@ Loop ldy #0
+HIGH_3_LOW_5 input
; top-left quadrant (original row, original column, original input order)
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+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_copymasks
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks1bit
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks1bit
ldy #0
lda (reverse_input),y
@ -61,14 +61,14 @@ Loop ldy #0
+HIGH_3_LOW_5 reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT mirror_src1, mirror_dest1, copymasks
+COPY_BIT mirror_src2, mirror_dest2, copymasks
+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_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+COPY_BIT src1, dest1, mirror_copymasks1bit
+COPY_BIT src2, dest2, mirror_copymasks1bit
inc input
bne +

View File

@ -10,11 +10,11 @@ shrlo = $200 ; $C8 bytes
shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -26,7 +26,7 @@ stage2
startzp
!pseudopc 0 {
stage3
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols
}
endzp
}

View File

@ -10,11 +10,11 @@ shrlo = $200 ; $C8 bytes
shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -27,7 +27,7 @@ stage2
startzp
!pseudopc 0 {
stage3
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols
}
endzp
}

View File

@ -11,11 +11,11 @@ shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
last_coords = coords+$1F3E
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -72,7 +72,7 @@ LoopTR ldx last_coords ; SMC
ldy #1
lda (LoopTR+1), y
tay
lda mirror_cols, y
lda shr_mirror_cols, y
tay
jsr copy
lda <LoopTR+1
@ -94,7 +94,7 @@ LoopBR ldx coords ; SMC
ldy #1
lda (LoopBR+1), y
tay
lda mirror_cols, y
lda shr_mirror_cols, y
tay
jsr copy
inc <LoopBR+1

View File

@ -11,11 +11,11 @@ shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
last_coords = coords+$1F3E
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -42,7 +42,7 @@ input ldx coords ; SMC
; bottom-right quadrant (opposite row, opposite column, original input order)
lda mirror_rows, x
tax
lda mirror_cols, y
lda shr_mirror_cols, y
tay
jsr copy
@ -59,7 +59,7 @@ reverse_input
; top-right quadrant (original row, opposite column, reverse input order)
lda mirror_rows, x ; mirror of the mirror
tax
lda mirror_cols, y
lda shr_mirror_cols, y
tay
jsr copy

View File

@ -10,11 +10,11 @@ shrlo = $200 ; $C8 bytes
shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -26,7 +26,7 @@ stage2
startzp
!pseudopc 0 {
stage3
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols
}
endzp
}

View File

@ -10,11 +10,11 @@ shrlo = $200 ; $C8 bytes
shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -26,7 +26,7 @@ stage2
startzp
!pseudopc 0 {
stage3
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols
}
endzp
}

View File

@ -10,11 +10,11 @@ shrlo = $200 ; $C8 bytes
shrhi = $300 ; $C8 bytes
coords = $9F00 ; $1F41 bytes
CoordinatesFileCopy = $BE42; $11 bytes
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
!source "src/fx/macros.a"
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -27,7 +27,7 @@ stage2
startzp
!pseudopc 0 {
stage3
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, mirror_cols
+SHR_STAGE_3 coords, shrlo, shrhi, mirror_rows, shr_mirror_cols
}
endzp
}

View File

@ -4,28 +4,6 @@
!ifndef _FX_MACROS_DITHER_ {
!macro BUILD_DITHER_MASKS .dithermasks {
ldy #40
- lda #%10110011
sta .dithermasks, y
lda #%11100110
sta .dithermasks+1, y
lda #%11001100
sta .dithermasks+2, y
lda #%10011001
sta .dithermasks+3, y
dey
dey
dey
dey
bpl -
ldy #43
lda #$FF
- sta .dithermasks+44, y
dey
bpl -
}
!macro BUILD_DITHER_MASKS_DHGR .dithermasks {
ldy #40
- lda #%10011110

View File

@ -4,45 +4,6 @@
!ifndef _FX_MACROS_HGR_ {
; .hgrlomirror, .hgr1himirror will each be filled with $C0 bytes
!macro BUILD_HGR_MIRROR_LOOKUP_TABLES .hgrlomirror, .hgr1himirror {
ldx #$C0
ldy #0
- tya
and #$F8
bpl +
ora #5
+ asl
bpl +
ora #5
+ asl
asl
sta .hgrlomirror-1,x
tya
and #7
rol
asl .hgrlomirror-1,x
rol
ora #$20
sta .hgr1himirror-1,x
iny
dex
bne -
}
!macro BUILD_MIRROR_COLS .mirror_cols {
; in: none
; out: .mirror_cols populated with lookup table to get $27-y for y in $00..$27
; all registers and flags clobbered
ldx #$27
ldy #$00
- tya
sta .mirror_cols, x
iny
dex
bpl -
}
!macro HGR_CALC {
; in: A = HGR row (0x00..0xBF)
; out: A/X clobbered

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,11 @@
+
}
!macro DEFINE_INDIRECT_VECTOR .name, .target {
!if (RELBASE != $2000) and (* != .name) { !serious .name,"!=",*,", fix constants.a" }
jmp .target
}
; for functions that take parameters on the stack
; set (PARAM) to point to the parameters and
; move the stack pointer to the first byte after the parameters