added some more shortcut mnemonics

This commit is contained in:
Luxferre
2025-04-30 10:22:53 +03:00
parent acd18af182
commit 13ffe70bc3
2 changed files with 32 additions and 5 deletions
+18 -1
View File
@@ -163,6 +163,12 @@ specifications: here, it's `[selector] [value] [jumpaddr]` as opposed to
`[value] [jumpaddr] [selector]`. This has been done for more convenient
jump programming by selecting the condition as the first operand.
### Shortcut mnemonics
When writing MU8A assembly (see below), programmers are allowed to use
some shortcut mnemonics for easier code readability. Those exist for all jump
operations and several other opcodes.
The shortcut mnemonics for the jump operations are as follows:
* `jeq` is a shortcut to `jmp 0` (direct jump if equals to zero)
@@ -180,6 +186,17 @@ The shortcut mnemonics for the jump operations are as follows:
* `ine` is a shortcut to `jmp 12` (indirect jump if not equals to zero)
* `iuc` is a shortcut to `jmp 13 0` (indirect unconditional jump)
The shortcut mnemonics for other operations are as follows:
* `dia` is a shortcut to `cpy 0` (direct integer assignment)
* `dva` is a shortcut to `cpy 1` (direct value assignment)
* `iva` is a shortcut to `cpy 2` (indirect value assignment)
* `exp` is a shortcut to `nel 0` (natural exponent)
* `log` is a shortcut to `nel 1` (natural logarithm)
* `sin` is a shortcut to `tri 0` (sine)
* `cos` is a shortcut to `tri 1` (cosine)
* `atn` is a shortcut to `tri 2` (arctangent)
### Port input and output
For the commands 3 and 4, mu808 supports optional non-zero port numbers, where
@@ -243,7 +260,7 @@ the MU8A assembly file to convert it into a plain text based machine code
representation:
1. Remove all comments (starting with `;` until the end of the line).
2. Replace all jump shortcuts according to the above mnemonics.
2. Replace all jump/function shortcuts according to the above mnemonics.
3. Record the current line number N (not counting completely empty lines),
starting with 1.
4. Split the line into space-delimited fields (1-based numbering as well).