From 093c04cab71fb928aedf9ea2438d32b326fcb15c Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Sat, 23 Oct 2021 20:53:24 -0700 Subject: [PATCH] add LoadAuxIndexedFile --- src/glue.prorwts2.a | 28 ++++++++++++++++++++++++++++ src/prodos.impl.lc2.a | 1 + 2 files changed, 29 insertions(+) diff --git a/src/glue.prorwts2.a b/src/glue.prorwts2.a index 37458c467..670c21fc8 100644 --- a/src/glue.prorwts2.a +++ b/src/glue.prorwts2.a @@ -128,6 +128,28 @@ LoadDHRFile jmp SwitchToBank1 ;------------------------------------------------------------------------------ +; LoadAuxIndexedFile +; Load a file from inside an indexed file, all at once into auxiliary memory +; +; To save disk space, some collections of small, related files (e.g. per-game +; help files) are merged into a single data file with an associated index file. +; The index stores the original filename along with an offset (into the merged +; data file) and a length. +; +; Callers are responsible for loading the index file and finding the relevant +; record within the index. Most callers use okvs_find() for this. +; +; in: stack contains 6 bytes of parameters: +; +1 [word] pointer to filename of merged data file +; +3 [word] address of load destination +; +5 [word] pointer to index record (see note) +; out: all flags clobbered +; all registers clobbered +;------------------------------------------------------------------------------ +LoadAuxIndexedFile + lda #$E8 ; INX + +HIDE_NEXT_2_BYTES +;------------------------------------------------------------------------------ ; LoadIndexedFile ; Load a file from inside an indexed file, all at once ; @@ -147,6 +169,8 @@ LoadDHRFile ; all registers clobbered ;------------------------------------------------------------------------------ LoadIndexedFile + lda #$EA ; NOP + sta @iauxreq +PARAMS_ON_STACK 6 jsr @set_nameaddr +LDPARAMPTR 5, zpword @@ -172,6 +196,10 @@ LoadIndexedFile jsr $bf00 !byte $ce !word @ce_parms +@iauxreq + nop ; SMC + stx SavedZP + auxreq - first_zp + jsr $bf00 !byte $ca !word @ca_parms diff --git a/src/prodos.impl.lc2.a b/src/prodos.impl.lc2.a index fc7a1dbba..f5e602ebb 100644 --- a/src/prodos.impl.lc2.a +++ b/src/prodos.impl.lc2.a @@ -21,6 +21,7 @@ buffer = first_zp+2 ;word ProDOS_enter !set CloseHandles = @imp_close !set swap_zpg = @swap_zp +!set SavedZP = @saved_zp stx ProDOS_savedX+1 sty ProDOS_savedY+1 jsr @swap_zp