-
Notifications
You must be signed in to change notification settings - Fork 4
/
appa.html
126 lines (101 loc) · 4.26 KB
/
appa.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
<head>
<title>The Z-Machine Standards Document</title>
<link rel="stylesheet" type="text/css" href="zspec.css">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body class="appendix">
<img class="icon" src="images/iconaa.gif" alt="">
<h1>Appendix A. Error messages and debugging</h1>
<p>Older interpreters, such as <strong>ITF</strong>, are extremely curt when an error condition
is reached (for example, an illegal opcode). It was assumed that
Infocom's shipped story files were bug-free, which is mostly true,
so that errors could only arise through a bug elsewhere in the
interpreter.
</p>
<p>In debugging Inform games, though, many error conditions can arise and it is
extremely helpful to report these as fully as possible. These include:
</p>
<ol>
<li>An illegal opcode being hit;</li>
<li>A call to what can't be a routine (because the initial byte is not
between 0 and 15);
</li>
<li>A jump or call to an address beyond the size of the story file;</li>
<li>An attempt to <strong>print_obj</strong>, or otherwise access, an object
which doesn't exist, such as object number 0.
</li>
<li>An attempt to write to, or get the property length of, a
nonexistent property.
</li>
<li>An attempt to access an attribute outside the range 0 to 31
or 0 to 47 (depending on Version). (But note that Infocom's 'Sherlock'
contains a bug causing it to try setting or clearing attribute number
48.)
</li>
<li>Division by zero.
The player sometimes then has the annoying task of working out
where the error took place in source code. Providing a stack back-trace
would be a help.
</li>
</ol>
<p>As mentioned in <strong>§</strong> 3, it's helpful to screen out any illegal ZSCII
characters between 0 and 31 which are accidentally printed: crashes
can be very mysterious when they cause interpreters to send control
codes to the terminal.
</p>
<p>In addition, an interpreter might provide options for keeping track of
maximum stack usage and the typical number of opcodes executed between
each read from the keyboard. (But watching these is a time-wasting
activity, so they should be options.)
</p>
<p>Finally, infinite loops fairly often happen, as in any programming
language. On a system without pre-emptive multi-tasking, this may lock
up the whole machine, as the usual way that porters implement multi-tasking
is to return control to the host operating system only when the keyboard
is read. This can be avoided by providing a point in the code which
could return control to the OS from time to time (say, every 2000
instructions).
</p>
<hr>
<p>A number of post-Infocom games have been released which contain
errors, most often trying to perform illegal operations on object 0.
Many interpreters silently ignored these errors, which can make it
very difficult to notice and track down bugs.
</p>
<p>It is desirable for modern interpreters to be able to notify players
about these bugs, but this can also ruin gameplay. It is highly recommended,
then, that interpreters have four levels of error checking, selectable by
the user (through a command-line or menu option, or similar):
</p>
<ul>
<li>Never report the bug.</li>
<li>Report the first instance of each type of error.</li>
<li>Report every error.</li>
<li>Treat every error as fatal and end the game.</li>
</ul>
<hr>
<p>
<a href="index.html">Contents</a> /
<a href="preface.html">Preface</a> /
<a href="overview.html">Overview</a>
</p>
<p>Section
<a href="sect01.html">1</a> / <a href="sect02.html">2</a> /
<a href="sect03.html">3</a> / <a href="sect04.html">4</a> /
<a href="sect05.html">5</a> / <a href="sect06.html">6</a> /
<a href="sect07.html">7</a> / <a href="sect08.html">8</a> /
<a href="sect09.html">9</a> / <a href="sect10.html">10</a> /
<a href="sect11.html">11</a> / <a href="sect12.html">12</a> /
<a href="sect13.html">13</a> / <a href="sect14.html">14</a> /
<a href="sect15.html">15</a> / <a href="sect16.html">16</a>
</p>
<p>Appendix
<a href="appa.html">A</a> / <a href="appb.html">B</a> /
<a href="appc.html">C</a> / <a href="appd.html">D</a> /
<a href="appe.html">E</a> / <a href="appf.html">F</a>
</p>
<hr>
</body>
</html>