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
|
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
|
-
+
+
+
+
-
+
|
(Note: This may change as the program is being written and it is currently a draft.)
In some places in a <tt>.class</tt> file, program instructions can be used. This includes in any global message block, class message block, <tt>SUBS</tt> block, <tt>Goal</tt> block, or global function definition.
The heading includes the instruction name (if in parentheses, it takes other stuff inside of the same block with parentheses; there may be brackets afterward if some other name or number is a part of it), followed by the stack effect (given in a notation like Forth).
Some headings include <b>,</b> and/or <b>=</b> after the stack diagram if it supports those prefixes optionally. In this case, <b>,</b> means a variable of another object (taken on the stack below the value, if writing), while <b>=</b> means to write instead of read (the value to write is taken below another argument if any, but above the object if any). If the heading says <b>,c</b> then you can also read the value from a class (it is read-only in this case; the syntax does not change).
You can also use numbers as instructions (that push their value to the stack), either in decimal or in hexadecimal (with <tt>0x</tt> at first), and an optional minus sign is allowed at first for negative decimal numbers.
You can also use numbers as instructions (that push their value to the stack), either in decimal or in hexadecimal (with <tt>0x</tt> at first), and an optional minus sign is allowed at first for negative decimal numbers. Built-in message names can also be used as instructions, pushing it to the stack..
<h2 id=zdrop>. ( x -- )</h2>
Simply discards one value from data stack.
<h2 id=xd0>$[] ( -- class )</h2>
Push a class name to the stack. The class must be defined, although it does not necessarily have to be defined above where it is mentioned.
<h2 id=xh0>#[] ( -- message )</h2>
Push a message name to the stack. The message does not have to be declared anywhere. If there are no message handlers, sending this message to any object will just result in zero.
<h2 id=xp0>%[] ( -- value ) =</h2>
Read a user variable of this object. All user variables are initialized to zero and can store any value. You do not need to declare them first.
<h2 id=string>"[]" ( -- string )</h2>
<h2 id=zstring>"[]" ( -- string )</h2>
Push a string to the stack. The string can include escape codes:
* <tt>\\</tt> - Represents a literal backslash.
* <tt>\"</tt> - Represents a literal quotation mark.
* <tt>\0</tt> - Set text colour to black.
* <tt>\1</tt> - Set text colour to blue.
* <tt>\2</tt> - Set text colour to green.
* <tt>\3</tt> - Set text colour to cyan.
|
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
|
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
A constant with exactly one bit set; replace [] with a number 0 to 31.
<h2 id=xxbnot>bnot ( in -- out )</h2>
<h2 id=yxbit>(bit) ( -- n )</h2>
Includes a list of numbers in range 0 to 31, and the result is the number with those bits set.
<h2 id=xxBroadcast>Broadcast ( class msg arg1 arg2 -- count )</h2>
<h2 id=yxBroadcast>(Broadcast) ( msg arg1 arg2 -- count )</h2>
<h2 id=xxClass>Class ( -- class ) ,</h2>
<h2 id=xxDestroy>Destroy ( -- )</h2>
<h2 id=xcDestroy>,Destroy ( obj -- )</h2>
<h2 id=xxDestroyed>Destroyed ( -- b ) ,</h2>
<h2 id=xxE>E ( -- dir )</h2>
Absolute direction constant East (0).
<h2 id=xxF>F ( -- dir )</h2>
Relative direction constant Forward (8).
<h2 id=xxFrom>From ( -- obj ) ,=</h2>
<h2 id=xxif>if ( cond -- )</h2>
Begins a conditional block. End it with <tt>then</tt>. You can also use <tt>else</tt> or <tt>el</tt>.
<h2 id=xxIsPlayer>IsPlayer ( -- b ) ,c</h2>
<h2 id=xxLF>LF ( -- dir )</h2>
Relative direction constant Left-forward (9).
<h2 id=xxlnot>lnot ( in -- out )</h2>
<h2 id=xxLoseLevel>LoseLevel ( -- )</h2>
<h2 id=xxMisc1>Misc1 ( -- v ) ,=</h2>
<h2 id=xxMisc2>Misc1 ( -- v ) ,=</h2>
<h2 id=xxMisc2>Misc2 ( -- v ) ,=</h2>
<h2 id=xxMisc3>Misc1 ( -- v ) ,=</h2>
<h2 id=xxMisc3>Misc3 ( -- v ) ,=</h2>
<h2 id=xxMisc4>Misc1 ( -- v ) ,c=</h2>
<h2 id=xxMisc4>Misc4 ( -- v ) ,c=</h2>
<h2 id=xxMisc5>Misc1 ( -- v ) ,c=</h2>
<h2 id=xxMisc5>Misc5 ( -- v ) ,c=</h2>
<h2 id=xxMisc6>Misc1 ( -- v ) ,c=</h2>
<h2 id=xxMisc6>Misc6 ( -- v ) ,c=</h2>
<h2 id=xxMisc7>Misc1 ( -- v ) ,c=</h2>
<h2 id=xxMisc7>Misc7 ( -- v ) ,c=</h2>
<h2 id=xxMsg>Msg ( -- msg ) ,</h2>
<h2 id=xxN>N ( -- dir )</h2>
Absolute direction constant North (2).
<h2 id=xxNE>NE ( -- dir )</h2>
Absolute direction constant Northeast (1).
<h2 id=xxneg>neg ( in -- out )</h2>
<h2 id=xxSend>Send ( msg arg1 arg2 -- ret )</h2>
<h2 id=xcSend>,Send ( obj msg arg1 arg2 -- ret )</h2>
<h2 id=xxShape>Shape ( -- n ) ,c=</h2>
<h2 id=xxShapeDir>ShapeDir ( dir -- n ) ,c=</h2>
<h2 id=xxTemperature>Temperature ( -- v ) ,c=</h2>
<h2 id=xxthen>then ( -- )</h2>
End of a conditional block.
<h2 id=xxWinLevel>WinLevel ( -- )</h2>
<h2 id=xcWinLevel>,WinLevel ( score -- )</h2>
|