Debian Codegraph @

terps/glulxe/README.md

raw symbols SCIP
1 # Glulxe: the Glulx VM interpreter
2
3 - Version 0.6.1
4 - Designed by Andrew Plotkin <[email protected]>
5 - [Glulx home page][glulx]
6
7 [glulx]: http://eblong.com/zarf/glulx/index.html
8 [glk]: http://eblong.com/zarf/glk/index.html
9
10 ## Compiling
11
12 Since this is a Glk program, it must be built with a Glk library. See
13 the [Glk home page][glk].
14
15 The Unix Makefile that comes with this package is designed to link any
16 of the Unix libraries (CheapGlk, GlkTerm, RemGlk, etc.) You'll have to go
17 into the Makefile and set three variables to find the library. You'll also
18 want to set the appropriate OS_* constants on the OPTIONS line. There are
19 instructions at the top of the Makefile.
20
21 Then just type
22
23 make glulxe
24
25 That should suffice. When the program is built, type
26
27 ./glulxe filename.ulx
28
29 where "filename.ulx" is a Glulx game file to execute.
30
31 To build this program with a Mac or Windows interface, or any other
32 interface, you'll need the appropriate Glk library.
33
34 This program supports floating-point operations, which are implemented
35 using the standard C99 math functions. The Makefile uses "-lm" to link
36 these in. If your platform does not support these functions, you can
37 comment out the "#define FLOAT_SUPPORT" line in glulxe.h.
38
39 If you define the VM_DEBUGGER symbol (uncomment the "#define VM_DEBUGGER"
40 line in glulxe.h), you must include the libxml2 library. See the
41 XMLLIB definition in the Makefile.
42
43 ## Autosave
44
45 This interpreter supports autosave if the Glk library does. Currently
46 only two do: RemGlk and IosGlk. (The latter is no longer supported on
47 modern iOS, so RemGlk is your only real option.)
48
49 The --autosave option tells the interpreter to write out autosave
50 files at the end of each turn. The --autorestore tells it to load
51 those files at startup time, thus starting the game where it was last
52 autosaved. Note that --autosave will overwrite the autosave files if
53 present, but you should not use --autorestore unless the files exist.
54
55 There are two autosave files, by default kept in the current directory
56 and named "autosave.json" and "autosave.glksave". You can change the
57 directory with --autodir and the base filename with --autoname.
58
59 In some contexts it is useful for every game to have a unique autosave
60 location. You can do this by giving an --autoname value with a hash
61 mark, e.g.:
62
63 ./glulxe --autosave --autoname auto-# filename.ulx
64
65 The # character will be replaced with a (long) hex string that
66 uniquely identifies the game file. (Pretty uniquely, at least. It's
67 not a cryptographically strong hash.)
68
69 Autosave covers two slightly different scenarios:
70
71 ### Hedging against the possibility of process termination
72
73 This was how the iOS interpreters work (worked). The app would start
74 and run normally, but it *could* be killed at any time (when in the
75 background). Therefore, we autosave every turn. At startup time, if
76 autosave files exist, we restore them and continue play.
77
78 To operate in this mode in a Unix environment:
79
80 ./glulxe --autosave --autoskiparrange filename.ulx
81
82 The --autosave argument causes an autosave every turn. The
83 --autoskiparrange argument skips this on Arrange (window resize)
84 events. (We may get several Arrange events in a row, and they don't
85 represent progress that a player would care about losing.)
86
87 When relaunching, if autosave files exist, do:
88
89 ./glulxe --autosave --autoskiparrange --autorestore -autometrics filename.ulx
90
91 The --autorestore arguments loads the autosave. The -autometrics
92 argument (a RemGlk argument, hence the single dash) tells RemGlk to
93 skip the step of waiting for an Init event with metrics. (This is not
94 needed because the game will already be in progress. But you can send
95 a normal Arrange event if you think your window size might be
96 different from the autosave state.)
97
98 ### Single-turn operation
99
100 This mode allows you to play a game without keeping a long-term process
101 active. On every player input, the interpreter will launch, autorestore,
102 process the input, autosave, and exit.
103
104 To operate in this mode in a Unix environment:
105
106 ./glulxe --autosave -singleturn filename.ulx
107
108 The -singleturn argument (a RemGlk argument) tells the interpreter to
109 exit as soon as an output stanza is generated. When you pass in the
110 initial Init event, the interpreter will process the start-of-game
111 activity, display the initial window state, and exit.
112
113 When relaunching, if autosave files exist, do:
114
115 ./glulxe --autosave --autorestore -singleturn -autometrics filename.ulx
116
117 You should only do this when the UI has a player input ready to process.
118 Launch the game and pass in the input. The interpreter will process it,
119 display the update, and then (without delay) exit.
120
121 ## Version
122
123 0.6.1 (Oct 9, 2023)
124
125 - Added a --rngseed argument to fix the RNG setting from the command
126 line.
127 - Changed the built-in RNG to xoshiro**. Added configuration defs to
128 use a native OS RNG where possible.
129 - Fixed obscure corner case in pow(), powf() on some platforms.
130 - Configuration improvements for Windows.
131
132 0.6.0 (Jun 25, 2022):
133
134 - Added @hasundo and @discardundo opcodes. (Glulx spec 3.1.3.)
135 - Added the double-precision opcodes. (Glulx spec 3.1.3.)
136 - Added autosave support to the Unix startup code. (Previously the
137 autosave support only existed in the iOS startup code, which was
138 ObjC.) Autosave now works with the RemGlk library.
139 - Added an --undo argument to set the number of undo states.
140 - Fixed a bug where accelerated functions could write error messages
141 to Glk regardless of the current I/O system.
142 - Added array bounds checking on stack access.
143 - Added a guard against too-deep recursion when creating the string
144 cache.
145
146 0.5.4 (Jan 23, 2017):
147
148 - Added an internal debugger. Compile with "#define VM_DEBUGGER"
149 (and a debug-supporting Glk library) to use it.
150 - Expanded the TOLERATE_SUPERGLUS_BUG behavior to tolerate more
151 Superglus game files.
152
153 0.5.3 (Oct 25, 2016):
154
155 - Turn on SERIALIZE_CACHE_RAM in the default build. This speeds up
156 save and save-undo operations.
157 - Other tweaks to speed up launch, restart, restore, etc.
158 - Fixed a bug where accelerated functions were not being autosaved.
159 (Only relevant for iOS, currently.)
160 - When profiling, restore/restore-undo operations will now fail
161 (and the game will continue) instead of causing a fatal error.
162 - Added a build option to tolerate the Superglus bug where (very old)
163 game files would try to write to memory address zero. (Not on by
164 default.)
165 - Switched from my old ad-hoc license to the MIT license.
166
167 0.5.2 (Mar 27, 2014):
168
169 - Added acceleration functions 8 through 13, which work correctly when
170 NUM_ATTR_BYTES is changed.
171
172 0.5.1 (Mar 10, 2013):
173
174 - Fixed a bug in glkop.c that prevented get_buffer_stream() from
175 working right.
176 - Updated profile-analyze.py to understand the upcoming, updated I6
177 debug file format. (See http://inform7.com/mantis/view.php?id=1073)
178 The old format is still supported.
179
180 0.5.0 (Oct 18, 2012):
181
182 - Turned on memory-range checking in the default build. (Should have
183 done this years ago.)
184 - Fixed a bug where @setmemsize could crash an open char memory stream
185 or char line input request.
186 - Updated glkop.c to handle arrays of Glk objects. (This is needed to
187 support glk_schannel_play_multi().)
188 - Added hooks for the library to execute at startup and select time.
189 - Added a hook which allows the library to get and pass on a game ID
190 string.
191 - Clean up all memory allocation when the VM exits.
192
193 0.4.7 (Oct 10, 2011):
194
195 - Abstracted powf() to an osdepend wrapper. (Needed for Windows.)
196 - Fixed a @ceil bug, for some C math libraries.
197 - Improved the profiling system in several ways.
198 - Fixed a bug in glkop.c dispatching, to do with optional array
199 arguments.
200
201 0.4.6 (Aug 17, 2010):
202
203 - Added floating-point math feature.
204 - Updated winstart.c. (Thanks David Kinder.)
205 - Fixed @random even more, on Windows.
206 - @verify works right on game files with extended memory.
207 - @getiosys works right when the two store operands are different
208 variable types. (E.g., one local and one global.)
209
210 0.4.5 (Nov 23, 2009):
211
212 - VERIFY_MEMORY_ACCESS now detects writes to the ROM section of memory.
213 - Fixed off-by-eight bug in @astorebit and @aloadbit with negative bit
214 numbers.
215 - Fixed an obscure bug with division and modulo of $80000000. (Thanks
216 Evin Robertson.)
217 - Fixed an extremely obscure problem with changing I/O mode in the middle
218 of printing a number.
219 - Glk array/string operations are now checked for memory overflows
220 (though not for ROM writing). This generates a warning at present;
221 in the future, it will be a fatal error.
222 - Better fix for the @random bug.
223
224 0.4.4 (Mar 11, 2009):
225
226 - Added profiling code, which is turned off by default. To compile it
227 in, define VM_PROFILING in Makefile or in glulxe.h.
228 - Added function-accleration feature.
229 - Fixed bug where @random 0 was returning only positive numbers.
230
231 0.4.3 (Jan 23, 2008):
232
233 - Verify the presence of Unicode calls in the Glk library at runtime.
234 (Thanks Simon Baldwin.)
235 - Added a compile-time option to check for invalid memory accesses.
236 (This is slower, but safer. Define VERIFY_MEMORY_ACCESS in Makefile
237 or in glulxe.h. Thanks Evin Robertson.)
238 - Fixed a memory leak of undo states. (Thanks Matthew Wightman.)
239 - Fixed a linked-list handling error for Glk unicode arrays. (Thanks
240 David Kinder.)
241
242 0.4.2 (Feb 15, 2007):
243
244 - Fixed a bug that preventing compiling with old (pre-Unicode) Glk
245 libraries.
246
247 0.4.1 (Feb 11, 2007):
248
249 - Added array copy and heap allocation functionality. (Glulx spec
250 3.1.0.)
251
252 0.4.0 (Aug 13, 2006):
253
254 - Added Unicode functionality. (Glulx spec 3.0.0.)
255
256 0.3.5 (Aug 24, 2000):
257
258 - Fixed El-Stupido bug in the modulo opcode.
259
260 0.3.4 (Jul 11, 2000):
261
262 - Finally supports string arguments to Glk calls.
263
264 0.3.3 (Mar 29, 2000):
265
266 - Added setiosys, getiosys opcodes.
267 - Fixed bug in binarysearch.
268
269 0.3.2 (Feb 21, 2000):
270
271 - Added search, jumpabs, callf, and gestalt opcodes.
272
273 0.3.1 (Aug 23, 1999):
274
275 - Startup code now handles Blorb files correctly.
276
277 0.3.0 (Aug 17, 1999):
278
279 - Added support for compressed strings.
280
281 0.2.2 (Jun 15, 1999):
282
283 - Another pre-release version.
284
285 0.2.0 (May 30, 1999):
286
287 - A pre-release version.
288
289 ## Permissions
290
291 The source code in this package is copyright 1999-2023 by Andrew Plotkin.
292 It is distributed under the MIT license; see the "[LICENSE][]" file.
293
294 [LICENSE]: ./LICENSE