;license:MIT ;(c) 2021 by 4am ; !cpu 6502 !to "build/FX.INDEXED/SHR.RADIAL2",plain *=$A000 mirror_rows = $106 ; $C8 bytes shrlo = $200 ; $C8 bytes 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 !source "src/fx/macros.a" +SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols jmp stage2 !pseudopc *-$300 { stage2 +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy ;WRITEMAINMEM active lda #$80 sta coords-2 +SHR_STAGE_2 startzp, endzp rts startzp !pseudopc 0 { ; top-left quadrant (original row, original column, original input order) input ldx coords ; SMC bmi exit ldy #1 lda (input+1), y tay jsr copy ; bottom-right quadrant (opposite row, opposite column, original input order) lda mirror_rows, x tax lda mirror_cols, y tay jsr copy ; bottom-left quadrant (opposite row, original column, reverse input order) reverse_input ldx last_coords ; SMC lda mirror_rows, x tax ldy #1 lda (reverse_input+1), y tay jsr copy ; top-right quadrant (original row, opposite column, reverse input order) lda mirror_rows, x ; mirror of the mirror tax lda mirror_cols, y tay jsr copy inc