4cade/src/glue.prorwts2.a

89 lines
2.9 KiB
Plaintext
Raw Normal View History

;license:MIT
2019-06-19 02:40:17 +00:00
;(c) 2018-9 by 4am & qkumba
;
; ProRWTS2 glue functions
;
; Public functions
; - LoadFile
; - LoadDHRFile
2019-10-08 17:19:20 +00:00
;
; Public variables
; - gRootDirectory
;
2018-11-10 15:08:14 +00:00
; A general note about paths:
;
2019-09-10 02:38:17 +00:00
; LoadFile, LoadDHRFile, and SaveSmallFile support subdirectories.
2018-11-12 15:06:15 +00:00
; Directories are delimited by '/' like ProDOS. At program startup, we get the
; current directory and save it; that is the PROGRAM ROOT DIRECTORY. All
; pathnames are relative to the PROGRAM ROOT DIRECTORY. There is no concept of
; setting or changing the 'current' directory.
2018-11-10 15:08:14 +00:00
;
; The PROGRAM ROOT DIRECTORY is not guaranteed to be the root directory of the
2018-11-12 15:06:15 +00:00
; underlying ProDOS disk (although it can be). But it doesn't matter, because
; these functions provide no access to any directory above the PROGRAM ROOT
; DIRECTORY. You can't use '..' to access the parent directory, and you can't
; start a pathname with '/' to access the root directory of the underlying
; ProDOS disk.
2018-11-10 15:08:14 +00:00
;
; Examples:
2018-11-12 15:06:15 +00:00
; 'PREFS.CONF' points to a file named 'PREFS.CONF' in the PROGRAM ROOT
2018-11-10 15:08:14 +00:00
; DIRECTORY.
;
2018-11-12 15:06:15 +00:00
; 'FX/RIPPLE' points to a file named 'RIPPLE' in a directory named 'FX' in the
2018-11-10 15:08:14 +00:00
; PROGRAM ROOT DIRECTORY.
;------------------------------------------------------------------------------
; LoadFile
2019-09-10 02:38:17 +00:00
; Load a file into memory all at once, using ProRWTS2
2018-11-12 15:06:15 +00:00
;
2018-11-10 15:08:14 +00:00
; supports paths, see note
;
2019-09-10 02:38:17 +00:00
; in: stack contains 6 bytes of parameters:
; +1 [word] address of length-prefixed pathname
; +3 [word] address of length-prefixed filename
; +5 [word] address to load file, or 0 to use file's default address
; out: all flags clobbered
; all registers clobbered
2019-06-19 02:40:17 +00:00
; gPathname clobbered
;------------------------------------------------------------------------------
LoadFile
2019-09-10 02:38:17 +00:00
+PARAMS_ON_STACK 6
2019-06-18 03:05:19 +00:00
+LDPARAM 1
2019-09-10 02:38:17 +00:00
jsr SetPath
+LDPARAM 3
jsr AddToPath
+LDPARAM 5
2019-06-18 03:05:19 +00:00
+STAY ldrlo ; set load address
jsr SwitchToBank2
2019-09-10 18:52:00 +00:00
jsr LoadFileInternal
jmp SwitchToBank1
2018-10-28 18:04:52 +00:00
;------------------------------------------------------------------------------
; LoadDHRFile
; load .A2FC file (uncompressed double hi-res graphics) into memory
; all at once, using ProRWTS2
2019-09-10 02:38:17 +00:00
; first $2000 bytes of file are loaded into auxiliary memory $4000..$5FFF
; second $2000 bytes of file are loaded into main memory $4000..$4FFF
2018-11-12 15:06:15 +00:00
;
2018-11-10 15:08:14 +00:00
; supports paths, see note
2018-10-28 18:04:52 +00:00
;
2019-09-10 02:45:18 +00:00
; in: stack contains 4 bytes of parameters:
2019-09-10 02:38:17 +00:00
; +1 [word] address of length-prefixed pathname
; +3 [word] address of length-prefixed filename
2018-10-28 18:04:52 +00:00
; out: all flags clobbered
; all registers clobbered
; stack set to next instruction after parameters
;------------------------------------------------------------------------------
LoadDHRFile
2019-09-10 02:38:17 +00:00
+PARAMS_ON_STACK 4
+LDPARAM 1
jsr SetPath
+LDPARAM 3
jsr AddToPath
jsr SwitchToBank2
2019-09-10 18:52:00 +00:00
jsr LoadDHRFileInternal
jmp SwitchToBank1
2018-10-28 18:04:52 +00:00
2019-10-08 17:19:20 +00:00
gRootDirectory
!word $FDFD