Merge lp:~iru-muzgo/retro-language/doc-swap-ltgt into lp:retro-language

Proposed by Iruatã Souza
Status: Merged
Merged at revision: 434
Proposed branch: lp:~iru-muzgo/retro-language/doc-swap-ltgt
Merge into: lp:retro-language
Diff against target: 93 lines (+34/-34)
1 file modified
doc/The_Ngaro_Virtual_Machine.rst (+34/-34)
To merge this branch: bzr merge lp:~iru-muzgo/retro-language/doc-swap-ltgt
Reviewer Review Type Date Requested Status
Charles Childers Pending
Review via email: mp+164949@code.launchpad.net

Description of the change

LT_JUMP and GT_JUMP are, respectively, opcode 10 and 11 in the documentation, but 11 and 10 in the code. I just updated the documentation to reflect the code.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/The_Ngaro_Virtual_Machine.rst'
2--- doc/The_Ngaro_Virtual_Machine.rst 2012-10-30 22:09:05 +0000
3+++ doc/The_Ngaro_Virtual_Machine.rst 2013-05-21 16:57:45 +0000
4@@ -450,9 +450,9 @@
5 +--------+-----------+-----------+---+-----------+
6 | 9 | RETURN | ;, | | ``-`` |
7 +--------+-----------+-----------+---+-----------+
8-| 10 | LT_JUMP | <jump, | x | ``xy-`` |
9+| 10 | GT_JUMP | >jump, | x | ``xy-`` |
10 +--------+-----------+-----------+---+-----------+
11-| 11 | GT_JUMP | >jump, | x | ``xy-`` |
12+| 11 | LT_JUMP | <jump, | x | ``xy-`` |
13 +--------+-----------+-----------+---+-----------+
14 | 12 | NE_JUMP | !jump, | x | ``xy-`` |
15 +--------+-----------+-----------+---+-----------+
16@@ -660,7 +660,38 @@
17 the address stack, and set the instruction pointer to it.
18
19
20-Opcode 10: LT_JUMP
21+Opcode 10: GT_JUMP
22+------------------
23+Increment the instruction pointer.
24+
25+Pop the top two values from the stack. If the first stack item is greater than
26+the second item, set the instruction pointer to the address stored at the
27+memory location following this instruction. If not, continue execution.
28+
29+This instruction needs to decrement the requested address by one to
30+account for the increment of the instruction pointer by the opcode process
31+cycle. E.g., if the jump target is 1234, the instruction pointer should be
32+set to 1233.
33+
34+In memory, this will be stored as:
35+
36+::
37+
38+ 0000 GT_JUMP
39+ 0001 destination
40+
41++--------+-------+
42+| before | after |
43++========+=======+
44+| +---+ | |
45+| | 1 | | |
46+| +---+ | |
47+| | 2 | | |
48+| +---+ | |
49++--------+-------+
50+
51+
52+Opcode 11: LT_JUMP
53 ------------------
54 Increment the instruction pointer.
55
56@@ -691,37 +722,6 @@
57 +--------+-------+
58
59
60-Opcode 11: GT_JUMP
61-------------------
62-Increment the instruction pointer.
63-
64-Pop the top two values from the stack. If the first stack item is greater than
65-the second item, set the instruction pointer to the address stored at the
66-memory location following this instruction. If not, continue execution.
67-
68-This instruction needs to decrement the requested address by one to
69-account for the increment of the instruction pointer by the opcode process
70-cycle. E.g., if the jump target is 1234, the instruction pointer should be
71-set to 1233.
72-
73-In memory, this will be stored as:
74-
75-::
76-
77- 0000 GT_JUMP
78- 0001 destination
79-
80-+--------+-------+
81-| before | after |
82-+========+=======+
83-| +---+ | |
84-| | 1 | | |
85-| +---+ | |
86-| | 2 | | |
87-| +---+ | |
88-+--------+-------+
89-
90-
91 Opcode 12: NE_JUMP
92 ------------------
93 Increment the instruction pointer.

Subscribers

People subscribed via source and target branches