shave some cycles

This commit is contained in:
4am 2021-12-17 18:29:35 -05:00
parent c340756128
commit 7cc1505b15
29 changed files with 161 additions and 219 deletions

View File

@ -5,11 +5,11 @@
!to "build/DGR.FIZZLE",plain !to "build/DGR.FIZZLE",plain
*=$6000 *=$6000
ldx #(end-start+1) ; copy LFSR code to zero page !source "src/fx/macros.a"
- ldy start-2, x
sty $FE, x +OVERCOPY_TO_0 start, end
dex ;X=0
bne - ;Y=0
jmp loop jmp loop
start start

View File

@ -8,11 +8,9 @@
addrs = $6100 ; [256 bytes, page-aligned, duplicated in auxmem] addrs = $6100 ; [256 bytes, page-aligned, duplicated in auxmem]
copymasks = $6200 ; [256 bytes, page-aligned, duplicated in auxmem] copymasks = $6200 ; [256 bytes, page-aligned, duplicated in auxmem]
ldx #(end-start) ; copy LFSR code to zero page !source "src/fx/macros.a"
- lda start-1, x
sta $FF, x +COPY_TO_0 start, end
dex
bne -
;X=0 ;X=0
;A=3 ;A=3
-- ldy #$40 ; create identical copymask tables in main and aux memory -- ldy #$40 ; create identical copymask tables in main and aux memory

View File

@ -10,11 +10,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a" !source "src/fx/macros.a"
ldx #(end-start) ; copy code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
;X=0 ;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jmp loop jmp loop

View File

@ -10,11 +10,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a" !source "src/fx/macros.a"
ldx #(end-start) ; copy code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
;X=0 ;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jmp loop jmp loop

View File

@ -11,11 +11,7 @@ copymasks= $02C0 ; [$08 bytes, different values in main and
!source "src/fx/macros.a" !source "src/fx/macros.a"
ldx #(end-start) ; copy code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
;X=0 ;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi

View File

@ -7,6 +7,8 @@
addrs=$BF ; [$40 bytes] addrs=$BF ; [$40 bytes]
!source "src/fx/macros.a"
ldx #$1F ; build address lookup table ldx #$1F ; build address lookup table
- txa - txa
eor #$20 eor #$20
@ -15,11 +17,8 @@ addrs=$BF ; [$40 bytes]
sta addrs+$20, x sta addrs+$20, x
dex dex
bpl - bpl -
ldx #(end-start+1) ; copy LFSR code to zero page
- ldy start-2, x +OVERCOPY_TO_0 start, end
sty $FE, x
dex
bne -
;X=0 ;X=0
;Y=0 ;Y=0
jmp copyaux jmp copyaux

View File

@ -55,11 +55,7 @@
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror +BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols +BUILD_MIRROR_COLS mirror_cols
+COPY_SELF_TO_AUXMEM +COPY_SELF_TO_AUXMEM
ldx #(end-start) ; copy InputLoop code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
jmp InputLoop jmp InputLoop
start start
!pseudopc 0 { !pseudopc 0 {
@ -67,7 +63,7 @@ Exit1Bit rts
InputLoop InputLoop
ldy #0 ldy #0
input=*+1 input=*+1
ldx .coords, y ; first value: HGR row (only 0..95 will be in input array) ldx .coords ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1Bit ; if > 127 then we're done bmi Exit1Bit ; if > 127 then we're done
+ROW_X_TO_BASE_ADDRESSES +ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES +ROW_X_TO_MIRROR_ADDRESSES

View File

@ -57,11 +57,7 @@
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
+BUILD_MIRROR_COLS mirror_cols +BUILD_MIRROR_COLS mirror_cols
+COPY_SELF_TO_AUXMEM +COPY_SELF_TO_AUXMEM
ldx #(end-start) ; copy InputLoop code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
jmp InputLoop jmp InputLoop
start start
@ -70,7 +66,7 @@ Exit2Bit rts
InputLoop InputLoop
ldy #0 ldy #0
input=*+1 input=*+1
ldx .coords, y ; first value: HGR row + 1 ldx .coords ; first value: HGR row + 1
beq Exit2Bit ; if 0 then we're done beq Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES +ROW_X_TO_2BIT_BASE_ADDRESSES

View File

@ -11,12 +11,8 @@ copymasks= $02C1 ; [$07 bytes, different values in main and
!source "src/fx/macros.a" !source "src/fx/macros.a"
ldx #(end-start) ; copy code to zero page +COPY_TO_0 start, end
- lda start-1, x ;X=0
sta $FF, x
dex
bne -
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
ldy #7 ; copy copymask arrays into place in main and auxmem ldy #7 ; copy copymask arrays into place in main and auxmem

View File

@ -14,11 +14,8 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a" !source "src/fx/macros.a"
ldx #(end-start) ; copy code to zero page +COPY_TO_0 start, end
- lda start-1, x ;X=0
sta $FF, x
dex
bne -
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jmp loop jmp loop

View File

@ -5,11 +5,11 @@
!to "build/GR.FIZZLE",plain !to "build/GR.FIZZLE",plain
*=$6000 *=$6000
ldx #(end-start+1) ; copy LFSR code to zero page !source "src/fx/macros.a"
- ldy start-2, x
sty $FE, x +OVERCOPY_TO_0 start, end
dex ;X=0
bne - ;Y=0
jmp loop jmp loop
start start

View File

@ -8,11 +8,9 @@
addrs = $6100 ; [256 bytes, page-aligned] addrs = $6100 ; [256 bytes, page-aligned]
copymasks = $6200 ; [256 bytes, page-aligned] copymasks = $6200 ; [256 bytes, page-aligned]
ldx #(end-start) ; copy LFSR code to zero page !source "src/fx/macros.a"
- lda start-1, x
sta $FF, x +COPY_TO_0 start, end
dex
bne -
;X=0 ;X=0
;A=1 ;A=1
-- ldy #$20 ; create copymask table -- ldy #$20 ; create copymask table

View File

@ -8,11 +8,10 @@
addrs = $6100 ; [256 bytes, page-aligned] addrs = $6100 ; [256 bytes, page-aligned]
copymasks = $80 ; [128 bytes, should not cross page boundary] copymasks = $80 ; [128 bytes, should not cross page boundary]
ldx #(end-start) ; copy LFSR code to zero page !source "src/fx/macros.a"
- lda start-1, x
sta $FF, x +COPY_TO_0 start, end
dex ;X=0
bne -
-- ldy #$20 ; create copymask table -- ldy #$20 ; create copymask table
ora #%10000000 ora #%10000000
- sta copymasks, x - sta copymasks, x

View File

@ -12,6 +12,8 @@ hgrlo = $6400 ; [$C0 bytes, should not cross page boundar
hgrhi = $6500 ; [$C0 bytes, should not cross page boundary] hgrhi = $6500 ; [$C0 bytes, should not cross page boundary]
shapemask = $8000 ; [$2000 bytes, page-aligned] shapemask = $8000 ; [$2000 bytes, page-aligned]
!source "src/fx/macros.a"
ldx #0 ; build an HGR base address lookup table, ldx #0 ; build an HGR base address lookup table,
- txa ; except the first address is |shapemask| instead of $2000 - txa ; except the first address is |shapemask| instead of $2000
and #$F8 and #$F8
@ -70,11 +72,8 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
inx inx
cpx #$C0 cpx #$C0
bne -- bne --
ldx #(end-start) ; copy LFSR code to zero page +COPY_TO_0 start, end
- lda start-1, x ;X=0
sta $FF, x
dex
bne -
-- ldy #$20 ; create copymask lookup table -- ldy #$20 ; create copymask lookup table
ora #%10000000 ora #%10000000
- sta copymasks, x - sta copymasks, x

View File

@ -5,11 +5,11 @@
!to "build/FX.INDEXED/FIZZLE",plain !to "build/FX.INDEXED/FIZZLE",plain
*=$6000 *=$6000
ldx #(end-start+1) ; copy LFSR code to zero page !source "src/fx/macros.a"
- ldy start-2, x
sty $FE, x +OVERCOPY_TO_0 start, end
dex ;X=0
bne - ;Y=0
jmp loop jmp loop
start start

View File

@ -7,12 +7,11 @@
!source "src/fx/macros.a" ; no code in here !source "src/fx/macros.a" ; no code in here
ldx #(end-start+1) ; copy LFSR code to zero page +OVERCOPY_TO_0 start, end
- ldy start-2, x ;X=0
sty $FE, x ;Y=0
dex
bne -
bit <exit bit <exit
;V=1
jmp loop jmp loop
start start

View File

@ -267,11 +267,7 @@ aslmod cmp #$1A
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror +BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols +BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks +BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
ldx #(end-start) ; copy InputLoop code to zero page +COPY_TO_0 start, end
- lda start-1, x
sta $FF, x
dex
bne -
jmp InputLoop jmp InputLoop
start start
!pseudopc 0 { !pseudopc 0 {
@ -279,7 +275,7 @@ Exit1Bit rts
InputLoop InputLoop
ldy #0 ldy #0
input=*+1 input=*+1
ldx .coords, y ; first value: HGR row (only 0..95 will be in input array) ldx .coords ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1Bit ; if > 127 then we're done bmi Exit1Bit ; if > 127 then we're done
+ROW_X_TO_BASE_ADDRESSES +ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES +ROW_X_TO_MIRROR_ADDRESSES

View File

@ -265,11 +265,7 @@ zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi +BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+BUILD_MIRROR_COLS mirror_cols +BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks +BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
ldx #(end-start-1) ; copy InputLoop code to zero page +COPY_TO_0 start, end
- lda start, x
sta $0, x
dex
bpl -
jmp InputLoop jmp InputLoop
start start
!pseudopc 0 { !pseudopc 0 {
@ -277,7 +273,7 @@ Exit2Bit rts
InputLoop InputLoop
ldy #0 ldy #0
input=*+1 input=*+1
ldx .coords, y ; first value: HGR row + 1 ldx .coords ; first value: HGR row + 1
beq Exit2Bit ; if 0 then we're done beq Exit2Bit ; if 0 then we're done
+ROW_X_TO_2BIT_BASE_ADDRESSES +ROW_X_TO_2BIT_BASE_ADDRESSES

View File

@ -228,11 +228,7 @@ ripplezp
+BUILD_3BIT_HGR_LOOKUP_TABLES +BUILD_3BIT_HGR_LOOKUP_TABLES
+BUILD_EXTRA_COLS +BUILD_EXTRA_COLS
+BUILD_SPARSE_BITMASKS_3BIT +BUILD_SPARSE_BITMASKS_3BIT
ldx #(end-start-1) ; copy InputLoop code to zero page +COPY_TO_0 start, end
- lda start, x
sta $0, x
dex
bpl -
jmp InputLoop jmp InputLoop
start start
!pseudopc 0 { !pseudopc 0 {
@ -240,7 +236,7 @@ Exit3Bit rts
InputLoop InputLoop
ldy #0 ldy #0
input=*+1 input=*+1
lda .coords, y lda .coords
bmi Exit3Bit ; if high bit is 1 then we're done bmi Exit3Bit ; if high bit is 1 then we're done
cmp #$40 cmp #$40
php php

View File

@ -5,17 +5,13 @@
!to "build/FX.INDEXED/SHR.TWOPASS.LR",plain !to "build/FX.INDEXED/SHR.TWOPASS.LR",plain
*=$A000 *=$A000
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a" !source "src/fx/fx.shr.common.a"
shrlo = $301 ; $C8 bytes shrlo = $301 ; $C8 bytes
shrhi = $38 ; $C8 bytes shrhi = $38 ; $C8 bytes
ldx #(end-start-1) ; copy loop to zero page +COPY_TO_0 start, end
- lda start, x
sta $00, x
dex
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES

View File

@ -64,3 +64,55 @@
inx inx
bne - bne -
} }
!macro BUILD_SHR_MIRROR_ROWS_AND_COLS .mirror_rows, .mirror_cols {
; out: X=0
; Z=1
ldx #$C6
ldy #$00
- tya
sta .mirror_cols-$27, x
sta .mirror_rows-1, x
iny
dex
bne -
}
!macro SHR_COPY_TO_STAGE_2 {
; in: X=0 /!\
; out: X=0
; Z=1
; WRITEMAINMEM active
+WRITE_MAIN
- lda $A000, x
sta $9D00, x
lda $A100, x
sta $9E00, x
inx
bne -
}
!macro SHR_RESTORE_FROM_STAGE_2 {
; out: X=0
; Z=1
ldx #$00
- lda $9D00, x ; copy main code back to $A000
sta $A000, x ; so it can be called again if necessary
lda $9E00, x
sta $A100, x
inx
bne -
}
!macro LOAD_SHR_COORDINATES_AT .coords, .filename, .scratch {
; out: WRITEMAINMEM active
; LC RAM2 active and read/write
ldx .filename ; LOAD_FILE_AT macro destroys pathname
- lda .filename, x ; so we need to make a copy
sta .scratch, x
dex
bpl -
+READ_RAM2_WRITE_RAM2
+LOAD_FILE_AT .scratch, .coords
}

View File

@ -5,17 +5,13 @@
!to "build/FX.INDEXED/SHR.DIAGONAL",plain !to "build/FX.INDEXED/SHR.DIAGONAL",plain
*=$A000 *=$A000
!source "src/fx/fx.shr.common.a"
shrlo = $301 ; $C8 bytes shrlo = $301 ; $C8 bytes
shrhi = $201 ; $C8 bytes shrhi = $201 ; $C8 bytes
ldx #(end-start-1) ; copy loop to zero page !source "src/fx/macros.a"
- lda start, x !source "src/fx/fx.shr.common.a"
sta $00, x
dex
bpl -
+COPY_TO_0 start, end
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES

View File

@ -5,6 +5,7 @@
!to "build/FX.INDEXED/SHR.FIZZLE",plain !to "build/FX.INDEXED/SHR.FIZZLE",plain
*=$A000 *=$A000
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a" !source "src/fx/fx.shr.common.a"
addrs=$7F ; [128 bytes] addrs=$7F ; [128 bytes]
@ -17,11 +18,7 @@ addrs=$7F ; [128 bytes]
dex dex
bne - bne -
ldx #(end-start+1) ; copy LFSR code to zero page +OVERCOPY_TO_0 start, end
- ldy start-2, x
sty $FE, x
dex
bne -
;X=0 ;X=0
;Y=0 ;Y=0

View File

@ -5,21 +5,16 @@
!to "build/FX.INDEXED/SHR.LR",plain !to "build/FX.INDEXED/SHR.LR",plain
*=$A000 *=$A000
!source "src/fx/macros.a"
!source "src/fx/fx.shr.common.a" !source "src/fx/fx.shr.common.a"
shrlo = $301 ; $C8 bytes shrlo = $301 ; $C8 bytes
shrhi = $37 ; $C8 bytes shrhi = $37 ; $C8 bytes
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
+OVERCOPY_TO_0 start, end
ldx #(end-start+1) ; copy loop to zero page
- ldy start-2, x
sty $FE, x
dex
bne -
;X=0 ;X=0
;Y=0 ;Y=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES
;WRITEAUXMEM active ;WRITEAUXMEM active

View File

@ -5,17 +5,13 @@
!to "build/FX.INDEXED/SHR.LR2",plain !to "build/FX.INDEXED/SHR.LR2",plain
*=$A000 *=$A000
!source "src/fx/fx.shr.common.a"
shrlo = $301 ; $C8 bytes shrlo = $301 ; $C8 bytes
shrhi = $38 ; $C8 bytes shrhi = $38 ; $C8 bytes
ldx #(end-start-1) ; copy loop to zero page !source "src/fx/macros.a"
- lda start, x !source "src/fx/fx.shr.common.a"
sta $00, x
dex
bpl -
+COPY_TO_0 start, end
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES

View File

@ -8,63 +8,32 @@ mirror_cols = $1E29 ; $A0 bytes but clobbers $28 bytes before
mirror_rows = $1F01 ; $C7 bytes mirror_rows = $1F01 ; $C7 bytes
coords = $9F00 ; $1F41 bytes coords = $9F00 ; $1F41 bytes
!source "src/constants.a" !source "src/fx/macros.a"
!source "src/macros.a"
!source "src/fx/fx.shr.common.a" !source "src/fx/fx.shr.common.a"
start start
ldx #$C6 +BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
ldy #$00 ;X=0
- tya
sta mirror_cols-$27, x
sta mirror_rows-1, x
iny
dex
bne -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
+WRITE_MAIN
;X=0 ;X=0
- lda start, x ;WRITEAUXMEM active
sta $9D00, x +SHR_COPY_TO_STAGE_2
lda start+$100, x
sta $9E00, x
inx
bne -
jmp stage2 jmp stage2
!pseudopc *-$300 { !pseudopc *-$300 {
stage2 stage2
ldx CoordinatesFile ; LOAD_FILE_AT macro destroys pathname +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
- lda CoordinatesFile, x ; so we need to make a copy ;WRITEMAINMEM active
sta CoordinatesFileCopy, x
dex
bpl -
+READ_RAM2_WRITE_RAM2 +COPY_TO_0 startzp, endzp
+LOAD_FILE_AT CoordinatesFileCopy, coords
;WRITEMAINMEM active after LOAD_FILE_AT macro
ldx #(endzp-startzp) ; copy loop code to zero page
- lda startzp-1, x
sta $FF, x
dex
bne -
+WRITE_AUX +WRITE_AUX
jsr InputLoop jsr InputLoop
+WRITE_MAIN +WRITE_MAIN
ldx #$00 +SHR_RESTORE_FROM_STAGE_2
- lda $9D00, x ; copy main code back to $A000
sta start, x ; so it can be called again if necessary
lda $9E00, x
sta start+$100, x
inx
bne -
+READ_RAM1_WRITE_RAM1 +READ_RAM1_WRITE_RAM1
rts rts

View File

@ -13,65 +13,35 @@ mirror_rows = $1F01 ; $C7 bytes
coords = $9F00 ; $1F41 bytes coords = $9F00 ; $1F41 bytes
last_coords = coords+$1F3E last_coords = coords+$1F3E
!source "src/constants.a" !source "src/fx/macros.a"
!source "src/macros.a"
!source "src/fx/fx.shr.common.a" !source "src/fx/fx.shr.common.a"
start start
ldx #$C6 +BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
ldy #$00 ;X=0
- tya
sta mirror_cols-$27, x
sta mirror_rows-1, x
iny
dex
bne -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0
+COPY_SCB_AND_PALETTES +COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
+WRITE_MAIN
;X=0 ;X=0
- lda start, x ;WRITEAUXMEM active
sta $9D00, x +SHR_COPY_TO_STAGE_2
lda start+$100, x
sta $9E00, x
inx
bne -
jmp stage2 jmp stage2
!pseudopc *-$300 { !pseudopc *-$300 {
stage2 stage2
ldx CoordinatesFile ; LOAD_FILE_AT macro destroys pathname +LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
- lda CoordinatesFile, x ; so we need to make a copy ;WRITEMAINMEM active
sta CoordinatesFileCopy, x
dex
bpl -
+READ_RAM2_WRITE_RAM2
+LOAD_FILE_AT CoordinatesFileCopy, coords
;WRITEMAINMEM active after LOAD_FILE_AT macro
lda #$80 lda #$80
sta coords-2 sta coords-2
ldx #(endzp-startzp) ; copy loop code to zero page +COPY_TO_0 startzp, endzp
- lda startzp-1, x
sta $FF, x
dex
bne -
+WRITE_AUX +WRITE_AUX
jsr LoopBL jsr LoopBL
+WRITE_MAIN +WRITE_MAIN
ldx #$00 +SHR_RESTORE_FROM_STAGE_2
- lda $9D00, x ; copy main code back to $A000
sta start, x ; so it can be called again if necessary
lda $9E00, x
sta start+$100, x
inx
bne -
+READ_RAM1_WRITE_RAM1 +READ_RAM1_WRITE_RAM1
rts rts

View File

@ -5,19 +5,15 @@
!to "build/FX.INDEXED/SHR.UD",plain !to "build/FX.INDEXED/SHR.UD",plain
*=$A000 *=$A000
!source "src/fx/fx.shr.common.a"
shrlo = $301 ; $C8 bytes shrlo = $301 ; $C8 bytes
shrhi = $38 ; $C8 bytes shrhi = $38 ; $C8 bytes
reverseshrlo = $BD01 ; $C8 bytes reverseshrlo = $BD01 ; $C8 bytes
reverseshrhi = $BE01 ; $C8 bytes reverseshrhi = $BE01 ; $C8 bytes
ldx #(end-start-1) ; copy loop to zero page !source "src/fx/macros.a"
- lda start, x !source "src/fx/fx.shr.common.a"
sta $00, x
dex
bpl -
+COPY_TO_0 start, end
+BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi +BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0 ;X=0

View File

@ -161,5 +161,27 @@
+ +
} }
!macro COPY_TO_0 .start, .end {
; out: X=0
; Z=1
ldx #(.end-.start)
- lda .start-1, x
sta $FF, x
dex
bne -
}
!macro OVERCOPY_TO_0 .start, .end {
; over-copy region to $00
; clobbers $FF
; out: X=0
; Y=last byte before start (e.g. 0 if the last instruction is JMP $0000)
ldx #(.end-.start+1)
- ldy .start-2, x
sty $FE, x
dex
bne -
}
_FX_MACROS_=* _FX_MACROS_=*
} }