Browse Source

Add info about the MODIFY_RELATIVE_BASE opcode

ApisNecros 1 year ago
parent
commit
4f55cde876
1 changed files with 16 additions and 1 deletions
  1. 16 1
      README.md

+ 16 - 1
README.md

@@ -18,6 +18,10 @@ In Position Mode, the computer's default setting, parameters passed to functions
 
 In Immediate Mode, the parameter is taken "as is", and operated on accordingly. For example, `42` in Immediate Mode is treated as `42`.
 
+### Relative Mode
+
+Relative mode acts similarly to Position Mode, where the final value is retrieved from another location in memory. It's different, though, in that a "Relative Base Offset" is added to that memory address to get the true address. The Relative Base Offset value is tracked by the computer's memory stack.
+
 ## Opcode Dictionary
 
 * [01 - ADD](#01---add)
@@ -28,6 +32,7 @@ In Immediate Mode, the parameter is taken "as is", and operated on accordingly.
 * [06 - JUMP IF FALSE](#06---jump-if-false)
 * [07 - LESS THAN](#07---less-than)
 * [08 - EQUALS](#08---equals)
+* [09 - MODIFY RELATIVE BASE](#09---modify-relative-base)
 * [99 - HALT](#99---halt)
 
 ### 01 - ADD
@@ -76,12 +81,14 @@ Takes input from either the runtime input array, or from the console, depending
 
 If the input is set to come from the runtime input array, and the array is empty, the computer will _pause_ execution until either the `Run` function for the `Input` functions are called on the computer.
 
-The output position is always used in Immediate Mode.
+The output position may be in either Immediate Mode or Relative Mode.
 
 | Forms | Description |
 | ----- | ----------- |
 |     3 | Receive input |
 |    03 | Receive input |
+|   103 | Receive input in Immediate Mode |
+|   203 | Receive input in Relative Mode |
 
 |       Parameters | Description |
 | ---------------- | ----------- |
@@ -111,6 +118,14 @@ If the computer has an `outputComputer` set, then the output is instead sent to
 
 ### 08 - EQUALS
 
+### 09 - MODIFY RELATIVE BASE
+
+Takes one parameter as input, and adds that number to the stack's Relative Base Offset. This value may be either a positive or negative integer.
+
+|       Parameters | Description |
+| ---------------- | ----------- |
+|  Operand 1 | The number, or memory address of the number, to add to the Relative Base Offset |
+
 ### 99 - HALT
 
 A simple instruction with no parameters. Stops the computer from running any more instructions.