aboutsummaryrefslogtreecommitdiff
path: root/intcode/Readme.textile
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2019-12-11 21:53:12 +0000
committerNat Lasseter <user@4574.co.uk>2019-12-11 21:53:12 +0000
commit693130cae9bdb145af79ee2eb256b661003b6e45 (patch)
treefc4a450b012545c0f5599c667426d44451fbf71d /intcode/Readme.textile
parent3bea5ec1373b842e6ad9f7cff050615e1f5ebde8 (diff)
Wrote Intcode (dis-)assembler
Diffstat (limited to 'intcode/Readme.textile')
-rw-r--r--intcode/Readme.textile52
1 files changed, 52 insertions, 0 deletions
diff --git a/intcode/Readme.textile b/intcode/Readme.textile
new file mode 100644
index 0000000..844faf5
--- /dev/null
+++ b/intcode/Readme.textile
@@ -0,0 +1,52 @@
+h1. Intcode (dis-)assembler
+
+p. This is an assembler and disassembler pair for the intcode vm.
+
+h2. Assembler
+
+p. East instruction, directive, or label should appear on a line by itself.
+
+h3. Usage
+
+bc. $ ./as source.code
+
+h3. Instruction codes
+
+- add 1 2 3 := Add
+- mul 1 2 3 := Multiply
+- inp 1 := Input
+- out 1 := Output
+- jnz 1 2 := Jump if not zero
+- jez 1 2 := Jump if equal to zero
+- tlt 1 2 3 := Test if less than
+- teq 1 2 3 := Test if equal to
+- arb 1 := Adjust relative base
+- hlt := Halt
+
+p. Optionally, commas may be used to separate arguments.
+
+h3. Labels
+
+p. Specify a label with:
+
+bc. label:
+
+p. then use it in the assembly. Sigilising it is valid, immediate @label@, positional <code>@label</code>, or relative @&label@. The merits of doing so in some cases are... Hmm.
+
+h3. Directives
+
+- @org location := Organise the code to this location
+- @dat 1 2 3 4 ... := Insert this data literally into the bytecode
+
+h3. Sigils
+
+- <code>@</code> := Positional argument
+- @&@ := Relative argument
+
+h2. Disassembler
+
+p. Prints the location of the start of each instruction and the instruction itself using the syntax detailed above.
+
+h3. Usage
+
+bc. $ ./das byte.code