Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sh / xfer / xsave
1 ;
2 ; xfer.xsave.sh
3 ;
4 ; Simplified saving with coroutines
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
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)
16 ; any later version.
17 ;
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.
22 ;
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.
26
27 ;----- Overview -------------------------------------------------------------
28 ;
29 ; Functions provided:
30 ;
31 ; xsave_save
32 ; xsave_send
33 ; xsave_done
34 ; xsave_failed
35 ; xsave_byte
36 ; xsave_word
37 ; xsave_string
38 ; xsave_block
39
40 [ :LNOT::DEF:xsave__dfn
41 GBLL xsave__dfn
42
43 ; --- xsave_save ---
44 ;
45 ; On entry: R0 == pointer to saver routine
46 ; R1 == R10 value to pass to saver
47 ; R2 == R12 value to pass to saver
48 ; R3 == pointer to filename to save to
49 ; R4 == filetype of file to save
50 ;
51 ; On exit: May return an error
52 ;
53 ; Use: Calls a generalised saver routine to write data to a file.
54
55 IMPORT xsave_save
56
57 ; --- xsave_send ---
58 ;
59 ; On entry: R0 == pointer to saver routine
60 ; R1 == R10 value to pass to saver
61 ; R2 == R12 value to pass to saver
62 ;
63 ; On exit: R0 == pointer to block to send
64 ; R1 == size of block
65 ; CS if this is the last block, else CC
66 ; May return an error
67 ;
68 ; Use: Calls a generalised saver routine to write data to another
69 ; application, using RAM transfer. Note that you must call
70 ; this routine from your send entry point throughout the
71 ; save operation.
72
73 IMPORT xsave_send
74
75 ; --- xsave_done ---
76 ;
77 ; On entry: --
78 ;
79 ; On exit: --
80 ;
81 ; Use: Tidies up after a successful save job.
82
83 IMPORT xsave_done
84
85 ; --- xsave_failed ---
86 ;
87 ; On entry: R0 == pointer to error block
88 ;
89 ; On exit: --
90 ;
91 ; Use: Tidies up a RAM transfer after an error.
92
93 IMPORT xsave_failed
94
95 ; --- xsave_byte ---
96 ;
97 ; On entry: R0 == byte to write in lowest 8 bits
98 ;
99 ; On exit: May return an error
100 ;
101 ; Use: Writes a single byte to the current output.
102
103 IMPORT xsave_byte
104
105 ; --- xsave_word ---
106 ;
107 ; On entry: R0 == word to write
108 ;
109 ; On exit: May return an error
110 ;
111 ; Use: Writes a single word to the current output.
112
113 IMPORT xsave_word
114
115 ; --- xsave_string ---
116 ;
117 ; On entry: R0 == pointer to a control-terminated string
118 ;
119 ; On exit: May return an error
120 ;
121 ; Use: Writes a control-terminated string to the current output.
122 ; The string is null terminated in the output file.
123
124 IMPORT xsave_string
125
126 ; --- xsave_block ---
127 ;
128 ; On entry: R0 == pointer to buffer to write
129 ; R1 == size of buffer to write
130 ;
131 ; On exit: May return an error
132 ;
133 ; Use: Writes out a block of data. Data is buffered, so this is
134 ; fairly quick for reading small objects. Large data blocks
135 ; are sent directly to avoid buffering overhead.
136
137 IMPORT xsave_block
138
139 ]
140
141 ;----- That's all, folks ----------------------------------------------------
142
143 END