mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-23 12:33:32 +00:00
move some things to LC bank 2
This commit is contained in:
parent
1d7e3bd1b9
commit
859efc70f0
@ -101,8 +101,12 @@ gGamesListStore
|
||||
!word Reenter ; IRQ vector ($FFFE-F)
|
||||
}
|
||||
LastMover
|
||||
;the last routine in this list must define LAST_ADDR to keep track of LC bank 2 use
|
||||
!source "src/ui.font.data.a"
|
||||
!source "src/prodos.impl.a"
|
||||
!if LAST_ADDR > $DFFF {
|
||||
!error "code is too large: LAST_ADDR = ", LAST_ADDR
|
||||
}
|
||||
EvenLasterMover
|
||||
!if RELBASE = $2000 {
|
||||
!ifdef PASS2 {
|
||||
|
@ -183,15 +183,15 @@ OneTimeSetup
|
||||
jsr SaveOrRestoreScreenHoles ; save initial copy of screen hole content
|
||||
lda #$91
|
||||
sta holepatch ; enable restoring of copy from now on
|
||||
lda $43
|
||||
sta promote + ProDOS_unit - $bf00
|
||||
; save unit in LC bank 2 while overriding !pseudopc
|
||||
|
||||
lda hddopendir+1 ; save current directory as 'root'
|
||||
ldy hddopendir+3
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
+STAY gRootDirectory
|
||||
|
||||
lda $43
|
||||
sta promote + ProDOS_unit - $bf00
|
||||
; save unit while overriding !pseudopc
|
||||
|
||||
+LDADDR kGlobalPrefsFilename
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load preferences file into $8000
|
||||
|
@ -9,8 +9,8 @@
|
||||
; D000..E500 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||
; ...end of data and start of code are approximate, in between is unused...
|
||||
; ...if they ever overlap, things will go boom...
|
||||
; E800..FFFB - main program code
|
||||
; FFFC..FFFF - reset and other vectors
|
||||
; E800..FFF9 - main program code
|
||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||
;
|
||||
; LC RAM BANK 2
|
||||
; D000..D3FF - ProRWTS data
|
||||
|
@ -8,8 +8,7 @@
|
||||
; - LoadFileAt
|
||||
; - LoadDHRFile
|
||||
; - SaveSmallFile
|
||||
; - CloseHandles
|
||||
; - SaveScreenHoles
|
||||
; - SaveOrRestoreScreenHoles
|
||||
;
|
||||
; A general note about paths:
|
||||
;
|
||||
@ -186,190 +185,6 @@ SaveSmallFile
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; traverse [private]
|
||||
;
|
||||
; in: (namlo) points to length-prefixed pathname+filename
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
traverse
|
||||
+LDAY gRootDirectory
|
||||
sta (reloc + unrhddblocklo - unrelochdd) + 1
|
||||
sty (reloc + unrhddblockhi - unrelochdd) + 1
|
||||
sta @myreadblock+1
|
||||
sty @myreadblock+3 ; reset 'root' directory (saved at program start)
|
||||
|
||||
;search for '/' character in filename
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
lda (namlo), y
|
||||
tay
|
||||
- inx
|
||||
dey
|
||||
bmi @go ; no '/', just do the read
|
||||
lda (namlo), y
|
||||
cmp #'/'
|
||||
bne -
|
||||
sty sizelo
|
||||
txa
|
||||
pha
|
||||
|
||||
@myreadblock
|
||||
@myx80_parms
|
||||
ldx #2
|
||||
lda #0
|
||||
jsr hddreaddirsel
|
||||
lda #NAME_LENGTH
|
||||
sta bloklo
|
||||
lda #>(hdddirbuf - 1)
|
||||
sta blokhi
|
||||
|
||||
;there can be only one page crossed, so we can increment here
|
||||
|
||||
@mynextent1
|
||||
inc blokhi
|
||||
@mynextent
|
||||
ldy #0
|
||||
lda (bloklo), y
|
||||
pha
|
||||
and #$0f
|
||||
tax
|
||||
-- iny
|
||||
lda (bloklo), y
|
||||
cmp (namlo), y
|
||||
beq @myfoundname
|
||||
|
||||
;match failed, move to next directory in this block, if possible
|
||||
|
||||
- pla
|
||||
|
||||
@myskiphdr
|
||||
clc
|
||||
lda bloklo
|
||||
adc #ENTRY_SIZE
|
||||
sta bloklo
|
||||
bcs @mynextent1
|
||||
cmp #$ff ;4 + ($27 * $0d)
|
||||
bne @mynextent
|
||||
|
||||
;read next directory block when we reach the end of this block
|
||||
|
||||
lda hdddirbuf + NEXT_BLOCK_LO
|
||||
ldx hdddirbuf + NEXT_BLOCK_HI
|
||||
bcs +
|
||||
|
||||
@myfoundname
|
||||
dex
|
||||
bne --
|
||||
|
||||
;parse path until last directory is seen
|
||||
|
||||
iny
|
||||
lda (namlo), y
|
||||
cmp #'/'
|
||||
bne -
|
||||
pla
|
||||
and #$20 ;Volume Directory Header XOR subdirectory
|
||||
bne @myskiphdr
|
||||
tya
|
||||
eor #$ff
|
||||
adc sizelo
|
||||
sta sizelo
|
||||
clc
|
||||
tya
|
||||
adc namlo
|
||||
sta namlo
|
||||
|
||||
;cache block number of current directory
|
||||
;as starting position for subsequent searches
|
||||
|
||||
ldy #(KEY_POINTER + 1)
|
||||
lda (bloklo), y
|
||||
tax
|
||||
dey
|
||||
lda (bloklo), y
|
||||
sta (reloc + unrhddblocklo - unrelochdd) + 1
|
||||
stx (reloc + unrhddblockhi - unrelochdd) + 1
|
||||
+ sta @myx80_parms + 1
|
||||
stx @myx80_parms + 3
|
||||
++ lda sizelo
|
||||
bne @myreadblock
|
||||
tay
|
||||
|
||||
pla
|
||||
sta (namlo), y
|
||||
@go
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; promote [private]
|
||||
;
|
||||
; tiny ProDOS-style interface for ProRWTS
|
||||
; in: whatever ProDOS expects for the supported functions
|
||||
; out: carry clear, A=0
|
||||
; X, Y, and other flags clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
promote
|
||||
!pseudopc $bf00 {
|
||||
php
|
||||
sei
|
||||
lda $c012
|
||||
!byte $24
|
||||
!if * != $bf06 {
|
||||
!error "$BF06 misplaced (",*,")"
|
||||
}
|
||||
rts ;clock interface, must be RTS on real ProDOS if program uses $20x
|
||||
|
||||
asl
|
||||
lda $c011
|
||||
bit $c083
|
||||
jmp ProDOS_LC
|
||||
!text "4Q"
|
||||
!if * != $bf13 {
|
||||
!error "$BF13 misplaced (",*,")"
|
||||
}
|
||||
!byte $c1
|
||||
!word $c2d1, $c3d1, $c4d1, $c5d1, $c6d1, $c7d1
|
||||
ProDOS_LC
|
||||
bit $c083
|
||||
jmp ProDOS_enter
|
||||
ProDOS_exit
|
||||
sta $c082, x
|
||||
ProDOS_savedX
|
||||
ldx #$d1
|
||||
ProDOS_savedY
|
||||
ldy #$d1
|
||||
plp
|
||||
clc
|
||||
!byte $24
|
||||
ProDOS_unit
|
||||
!if * != $bf30 {
|
||||
!error "$BF30 misplaced (",*,")"
|
||||
}
|
||||
!byte $d1
|
||||
|
||||
lda #0
|
||||
rts
|
||||
|
||||
ProDOS_fatal ;only for debugging, will be removed
|
||||
bit $c081
|
||||
pha
|
||||
jsr $fe89
|
||||
jsr $fe93
|
||||
pla
|
||||
jsr $fdda
|
||||
jmp $ff65
|
||||
*=$bf58
|
||||
!fill $18
|
||||
|
||||
ProDOS_prefix=$bfd0
|
||||
; !fill $2e
|
||||
}
|
||||
end_promote
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; SaveOrRestoreScreenHoles
|
||||
; preserve screen hole contents across demo execution
|
||||
|
@ -362,4 +362,190 @@ ProDOS_enter
|
||||
|
||||
@saved_zp
|
||||
!fill (last_zp - first_zp) + 1
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; traverse [private]
|
||||
;
|
||||
; in: (namlo) points to length-prefixed pathname+filename
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
traverse
|
||||
+LDAY gRootDirectory
|
||||
sta (reloc + unrhddblocklo - unrelochdd) + 1
|
||||
sty (reloc + unrhddblockhi - unrelochdd) + 1
|
||||
sta @myreadblock+1
|
||||
sty @myreadblock+3 ; reset 'root' directory (saved at program start)
|
||||
|
||||
;search for '/' character in filename
|
||||
|
||||
ldx #0
|
||||
ldy #0
|
||||
lda (namlo), y
|
||||
tay
|
||||
- inx
|
||||
dey
|
||||
bmi @go ; no '/', just do the read
|
||||
lda (namlo), y
|
||||
cmp #'/'
|
||||
bne -
|
||||
sty sizelo
|
||||
txa
|
||||
pha
|
||||
|
||||
@myreadblock
|
||||
@myx80_parms
|
||||
ldx #2
|
||||
lda #0
|
||||
jsr hddreaddirsel
|
||||
lda #NAME_LENGTH
|
||||
sta bloklo
|
||||
lda #>(hdddirbuf - 1)
|
||||
sta blokhi
|
||||
|
||||
;there can be only one page crossed, so we can increment here
|
||||
|
||||
@mynextent1
|
||||
inc blokhi
|
||||
@mynextent
|
||||
ldy #0
|
||||
lda (bloklo), y
|
||||
pha
|
||||
and #$0f
|
||||
tax
|
||||
-- iny
|
||||
lda (bloklo), y
|
||||
cmp (namlo), y
|
||||
beq @myfoundname
|
||||
|
||||
;match failed, move to next directory in this block, if possible
|
||||
|
||||
- pla
|
||||
|
||||
@myskiphdr
|
||||
clc
|
||||
lda bloklo
|
||||
adc #ENTRY_SIZE
|
||||
sta bloklo
|
||||
bcs @mynextent1
|
||||
cmp #$ff ;4 + ($27 * $0d)
|
||||
bne @mynextent
|
||||
|
||||
;read next directory block when we reach the end of this block
|
||||
|
||||
lda hdddirbuf + NEXT_BLOCK_LO
|
||||
ldx hdddirbuf + NEXT_BLOCK_HI
|
||||
bcs +
|
||||
|
||||
@myfoundname
|
||||
dex
|
||||
bne --
|
||||
|
||||
;parse path until last directory is seen
|
||||
|
||||
iny
|
||||
lda (namlo), y
|
||||
cmp #'/'
|
||||
bne -
|
||||
pla
|
||||
and #$20 ;Volume Directory Header XOR subdirectory
|
||||
bne @myskiphdr
|
||||
tya
|
||||
eor #$ff
|
||||
adc sizelo
|
||||
sta sizelo
|
||||
clc
|
||||
tya
|
||||
adc namlo
|
||||
sta namlo
|
||||
|
||||
;cache block number of current directory
|
||||
;as starting position for subsequent searches
|
||||
|
||||
ldy #(KEY_POINTER + 1)
|
||||
lda (bloklo), y
|
||||
tax
|
||||
dey
|
||||
lda (bloklo), y
|
||||
sta (reloc + unrhddblocklo - unrelochdd) + 1
|
||||
stx (reloc + unrhddblockhi - unrelochdd) + 1
|
||||
+ sta @myx80_parms + 1
|
||||
stx @myx80_parms + 3
|
||||
++ lda sizelo
|
||||
bne @myreadblock
|
||||
tay
|
||||
|
||||
pla
|
||||
sta (namlo), y
|
||||
@go
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; promote [private]
|
||||
;
|
||||
; tiny ProDOS-style interface for ProRWTS
|
||||
; in: whatever ProDOS expects for the supported functions
|
||||
; out: carry clear, A=0
|
||||
; X, Y, and other flags clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
promote
|
||||
!pseudopc $bf00 {
|
||||
php
|
||||
sei
|
||||
lda $c012
|
||||
!byte $24
|
||||
!if * != $bf06 {
|
||||
!error "$BF06 misplaced (",*,")"
|
||||
}
|
||||
rts ;clock interface, must be RTS on real ProDOS if program uses $20x
|
||||
|
||||
asl
|
||||
lda $c011
|
||||
bit $c083
|
||||
jmp ProDOS_LC
|
||||
!text "4Q"
|
||||
!if * != $bf13 {
|
||||
!error "$BF13 misplaced (",*,")"
|
||||
}
|
||||
!byte $c1
|
||||
!word $c2d1, $c3d1, $c4d1, $c5d1, $c6d1, $c7d1
|
||||
ProDOS_LC
|
||||
bit $c083
|
||||
jmp ProDOS_enter
|
||||
ProDOS_exit
|
||||
sta $c082, x
|
||||
ProDOS_savedX
|
||||
ldx #$d1
|
||||
ProDOS_savedY
|
||||
ldy #$d1
|
||||
plp
|
||||
clc
|
||||
!byte $24
|
||||
ProDOS_unit
|
||||
!if * != $bf30 {
|
||||
!error "$BF30 misplaced (",*,")"
|
||||
}
|
||||
!byte $d1
|
||||
|
||||
lda #0
|
||||
rts
|
||||
|
||||
ProDOS_fatal ;only for debugging, will be removed
|
||||
bit $c081
|
||||
pha
|
||||
jsr $fe89
|
||||
jsr $fe93
|
||||
pla
|
||||
jsr $fdda
|
||||
jmp $ff65
|
||||
*=$bf58
|
||||
!fill $18
|
||||
|
||||
ProDOS_prefix=$bfd0
|
||||
; !fill $2e
|
||||
}
|
||||
end_promote
|
||||
|
||||
LAST_ADDR = *
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ if "%1" equ "asm" (
|
||||
2>nul md build\FX
|
||||
|
||||
2>build\out.txt %ACME% -r build\4cade.lst src\4cade.a
|
||||
for /f "tokens=2,3 delims=)" %%q in ('find "RELBASE =" build\out.txt') do set _make=%%q
|
||||
%ACME% -DRELBASE=$%_make:~-4% -r build\4cade.lst src\4cade.a
|
||||
for /f "tokens=*" %%q in (build\out.txt) do set _make=%%q
|
||||
%ACME% -DRELBASE=$!_make:~-5,4! -r build\4cade.lst src\4cade.a
|
||||
%ACME% src\fx\fx.cover.fade.a
|
||||
%ACME% src\fx\fx.dhgr.fizzle.a
|
||||
%ACME% src\fx\fx.dhgr.fizzle.white.a
|
||||
|
Loading…
Reference in New Issue
Block a user