mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-27 12:57:21 +00:00
127 lines
2.9 KiB
Plaintext
127 lines
2.9 KiB
Plaintext
;license:MIT
|
|
;(c) 2021 by 4am
|
|
;
|
|
!cpu 6502
|
|
!to "build/FX.INDEXED/SHR.RADIAL",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 {
|
|
; bottom-left quadrant (opposite row, original column, reverse input order)
|
|
LoopBL ldx last_coords ; SMC
|
|
bmi LoopTL
|
|
lda mirror_rows, x
|
|
tax
|
|
ldy #1
|
|
lda (LoopBL+1), y
|
|
tay
|
|
jsr copy
|
|
lda <LoopBL+1
|
|
php
|
|
dec <LoopBL+1
|
|
dec <LoopBL+1
|
|
plp
|
|
bne LoopBL
|
|
dec <LoopBL+2
|
|
bit $C000
|
|
bpl LoopBL
|
|
rts
|
|
|
|
; top-left quadrant (original row, original column, original input order)
|
|
LoopTL ldx coords ; SMC
|
|
bmi LoopTR
|
|
ldy #1
|
|
lda (LoopTL+1), y
|
|
tay
|
|
jsr copy
|
|
inc <LoopTL+1
|
|
inc <LoopTL+1
|
|
bne LoopTL
|
|
inc <LoopTL+2
|
|
bit $C000
|
|
bpl LoopTL
|
|
rts
|
|
|
|
; top-right quadrant (original row, opposite column, reverse input order)
|
|
LoopTR ldx last_coords ; SMC
|
|
bmi LoopBR
|
|
ldy #1
|
|
lda (LoopTR+1), y
|
|
tay
|
|
lda mirror_cols, y
|
|
tay
|
|
jsr copy
|
|
lda <LoopTR+1
|
|
php
|
|
dec <LoopTR+1
|
|
dec <LoopTR+1
|
|
plp
|
|
bne LoopTR
|
|
dec <LoopTR+2
|
|
bit $C000
|
|
bpl LoopTR
|
|
rts
|
|
|
|
; bottom-right quadrant (opposite row, opposite column, original input order)
|
|
LoopBR ldx coords ; SMC
|
|
bmi exit
|
|
lda mirror_rows, x
|
|
tax
|
|
ldy #1
|
|
lda (LoopBR+1), y
|
|
tay
|
|
lda mirror_cols, y
|
|
tay
|
|
jsr copy
|
|
inc <LoopBR+1
|
|
inc <LoopBR+1
|
|
bne LoopBR
|
|
inc <LoopBR+2
|
|
bit $C000
|
|
bpl LoopBR
|
|
copy
|
|
lda shrlo, x
|
|
sta <src1+1
|
|
lda shrhi, x
|
|
sta <src1+2
|
|
lda shrlo+1, x
|
|
sta <src2+1
|
|
lda shrhi+1, x
|
|
sta <src2+2
|
|
src1 lda $FD00, y ; SMC high byte
|
|
sta (src1+1), y
|
|
src2 lda $FD00, y ; SMC high byte
|
|
sta (src2+1), y
|
|
exit rts
|
|
}
|
|
endzp
|
|
}
|
|
|
|
CoordinatesFile
|
|
!byte 18
|
|
!text "FX/SHR.RADIAL.DATA"
|