4cade/src/fx/fx.shr.radial.a

126 lines
2.9 KiB
Plaintext
Raw Permalink Normal View History

2021-12-17 03:07:35 +00:00
;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
2021-12-17 03:07:35 +00:00
last_coords = coords+$1F3E
2024-05-27 17:32:07 +00:00
shr_mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
2021-12-17 03:07:35 +00:00
2021-12-17 23:29:35 +00:00
!source "src/fx/macros.a"
2021-12-17 03:07:35 +00:00
2024-05-27 17:32:07 +00:00
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, shr_mirror_cols
2021-12-17 03:07:35 +00:00
jmp stage2
!pseudopc *-$300 {
stage2
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile
2021-12-17 23:29:35 +00:00
;WRITEMAINMEM active
2021-12-17 03:07:35 +00:00
lda #$80
sta coords-2
2021-12-18 02:05:39 +00:00
+SHR_STAGE_2 startzp, endzp
2021-12-17 03:07:35 +00:00
rts
CoordinatesFile
+PSTRING "SHR.RADIAL.DATA"
2021-12-17 03:07:35 +00:00
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
2024-05-29 01:17:10 +00:00
bit KBD
2021-12-17 03:07:35 +00:00
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
2024-05-29 01:17:10 +00:00
bit KBD
2021-12-17 03:07:35 +00:00
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
2024-05-27 17:32:07 +00:00
lda shr_mirror_cols, y
2021-12-17 03:07:35 +00:00
tay
jsr copy
lda <LoopTR+1
php
dec <LoopTR+1
dec <LoopTR+1
plp
bne LoopTR
dec <LoopTR+2
2024-05-29 01:17:10 +00:00
bit KBD
2021-12-17 03:07:35 +00:00
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
2024-05-27 17:32:07 +00:00
lda shr_mirror_cols, y
2021-12-17 03:07:35 +00:00
tay
jsr copy
inc <LoopBR+1
inc <LoopBR+1
bne LoopBR
inc <LoopBR+2
2024-05-29 01:17:10 +00:00
bit KBD
2021-12-17 03:07:35 +00:00
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
2021-12-18 00:52:37 +00:00
exit rts
2021-12-17 03:07:35 +00:00
}
endzp
!if (* - stage2 > $200) { !serious "Stage2 code is too large" }
2021-12-17 03:07:35 +00:00
}