💾 Archived View for vierkantor.com › xukut › manual › assembler.gmi captured on 2024-07-08 at 23:31:56. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
This is an explanation of low-level design in XukutOS. We hope that the design works well enough that you can stick to higher-level stuff for day to day activities.
The default XukutOS distribution includes an assembler (for the aarch64 architecture), in case you need to write some finicky code.
Generate an `aarch64:code' object containing the parsed instructions. `instrs' should be a list, whose elements are either a symbol (functioning as labels) or a list starting with a symbol (functioning as an operation). The operations are parsed based on the instruction set architecture's specifications.
For example,
(aarch64:assembly label0 (add 'n0 'n0 1) (b label1) (add 'n1 'n1 1) label1 (ret))
will produce Assembly code for incrementing the `n0' register but not the `n1' register.
Note the difference between `(add 'n0 'n0 'xzr)' which adds the contents of the `xzr' register to the `n0' register and (hypothetically) `(add n0 n0 xzr)', which adds the number `xzr' to the `n0'th register. The latter doesn't really make sense unless
Labels are local to assembly blocks. There will probably be some way to read label offsets from code objects though.
Registers are named according to the XukutOS calling convention.
The calling conventions used by XukutOS
Literals denote absolute values, so that `(b label1)' and `(add n0 xzr label1)' both set `pc' and `n0' to the value of `label1'.
(We'll just abstract over the fact that the assembled version of the `b' instruction actually contains an offset instead of an absolute location!)
You can use arithmetic expressions to produce offsets instead.
Any questions? Contact me:
By email at vierkantor@vierkantor.com