2020-11-15 00:07:19 +00:00
|
|
|
mirror_src1 = $E8 ; word
|
|
|
|
mirror_dest1 = $EA ; word
|
|
|
|
mirror_src2 = $EC ; word
|
|
|
|
mirror_dest2 = $EE ; word
|
|
|
|
src1 = $F0 ; word
|
|
|
|
dest1 = $F2 ; word
|
|
|
|
src2 = $F4 ; word
|
|
|
|
dest2 = $F6 ; word
|
|
|
|
reverse_input = $FC ; word
|
|
|
|
input = $FE ; word
|
2020-09-06 18:02:11 +00:00
|
|
|
|
2019-11-23 18:45:21 +00:00
|
|
|
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
|
|
|
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
|
|
|
+BUILD_MIRROR_COLS mirror_cols
|
|
|
|
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
2020-11-15 05:05:14 +00:00
|
|
|
+LDADDR Coordinates
|
2020-11-15 00:07:19 +00:00
|
|
|
+ST16 input
|
2020-11-15 05:05:14 +00:00
|
|
|
+LDADDR EndCoordinates-2
|
2020-03-24 20:30:14 +00:00
|
|
|
+ST16 reverse_input
|
2019-11-23 18:45:21 +00:00
|
|
|
jmp Loop
|
|
|
|
Exit rts
|
|
|
|
Loop ldy #0
|
2020-11-15 00:07:19 +00:00
|
|
|
lda (input),y
|
2019-11-23 18:45:21 +00:00
|
|
|
bmi Exit
|
|
|
|
tax
|
|
|
|
+ROW_X_TO_BASE_ADDRESSES
|
|
|
|
+ROW_X_TO_MIRROR_ADDRESSES
|
2020-11-15 00:07:19 +00:00
|
|
|
inc input
|
|
|
|
lda (input),y
|
|
|
|
+HIGH_3_LOW_5 input
|
2019-11-23 18:45:21 +00:00
|
|
|
|
2020-11-15 00:07:19 +00:00
|
|
|
; top-left quadrant (original row, original column, original input order)
|
|
|
|
+COPY_BIT src1, dest1, copymasks
|
|
|
|
+COPY_BIT src2, dest2, copymasks
|
2019-11-23 18:45:21 +00:00
|
|
|
|
2020-11-15 00:07:19 +00:00
|
|
|
; bottom-right quadrant (opposite row, opposite column, original input order)
|
2019-11-23 18:45:21 +00:00
|
|
|
lda mirror_cols,y
|
|
|
|
tay
|
2020-11-15 00:07:19 +00:00
|
|
|
+COPY_BIT mirror_src1, mirror_dest1, mirror_copymasks
|
|
|
|
+COPY_BIT mirror_src2, mirror_dest2, mirror_copymasks
|
2019-11-23 18:45:21 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-11-15 00:07:19 +00:00
|
|
|
; bottom-left quadrant (opposite row, original column, reverse input order)
|
|
|
|
+COPY_BIT mirror_src1, mirror_dest1, copymasks
|
|
|
|
+COPY_BIT mirror_src2, mirror_dest2, copymasks
|
2019-11-23 18:45:21 +00:00
|
|
|
|
2020-11-15 00:07:19 +00:00
|
|
|
; top-right quadrant (same row, opposite column, reverse input order)
|
2019-11-23 18:45:21 +00:00
|
|
|
lda mirror_cols,y
|
|
|
|
tay
|
2020-11-15 00:07:19 +00:00
|
|
|
+COPY_BIT src1, dest1, mirror_copymasks
|
|
|
|
+COPY_BIT src2, dest2, mirror_copymasks
|
2019-11-23 18:45:21 +00:00
|
|
|
|
2020-11-15 00:07:19 +00:00
|
|
|
inc input
|
2019-11-23 18:45:21 +00:00
|
|
|
bne +
|
2020-11-15 00:07:19 +00:00
|
|
|
inc input+1
|
2019-11-23 18:45:21 +00:00
|
|
|
+ lda reverse_input
|
2020-11-25 02:18:55 +00:00
|
|
|
php
|
2019-11-23 18:45:21 +00:00
|
|
|
dec reverse_input
|
|
|
|
dec reverse_input
|
2020-11-25 02:18:55 +00:00
|
|
|
plp
|
|
|
|
bne +
|
2019-11-23 18:45:21 +00:00
|
|
|
dec reverse_input+1
|
|
|
|
bit $c000
|
2020-11-25 02:18:55 +00:00
|
|
|
bmi ++
|
|
|
|
+ jmp Loop
|
|
|
|
++ rts
|