4 ; Simplified loading with coroutines
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 -------------------------------------------------------------
42 [ :LNOT::DEF:xload__dfn
47 ; On entry: R0 == pointer to loader routine
48 ; R1 == R10 value to pass to loader
49 ; R2 == R12 value to pass to loader
50 ; R3 == pointer to leafname of file (passed to loader in R0)
51 ; R4 == pointer to filename to load from
52 ; R5 == whether the file is safe (passed to loader in R1)
54 ; On exit: May return an error
56 ; Use: Calls a generalised loader routine to read data from a file.
60 ; --- xload_initBuf ---
62 ; On entry: R0 == pointer to loader routine
63 ; R1 == R10 value to pass to loader
64 ; R2 == R12 value to pass to loader
65 ; R3 == pointer to leafname of file (passed to loader in R0)
67 ; On exit: R0 == pointer to load buffer
68 ; R1 == size of load buffer
71 ; Use: Starts a RAM transfer and starts up a generalised load
76 ; --- xload_killBuf ---
82 ; Use: Does a buffer destroy for a failed load operation.
86 ; --- xload_extend ---
88 ; On entry: R1 == size of last buffer used for receiving
90 ; On exit: R0 == pointer to new buffer
91 ; R1 == size of new buffer
94 ; Use: Performs a buffer extent operation during an xload RAM
99 ; --- xload_doneBuf ---
101 ; On entry: R1 == total size of data received
103 ; On exit: R0 corrupted
104 ; May return an error
106 ; Use: Handles the last bufferful of a RAM load.
116 ; Use: Tidies up after a successful load job.
120 ; --- xload_failed ---
122 ; On entry: R0 == pointer to error block
126 ; Use: Tidies up a RAM transfer after an error.
134 ; On exit: CC if data read OK, and
136 ; else CC if end-of-file, and
138 ; May return an error
140 ; Use: Reads a byte from the current input.
148 ; On exit: CC if data read OK, and
150 ; else CS if end-of-file and
152 ; May return an error
154 ; Use: Reads a word from the current input.
158 ; --- xload_block ---
160 ; On entry: R0 == pointer to buffer to read
161 ; R1 == size of buffer to read
163 ; On exit: R0, R1 preserved
164 ; R2 == number of bytes read
165 ; CC if more data available, CS for end-of-file
166 ; May return an error
168 ; Use: Reads in a block of data. Data is buffered, so this is
169 ; fairly quick for reading small objects. Large data blocks
170 ; are read directly to avoid buffering overhead.
176 ;----- That's all, folks ----------------------------------------------------