;license:MIT ;(c) 2019 by 4am ; !cpu 6502 !to "build/FX/RADIAL3",plain *=$6000 !source "src/fx/fx.hgr.precomputed.1bit.a" +BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi +BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror +BUILD_MIRROR_COLS mirror_cols +BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks +LDADDR Coordinates +STAY input +LDADDR EndCoordinates-2 +STAY reverse_input jmp Loop Exit rts Loop ldy #0 lda (input),y bmi Exit tax +ROW_X_TO_BASE_ADDRESSES +ROW_X_TO_MIRROR_ADDRESSES inc input lda (input),y +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 ; 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 ldy #0 lda (reverse_input),y tax +ROW_X_TO_BASE_ADDRESSES +ROW_X_TO_MIRROR_ADDRESSES iny lda (reverse_input),y +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 ; 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 inc input bne + inc input+1 + lda reverse_input beq + dec reverse_input dec reverse_input jmp Loop + dec reverse_input dec reverse_input dec reverse_input+1 bit $c000 bmi + jmp Loop + rts !if * and 1 { !byte 0 } Coordinates !source "src/fx/fx.hgr.radial.data.a" EndCoordinates !byte $80