some macros

This commit is contained in:
4am 2021-12-17 21:05:39 -05:00
parent d2d638539a
commit 0ec05f3f88
6 changed files with 27 additions and 71 deletions

View File

@ -128,6 +128,17 @@
+SHR_COPY_TO_STAGE_2
}
!macro SHR_STAGE_2 .startzp, .endzp {
+COPY_TO_0 .startzp, .endzp
+WRITE_AUX
jsr $0
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
}
!macro SHR_STAGE_3 .coords, .shrlo, .shrhi, .mirror_rows, .mirror_cols {
input ldx .coords ; first value: SHR row (only 0..99 will be in input array)
bmi exit ; if > 127 then we're done
@ -177,14 +188,15 @@ src2 lda $FD00, y ; SMC high byte
exit rts
}
!macro SHR_REVERSE .coords, .endcoords {
ldy #<coords
!macro SHR_REVERSE .coords {
.length=$1F40
ldy #<.coords
sty $f0
lda #>coords
lda #>.coords
sta $f1
lda #<(.endcoords - 2)
lda #<(.coords + .length - 2)
sta $f2
lda #>(.endcoords - 2)
lda #>(.coords + .length - 2)
sta $f3
clc
!byte $24
@ -204,10 +216,10 @@ exit rts
bne +
inc $f1
+ lda $f1
eor #>(.coords + (.endcoords-.coords)/2)
eor #>(.coords + .length/2)
bne +
lda $f0
eor #<(.coords + (.endcoords-.coords)/2)
eor #<(.coords + .length/2)
beq ++
+ lda $f2
bne +

View File

@ -21,16 +21,7 @@ coords = $9F00 ; $1F41 bytes
!pseudopc *-$300 {
stage2
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
;WRITEMAINMEM active
+COPY_TO_0 startzp, endzp
+WRITE_AUX
jsr stage3
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
+SHR_STAGE_2 startzp, endzp
rts
startzp

View File

@ -11,7 +11,6 @@ shrhi = $301 ; $C8 bytes
mirror_cols = $1E29 ; $A0 bytes but clobbers $28 bytes before
mirror_rows = $1F01 ; $C7 bytes
coords = $9F00 ; $1F41 bytes
endcoords = $BE40
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a"
@ -22,17 +21,8 @@ endcoords = $BE40
!pseudopc *-$300 {
stage2
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
;WRITEMAINMEM active
+SHR_REVERSE coords, endcoords
+COPY_TO_0 startzp, endzp
+WRITE_AUX
jsr stage3
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
+SHR_REVERSE coords
+SHR_STAGE_2 startzp, endzp
rts
startzp

View File

@ -16,14 +16,7 @@ last_coords = coords+$1F3E
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a"
+BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
;X=0
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;X=0
;WRITEAUXMEM active
+SHR_COPY_TO_STAGE_2
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -34,14 +27,7 @@ stage2
lda #$80
sta coords-2
+COPY_TO_0 startzp, endzp
+WRITE_AUX
jsr LoopBL
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
+SHR_STAGE_2 startzp, endzp
rts
startzp

View File

@ -16,14 +16,7 @@ last_coords = coords+$1F3E
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a"
+BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
;X=0
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;X=0
;WRITEAUXMEM active
+SHR_COPY_TO_STAGE_2
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
jmp stage2
!pseudopc *-$300 {
@ -34,14 +27,7 @@ stage2
lda #$80
sta coords-2
+COPY_TO_0 startzp, endzp
+WRITE_AUX
jsr input
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
+SHR_STAGE_2 startzp, endzp
rts
startzp

View File

@ -21,16 +21,7 @@ coords = $9F00 ; $1F41 bytes
!pseudopc *-$300 {
stage2
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
;WRITEMAINMEM active
+COPY_TO_0 startzp, endzp
+WRITE_AUX
jsr stage3
+WRITE_MAIN
+SHR_RESTORE_FROM_STAGE_2
+READ_RAM1_WRITE_RAM1
+SHR_STAGE_2 startzp, endzp
rts
startzp