4 ; Loading and importing of files
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
38 [ :LNOT::DEF:load__dfn
43 ; On entry: R0 == pointer to entry point block
44 ; R1 == value of R10 to pass to entry points
45 ; R2 == value of R12 to pass to entry points
49 ; Use: Attempts to load a file after receipt of a Message_DataSave,
50 ; Message_DataLoad or Message_DataOpen. If user entries for
51 ; RAM transfer are provided, this is attempted, although the
52 ; entries must also be aware that file transfer may be
57 ; --- load_initBuf ---
59 ; On entry: R1 == estimated file size
60 ; R2 == pointer to flex anchor (unallocated)
62 ; On exit: R0 == pointer to buffer start
66 ; Use: Initialises a flex block for use as a RAM transfer buffer.
67 ; This routine is suitable for use as the initBuf routine for
68 ; RAM transfer loading.
72 ; --- load_killBuf ---
74 ; On entry: R2 == pointer to flex anchor
78 ; Use: Frees a flex block. This routine should be used to free
79 ; the buffer used for RAM transfer.
83 ; --- load_extendBuf ---
85 ; On entry: R0 == pointer to previous buffer
86 ; R1 == size of previous buffer
87 ; R2 == pointer to flex anchor
89 ; On exit: R0 == pointer to a new buffer
90 ; R1 == size of the new buffer
93 ; Use: Extends the flex block if it was initially too small.
94 ; This routine is designed to be used as the extend routine
95 ; during RAM transfer.
99 ; --- load_doneBuf ---
101 ; On entry: R1 == actual size of data
102 ; R2 == pointer to flex anchor
106 ; Use: Sets the block into which the data has been loaded to the
107 ; correct exact size.
113 ; On entry: R1 == pointer to filename to load
114 ; R2 == pointer to flex anchor
116 ; On exit: R0 == size of file loaded
117 ; May return an error
119 ; Use: Loads a named file into a flex block for your delectation.
123 ;----- User entry points ----------------------------------------------------
127 lEntry__initBuf # 4 ;Create a load buffer
129 ; R0 == ptr to `filename'
130 ; R1 == estimated file size
133 ; R0 == ptr to buffer start
134 ; R1 == ptr to buffer end
135 ; R2 == buffer `handle'
138 lEntry__killBuf # 4 ;Destroy the load buffer
140 ; R0 == ptr to buffer start
141 ; R1 == ptr to buffer end
142 ; R2 == buffer `handle'
146 lEntry__extend # 4 ;Extend the load buffer
148 ; R0 == ptr to buffer start
149 ; R1 == ptr to buffer end
150 ; R2 == buffer `handle'
154 lEntry__doneBuf # 4 ;All data is now loaded
156 ; R0 == ptr to `filename'
157 ; R1 == total size of data
158 ; R2 == buffer `handle'
162 lEntry__file # 4 ;Load data from a file
164 ; R0 == ptr to `filename'
166 ; R2 == 0 if file unsafe
170 lEntry__done # 4 ;Completed loading
172 ; R0 == ptr to `filename'
173 ; R1 == safeness indicator
177 lEntry__failed # 4 ;Failed to load file
179 ; R0 == pointer to error
186 ;----- That's all, folks ----------------------------------------------------