mirror of
https://github.com/a2-4am/4cade.git
synced 2025-02-06 13:30:32 +00:00
shave some cycles
This commit is contained in:
parent
c340756128
commit
7cc1505b15
@ -5,11 +5,11 @@
|
||||
!to "build/DGR.FIZZLE",plain
|
||||
*=$6000
|
||||
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
jmp loop
|
||||
|
||||
start
|
||||
|
@ -8,11 +8,9 @@
|
||||
addrs = $6100 ; [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
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
;A=3
|
||||
-- ldy #$40 ; create identical copymask tables in main and aux memory
|
||||
|
@ -10,11 +10,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #(end-start) ; copy code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
jmp loop
|
||||
|
@ -10,11 +10,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #(end-start) ; copy code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
jmp loop
|
||||
|
@ -11,11 +11,7 @@ copymasks= $02C0 ; [$08 bytes, different values in main and
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #(end-start) ; copy code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
addrs=$BF ; [$40 bytes]
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #$1F ; build address lookup table
|
||||
- txa
|
||||
eor #$20
|
||||
@ -15,11 +17,8 @@ addrs=$BF ; [$40 bytes]
|
||||
sta addrs+$20, x
|
||||
dex
|
||||
bpl -
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
jmp copyaux
|
||||
|
@ -55,11 +55,7 @@
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
ldx #(end-start) ; copy InputLoop code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
!pseudopc 0 {
|
||||
@ -67,7 +63,7 @@ Exit1Bit rts
|
||||
InputLoop
|
||||
ldy #0
|
||||
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
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
|
@ -57,11 +57,7 @@
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
ldx #(end-start) ; copy InputLoop code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
|
||||
start
|
||||
@ -70,7 +66,7 @@ Exit2Bit rts
|
||||
InputLoop
|
||||
ldy #0
|
||||
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
|
||||
+ROW_X_TO_2BIT_BASE_ADDRESSES
|
||||
|
||||
|
@ -11,12 +11,8 @@ copymasks= $02C1 ; [$07 bytes, different values in main and
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #(end-start) ; copy code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
|
||||
ldy #7 ; copy copymask arrays into place in main and auxmem
|
||||
|
@ -14,11 +14,8 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only]
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #(end-start) ; copy code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
jmp loop
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
!to "build/GR.FIZZLE",plain
|
||||
*=$6000
|
||||
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
jmp loop
|
||||
|
||||
start
|
||||
|
@ -8,11 +8,9 @@
|
||||
addrs = $6100 ; [256 bytes, page-aligned]
|
||||
copymasks = $6200 ; [256 bytes, page-aligned]
|
||||
|
||||
ldx #(end-start) ; copy LFSR code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
;A=1
|
||||
-- ldy #$20 ; create copymask table
|
||||
|
@ -8,11 +8,10 @@
|
||||
addrs = $6100 ; [256 bytes, page-aligned]
|
||||
copymasks = $80 ; [128 bytes, should not cross page boundary]
|
||||
|
||||
ldx #(end-start) ; copy LFSR code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
-- ldy #$20 ; create copymask table
|
||||
ora #%10000000
|
||||
- sta copymasks, x
|
||||
|
@ -12,6 +12,8 @@ hgrlo = $6400 ; [$C0 bytes, should not cross page boundar
|
||||
hgrhi = $6500 ; [$C0 bytes, should not cross page boundary]
|
||||
shapemask = $8000 ; [$2000 bytes, page-aligned]
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldx #0 ; build an HGR base address lookup table,
|
||||
- txa ; except the first address is |shapemask| instead of $2000
|
||||
and #$F8
|
||||
@ -70,11 +72,8 @@ shapemask = $8000 ; [$2000 bytes, page-aligned]
|
||||
inx
|
||||
cpx #$C0
|
||||
bne --
|
||||
ldx #(end-start) ; copy LFSR code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
;X=0
|
||||
-- ldy #$20 ; create copymask lookup table
|
||||
ora #%10000000
|
||||
- sta copymasks, x
|
||||
|
@ -5,11 +5,11 @@
|
||||
!to "build/FX.INDEXED/FIZZLE",plain
|
||||
*=$6000
|
||||
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
jmp loop
|
||||
|
||||
start
|
||||
|
@ -7,12 +7,11 @@
|
||||
|
||||
!source "src/fx/macros.a" ; no code in here
|
||||
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
bit <exit
|
||||
;V=1
|
||||
jmp loop
|
||||
|
||||
start
|
||||
|
@ -267,11 +267,7 @@ aslmod cmp #$1A
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
ldx #(end-start) ; copy InputLoop code to zero page
|
||||
- lda start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
!pseudopc 0 {
|
||||
@ -279,7 +275,7 @@ Exit1Bit rts
|
||||
InputLoop
|
||||
ldy #0
|
||||
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
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
|
@ -265,11 +265,7 @@ zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
|
||||
ldx #(end-start-1) ; copy InputLoop code to zero page
|
||||
- lda start, x
|
||||
sta $0, x
|
||||
dex
|
||||
bpl -
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
!pseudopc 0 {
|
||||
@ -277,7 +273,7 @@ Exit2Bit rts
|
||||
InputLoop
|
||||
ldy #0
|
||||
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
|
||||
+ROW_X_TO_2BIT_BASE_ADDRESSES
|
||||
|
||||
|
@ -228,11 +228,7 @@ ripplezp
|
||||
+BUILD_3BIT_HGR_LOOKUP_TABLES
|
||||
+BUILD_EXTRA_COLS
|
||||
+BUILD_SPARSE_BITMASKS_3BIT
|
||||
ldx #(end-start-1) ; copy InputLoop code to zero page
|
||||
- lda start, x
|
||||
sta $0, x
|
||||
dex
|
||||
bpl -
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
!pseudopc 0 {
|
||||
@ -240,7 +236,7 @@ Exit3Bit rts
|
||||
InputLoop
|
||||
ldy #0
|
||||
input=*+1
|
||||
lda .coords, y
|
||||
lda .coords
|
||||
bmi Exit3Bit ; if high bit is 1 then we're done
|
||||
cmp #$40
|
||||
php
|
||||
|
@ -5,17 +5,13 @@
|
||||
!to "build/FX.INDEXED/SHR.TWOPASS.LR",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes
|
||||
shrhi = $38 ; $C8 bytes
|
||||
|
||||
ldx #(end-start-1) ; copy loop to zero page
|
||||
- lda start, x
|
||||
sta $00, x
|
||||
dex
|
||||
bpl -
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
+COPY_SCB_AND_PALETTES
|
||||
|
@ -64,3 +64,55 @@
|
||||
inx
|
||||
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
|
||||
}
|
||||
|
@ -5,17 +5,13 @@
|
||||
!to "build/FX.INDEXED/SHR.DIAGONAL",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes
|
||||
shrhi = $201 ; $C8 bytes
|
||||
|
||||
ldx #(end-start-1) ; copy loop to zero page
|
||||
- lda start, x
|
||||
sta $00, x
|
||||
dex
|
||||
bpl -
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
+COPY_SCB_AND_PALETTES
|
||||
|
@ -5,6 +5,7 @@
|
||||
!to "build/FX.INDEXED/SHR.FIZZLE",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
addrs=$7F ; [128 bytes]
|
||||
@ -17,11 +18,7 @@ addrs=$7F ; [128 bytes]
|
||||
dex
|
||||
bne -
|
||||
|
||||
ldx #(end-start+1) ; copy LFSR code to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
|
||||
|
@ -5,21 +5,16 @@
|
||||
!to "build/FX.INDEXED/SHR.LR",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes
|
||||
shrhi = $37 ; $C8 bytes
|
||||
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
|
||||
ldx #(end-start+1) ; copy loop to zero page
|
||||
- ldy start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
+OVERCOPY_TO_0 start, end
|
||||
;X=0
|
||||
;Y=0
|
||||
|
||||
+COPY_SCB_AND_PALETTES
|
||||
;WRITEAUXMEM active
|
||||
|
||||
|
@ -5,17 +5,13 @@
|
||||
!to "build/FX.INDEXED/SHR.LR2",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes
|
||||
shrhi = $38 ; $C8 bytes
|
||||
|
||||
ldx #(end-start-1) ; copy loop to zero page
|
||||
- lda start, x
|
||||
sta $00, x
|
||||
dex
|
||||
bpl -
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
+COPY_SCB_AND_PALETTES
|
||||
|
@ -8,63 +8,32 @@ mirror_cols = $1E29 ; $A0 bytes but clobbers $28 bytes before
|
||||
mirror_rows = $1F01 ; $C7 bytes
|
||||
coords = $9F00 ; $1F41 bytes
|
||||
|
||||
!source "src/constants.a"
|
||||
!source "src/macros.a"
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
start
|
||||
ldx #$C6
|
||||
ldy #$00
|
||||
- tya
|
||||
sta mirror_cols-$27, x
|
||||
sta mirror_rows-1, x
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
|
||||
+BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
|
||||
;X=0
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
+COPY_SCB_AND_PALETTES
|
||||
;WRITEAUXMEM active
|
||||
+WRITE_MAIN
|
||||
;X=0
|
||||
- lda start, x
|
||||
sta $9D00, x
|
||||
lda start+$100, x
|
||||
sta $9E00, x
|
||||
inx
|
||||
bne -
|
||||
;WRITEAUXMEM active
|
||||
+SHR_COPY_TO_STAGE_2
|
||||
jmp stage2
|
||||
|
||||
!pseudopc *-$300 {
|
||||
stage2
|
||||
ldx CoordinatesFile ; LOAD_FILE_AT macro destroys pathname
|
||||
- lda CoordinatesFile, x ; so we need to make a copy
|
||||
sta CoordinatesFileCopy, x
|
||||
dex
|
||||
bpl -
|
||||
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
|
||||
;WRITEMAINMEM active
|
||||
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
+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 -
|
||||
+COPY_TO_0 startzp, endzp
|
||||
|
||||
+WRITE_AUX
|
||||
jsr InputLoop
|
||||
+WRITE_MAIN
|
||||
|
||||
ldx #$00
|
||||
- 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 -
|
||||
+SHR_RESTORE_FROM_STAGE_2
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
|
@ -13,65 +13,35 @@ mirror_rows = $1F01 ; $C7 bytes
|
||||
coords = $9F00 ; $1F41 bytes
|
||||
last_coords = coords+$1F3E
|
||||
|
||||
!source "src/constants.a"
|
||||
!source "src/macros.a"
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
start
|
||||
ldx #$C6
|
||||
ldy #$00
|
||||
- tya
|
||||
sta mirror_cols-$27, x
|
||||
sta mirror_rows-1, x
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
|
||||
+BUILD_SHR_MIRROR_ROWS_AND_COLS mirror_rows, mirror_cols
|
||||
;X=0
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
+COPY_SCB_AND_PALETTES
|
||||
;WRITEAUXMEM active
|
||||
+WRITE_MAIN
|
||||
;X=0
|
||||
- lda start, x
|
||||
sta $9D00, x
|
||||
lda start+$100, x
|
||||
sta $9E00, x
|
||||
inx
|
||||
bne -
|
||||
;WRITEAUXMEM active
|
||||
+SHR_COPY_TO_STAGE_2
|
||||
jmp stage2
|
||||
|
||||
!pseudopc *-$300 {
|
||||
stage2
|
||||
ldx CoordinatesFile ; LOAD_FILE_AT macro destroys pathname
|
||||
- lda CoordinatesFile, x ; so we need to make a copy
|
||||
sta CoordinatesFileCopy, x
|
||||
dex
|
||||
bpl -
|
||||
+LOAD_SHR_COORDINATES_AT coords, CoordinatesFile, CoordinatesFileCopy
|
||||
;WRITEMAINMEM active
|
||||
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
+LOAD_FILE_AT CoordinatesFileCopy, coords
|
||||
;WRITEMAINMEM active after LOAD_FILE_AT macro
|
||||
lda #$80
|
||||
sta coords-2
|
||||
|
||||
ldx #(endzp-startzp) ; copy loop code to zero page
|
||||
- lda startzp-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
+COPY_TO_0 startzp, endzp
|
||||
|
||||
+WRITE_AUX
|
||||
jsr LoopBL
|
||||
+WRITE_MAIN
|
||||
|
||||
ldx #$00
|
||||
- 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 -
|
||||
+SHR_RESTORE_FROM_STAGE_2
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
|
@ -5,19 +5,15 @@
|
||||
!to "build/FX.INDEXED/SHR.UD",plain
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes
|
||||
shrhi = $38 ; $C8 bytes
|
||||
reverseshrlo = $BD01 ; $C8 bytes
|
||||
reverseshrhi = $BE01 ; $C8 bytes
|
||||
|
||||
ldx #(end-start-1) ; copy loop to zero page
|
||||
- lda start, x
|
||||
sta $00, x
|
||||
dex
|
||||
bpl -
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
;X=0
|
||||
|
@ -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_=*
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user