diff --git a/src/fx/fx.shr.common.a b/src/fx/fx.shr.common.a index 5d8aa0575..45f1f125d 100644 --- a/src/fx/fx.shr.common.a +++ b/src/fx/fx.shr.common.a @@ -128,6 +128,17 @@ +SHR_COPY_TO_STAGE_2 } +!macro SHR_STAGE_2 .startzp, .endzp { + +COPY_TO_0 .startzp, .endzp + + +WRITE_AUX + jsr $0 + +WRITE_MAIN + + +SHR_RESTORE_FROM_STAGE_2 + +READ_RAM1_WRITE_RAM1 +} + !macro SHR_STAGE_3 .coords, .shrlo, .shrhi, .mirror_rows, .mirror_cols { input ldx .coords ; first value: SHR row (only 0..99 will be in input array) bmi exit ; if > 127 then we're done @@ -177,14 +188,15 @@ src2 lda $FD00, y ; SMC high byte exit rts } -!macro SHR_REVERSE .coords, .endcoords { - ldy #coords + lda #>.coords sta $f1 - lda #<(.endcoords - 2) + lda #<(.coords + .length - 2) sta $f2 - lda #>(.endcoords - 2) + lda #>(.coords + .length - 2) sta $f3 clc !byte $24 @@ -204,10 +216,10 @@ exit rts bne + inc $f1 + lda $f1 - eor #>(.coords + (.endcoords-.coords)/2) + eor #>(.coords + .length/2) bne + lda $f0 - eor #<(.coords + (.endcoords-.coords)/2) + eor #<(.coords + .length/2) beq ++ + lda $f2 bne + diff --git a/src/fx/fx.shr.iris.a b/src/fx/fx.shr.iris.a index 572c7c798..065d7d457 100644 --- a/src/fx/fx.shr.iris.a +++ b/src/fx/fx.shr.iris.a @@ -21,16 +21,7 @@ coords = $9F00 ; $1F41 bytes !pseudopc *-$300 { stage2 +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy - ;WRITEMAINMEM active - - +COPY_TO_0 startzp, endzp - - +WRITE_AUX - jsr stage3 - +WRITE_MAIN - - +SHR_RESTORE_FROM_STAGE_2 - +READ_RAM1_WRITE_RAM1 + +SHR_STAGE_2 startzp, endzp rts startzp diff --git a/src/fx/fx.shr.iris.in.a b/src/fx/fx.shr.iris.in.a index fb7e3cb8f..e50a59409 100644 --- a/src/fx/fx.shr.iris.in.a +++ b/src/fx/fx.shr.iris.in.a @@ -11,7 +11,6 @@ shrhi = $301 ; $C8 bytes mirror_cols = $1E29 ; $A0 bytes but clobbers $28 bytes before mirror_rows = $1F01 ; $C7 bytes coords = $9F00 ; $1F41 bytes -endcoords = $BE40 !source "src/fx/macros.a" !source "src/fx/fx.shr.common.a" @@ -22,17 +21,8 @@ endcoords = $BE40 !pseudopc *-$300 { stage2 +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy - ;WRITEMAINMEM active - +SHR_REVERSE coords, endcoords - - +COPY_TO_0 startzp, endzp - - +WRITE_AUX - jsr stage3 - +WRITE_MAIN - - +SHR_RESTORE_FROM_STAGE_2 - +READ_RAM1_WRITE_RAM1 + +SHR_REVERSE coords + +SHR_STAGE_2 startzp, endzp rts startzp diff --git a/src/fx/fx.shr.radial.a b/src/fx/fx.shr.radial.a index ca36225b5..bc1582100 100644 --- a/src/fx/fx.shr.radial.a +++ b/src/fx/fx.shr.radial.a @@ -16,14 +16,7 @@ last_coords = coords+$1F3E !source "src/fx/macros.a" !source "src/fx/fx.shr.common.a" - +BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols - ;X=0 - +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi - ;X=0 - +COPY_SCB_AND_PALETTES - ;X=0 - ;WRITEAUXMEM active - +SHR_COPY_TO_STAGE_2 + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols jmp stage2 !pseudopc *-$300 { @@ -34,14 +27,7 @@ stage2 lda #$80 sta coords-2 - +COPY_TO_0 startzp, endzp - - +WRITE_AUX - jsr LoopBL - +WRITE_MAIN - - +SHR_RESTORE_FROM_STAGE_2 - +READ_RAM1_WRITE_RAM1 + +SHR_STAGE_2 startzp, endzp rts startzp diff --git a/src/fx/fx.shr.radial2.a b/src/fx/fx.shr.radial2.a index cc484aae8..e82e267ae 100644 --- a/src/fx/fx.shr.radial2.a +++ b/src/fx/fx.shr.radial2.a @@ -16,14 +16,7 @@ last_coords = coords+$1F3E !source "src/fx/macros.a" !source "src/fx/fx.shr.common.a" - +BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols - ;X=0 - +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi - ;X=0 - +COPY_SCB_AND_PALETTES - ;X=0 - ;WRITEAUXMEM active - +SHR_COPY_TO_STAGE_2 + +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols jmp stage2 !pseudopc *-$300 { @@ -34,14 +27,7 @@ stage2 lda #$80 sta coords-2 - +COPY_TO_0 startzp, endzp - - +WRITE_AUX - jsr input - +WRITE_MAIN - - +SHR_RESTORE_FROM_STAGE_2 - +READ_RAM1_WRITE_RAM1 + +SHR_STAGE_2 startzp, endzp rts startzp diff --git a/src/fx/fx.shr.ripple.a b/src/fx/fx.shr.ripple.a index ff54d0296..9d4c81c08 100644 --- a/src/fx/fx.shr.ripple.a +++ b/src/fx/fx.shr.ripple.a @@ -21,16 +21,7 @@ coords = $9F00 ; $1F41 bytes !pseudopc *-$300 { stage2 +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy - ;WRITEMAINMEM active - - +COPY_TO_0 startzp, endzp - - +WRITE_AUX - jsr stage3 - +WRITE_MAIN - - +SHR_RESTORE_FROM_STAGE_2 - +READ_RAM1_WRITE_RAM1 + +SHR_STAGE_2 startzp, endzp rts startzp