about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-rw-r--r--subx/001help.cc9
-rw-r--r--subx/010---vm.cc12
-rw-r--r--subx/011run.cc2
-rw-r--r--subx/030---operands.cc6
-rw-r--r--subx/opcodes12
5 files changed, 22 insertions, 19 deletions
diff --git a/subx/001help.cc b/subx/001help.cc
index 79589cf8..7236ca50 100644
--- a/subx/001help.cc
+++ b/subx/001help.cc
@@ -73,16 +73,15 @@ void init_help() {
     "    subx --help\n"
     "- Convert a textual SubX program into a standard ELF binary that you can\n"
     "  run on your computer:\n"
-    "    subx translate input1.subx intput2.subx ... -o <output ELF binary>\n"
+    "    subx translate input1.subx input2.subx ... -o <output ELF binary>\n"
     "- Run a SubX binary using SubX itself (for better error messages):\n"
     "    subx run <ELF binary>\n"
     "\n"
     "== Debugging aids\n"
-    "- Add '--trace' to any of these commands to print a trace to stderr\n"
-    "  for debugging purposes.\n"
+    "- Add '--trace' to any of these commands to save a trace.\n"
     "- Add '--debug' to add information to traces. 'subx --debug translate' will\n"
-    "  save various mappings to files that 'subx --debug --trace run'\n"
-    "  can use to make traces more informative.\n"
+    "  save metadata to disk that 'subx --debug --trace run' uses to make traces\n"
+    "  more informative.\n"
     "\n"
     "Options starting with '--' must always come before any other arguments.\n"
     "\n"
diff --git a/subx/010---vm.cc b/subx/010---vm.cc
index 52b6b597..3d60ab5c 100644
--- a/subx/010---vm.cc
+++ b/subx/010---vm.cc
@@ -57,15 +57,15 @@ put_new(Help, "registers",
   "to spend some time with it.\n"
   "\n"
   "-- flag registers\n"
-  "Various instructions (particularly 'compare') modify one or more of three 1-bit 'flag'\n"
-  "registers, as a side-effect:\n"
+  "Various instructions (particularly 'compare') modify one or more of four 1-bit\n"
+  "'flag' registers, as a side-effect:\n"
   "- the sign flag (SF): usually set if an arithmetic result is negative, or\n"
   "  reset if not.\n"
   "- the zero flag (ZF): usually set if a result is zero, or reset if not.\n"
   "- the carry flag (CF): usually set if an arithmetic result overflows by just one bit.\n"
   "  Useful for operating on unsigned numbers.\n"
-  "- the overflow flag (OF): usually set if an arithmetic result overflows by more than one bit.\n"
-  "  Useful for operating on signed numbers.\n"
+  "- the overflow flag (OF): usually set if an arithmetic result overflows by more\n"
+  "  than one bit. Useful for operating on signed numbers.\n"
   "The flag bits are read by conditional jumps.\n"
   "\n"
   "For complete details on how different instructions update the flags, consult the IA-32\n"
@@ -73,8 +73,8 @@ put_new(Help, "registers",
   "though of course you'll need to be careful to ignore instructions and flag registers\n"
   "that SubX doesn't support.\n"
   "\n"
-  "It isn't simple, but if this is the processor you have running on your computer,\n"
-  "might as well get good at it.\n"
+  "It isn't simple, but if this is the processor you have running on your computer.\n"
+  "Might as well get good at it.\n"
 );
 
 :(before "End Globals")
diff --git a/subx/011run.cc b/subx/011run.cc
index 1730c790..194676d8 100644
--- a/subx/011run.cc
+++ b/subx/011run.cc
@@ -28,8 +28,6 @@ put_new(Help, "syntax",
   "at runtime, but can be handy when rewriting macros.\n"
   "\n"
   "Check out the examples in the examples/ directory.\n"
-  "Programming in machine code can be annoying, but let's see if we can make\n"
-  "it nice enough to be able to write a compiler in it.\n"
 );
 :(before "End Help Contents")
 cerr << "  syntax\n";
diff --git a/subx/030---operands.cc b/subx/030---operands.cc
index 9f40e949..5203201e 100644
--- a/subx/030---operands.cc
+++ b/subx/030---operands.cc
@@ -84,8 +84,10 @@ void init_operand_type_help() {
     "  - sib.pdf: volume 2, table 2-3, \"32-bit addressing with the SIB byte.\".\n"
   );
   put(Help, "subop",
-    "Additional 3-bit operand for determining the instruction when the opcode is 81, 8f or ff.\n"
-    "Can't coexist with operand of type 'r32' in a single instruction, because the two use the same bits.\n"
+    "Additional 3-bit operand for determining the instruction when the opcode\n"
+    "is 81, 8f, d3, f7 or ff.\n"
+    "Can't coexist with operand of type 'r32' in a single instruction, because\n"
+    "the two use the same bits.\n"
   );
   put(Help, "r32",
     "3-bit operand specifying a register operand used directly, without any further addressing modes.\n"
diff --git a/subx/opcodes b/subx/opcodes
index d8e38a43..bebf3052 100644
--- a/subx/opcodes
+++ b/subx/opcodes
@@ -89,12 +89,16 @@ Opcodes currently supported by SubX:
   f4: halt (hlt)
   f7: negate/multiply/divide rm32 (with EAX and EDX if necessary) depending on subop (neg/mul/idiv)
   ff: increment/decrement/jump/push/call rm32 based on subop (inc/dec/jmp/push/call)
+  0f 82: jump disp32 bytes away if lesser (unsigned), if CF is set (jcc/jb/jnae)
+  0f 83: jump disp32 bytes away if greater or equal (unsigned), if CF is unset (jcc/jae/jnb)
   0f 84: jump disp32 bytes away if equal, if ZF is set (jcc/jz/je)
   0f 85: jump disp32 bytes away if not equal, if ZF is not set (jcc/jnz/jne)
-  0f 8c: jump disp32 bytes away if lesser, if SF != OF (jcc/jl/jnge)
-  0f 8d: jump disp32 bytes away if greater or equal, if SF == OF (jcc/jge/jnl)
-  0f 8e: jump disp32 bytes away if lesser or equal, if ZF is set or SF != OF (jcc/jle/jng)
-  0f 8f: jump disp32 bytes away if greater, if ZF is unset and SF == OF (jcc/jg/jnle)
+  0f 86: jump disp8 bytes away if lesser or equal (unsigned), if ZF is set or CF is set (jcc/jbe/jna)
+  0f 87: jump disp32 bytes away if greater (unsigned), if ZF is unset and CF is unset (jcc/ja/jnbe)
+  0f 8c: jump disp32 bytes away if lesser (signed), if SF != OF (jcc/jl/jnge)
+  0f 8d: jump disp32 bytes away if greater or equal (signed), if SF == OF (jcc/jge/jnl)
+  0f 8e: jump disp32 bytes away if lesser or equal (signed), if ZF is set or SF != OF (jcc/jle/jng)
+  0f 8f: jump disp32 bytes away if greater (signed), if ZF is unset and SF == OF (jcc/jg/jnle)
   0f af: multiply rm32 into r32 (imul)
 Run `subx help instructions` for details on words like 'r32' and 'disp8'.
 For complete details on these instructions, consult the IA-32 manual (volume 2).
2012-05-13 21:40:39 +0100 committer James Booth <boothj5@gmail.com> 2012-05-13 21:40:39 +0100 Added generic prof_autocomplete' href='/danisanti/profani-tty/commit/prof_autocomplete.c?id=89d3b9fcb32368f14c34254067eb5ee62879948f'>89d3b9fc ^
279737ba ^
527e739a ^
89d3b9fc ^

0346fda0 ^
89d3b9fc ^

89967905 ^
527e739a ^
89967905 ^
527e739a ^
0b221bde ^
89967905 ^

17757c86 ^


78ff58cf ^






17757c86 ^

279737ba ^
92763d2e ^
89d3b9fc ^
92763d2e ^

6bad38c2 ^
92763d2e ^


89d3b9fc ^
92763d2e ^



89d3b9fc ^

279737ba ^
527e739a ^
89d3b9fc ^
982f1174 ^
89d3b9fc ^
982f1174 ^
cac0ea07 ^
982f1174 ^
6bad38c2 ^
982f1174 ^



89d3b9fc ^
982f1174 ^

89d3b9fc ^
982f1174 ^
89d3b9fc ^

279737ba ^
527e739a ^
89d3b9fc ^




a85ba5e2 ^
89d3b9fc ^





279737ba ^
527e739a ^
89d3b9fc ^








6bad38c2 ^
89d3b9fc ^


b02b52d8 ^
89d3b9fc ^

6bad38c2 ^
89d3b9fc ^

b02b52d8 ^
89d3b9fc ^



b02b52d8 ^
89d3b9fc ^

6bad38c2 ^
89d3b9fc ^
527e739a ^
89d3b9fc ^



af95c82f ^

















c559d96d ^
af95c82f ^



























c559d96d ^
af95c82f ^









f9b8da1a ^






f9b8da1a ^


e99a0e11 ^
f9b8da1a ^

f9b8da1a ^




e99a0e11 ^
36265dde ^
f9b8da1a ^
e99a0e11 ^

36265dde ^
e99a0e11 ^
f9b8da1a ^





e99a0e11 ^
f9b8da1a ^










af95c82f ^
279737ba ^
527e739a ^
89d3b9fc ^

6bad38c2 ^
89d3b9fc ^
87c31078 ^
6bad38c2 ^
89d3b9fc ^


f5711001 ^














89d3b9fc ^






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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305