summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2021-11-10 21:20:49 -0500
committerpommicket <pommicket@gmail.com>2021-11-10 21:20:49 -0500
commit15a4be17e331475d3237a55d0cde5f0da3f91a9f (patch)
tree49a1a0bb1c74d16fa2aa7b1f23b0df32db0a05eb
parent8f527338ae76282a5ec56833984775e6889023e1 (diff)
add compares to conditional jump instructions
-rw-r--r--02/README.md7
-rw-r--r--02/in0112
2 files changed, 11 insertions, 8 deletions
diff --git a/02/README.md b/02/README.md
index a114413..1a77e50 100644
--- a/02/README.md
+++ b/02/README.md
@@ -74,6 +74,9 @@ plus six new ones:
- `//` is for comments
- `\n\n` does nothing (used for spacing)
+Also, the conditional jump instructions now have a `cmp rax, rbx`
+built into them.
+
## labels
Labels are the most important new feature of this language.
@@ -174,7 +177,7 @@ the number of blank lines must be a multiple of 3!
Many of the limitations of our previous compilers apply to this one. Also,
if you use a label without defining it, it uses address 0, rather than outputting
an error message. This could be fixed: if the value in the label table is 0 and we are
-on the second pass, output an error message. This compiler was already tedious enough
-to implement, though!
+on the second pass, output an error message. Also, duplicate labels aren't detected.
+
But thanks to labels, for future compilers at least we won't have to calculate
any jump offsets manually.
diff --git a/02/in01 b/02/in01
index f72459c..723c5e3 100644
--- a/02/in01
+++ b/02/in01
@@ -14152,20 +14152,20 @@ the formatting changed appropriately.
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
-;02;0f;87;00;00;00;00;00
-;02;0f;82;00;00;00;00;00
+;05;48;39;d8;0f;87;00;00 ja
+;05;48;39;d8;0f;82;00;00 jb
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
-;02;0f;84;00;00;00;00;00
+;05;48;39;d8;0f;84;00;00 je
;00;00;00;00;00;00;00;00
-;02;0f;8f;00;00;00;00;00
+;05;48;39;d8;0f;8f;00;00 jg
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
-;02;0f;8c;00;00;00;00;00
+;05;48;39;d8;0f;8c;00;00 jl
;01;e9;00;00;00;00;00;00
-;02;0f;85;00;00;00;00;00
+;05;48;39;d8;0f;85;00;00 jn
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00
;00;00;00;00;00;00;00;00