summaryrefslogtreecommitdiff
path: root/programs/sub-suite/subasm-syntax
blob: 133791420e10d3e15f0845e838029df6c52d435f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Assembly language syntax for SuBAsm. */

/* Comments begin with "/*", and end with "*/".
 * Directives begin with a `\`.
 */

/* mnemonic is the instruction name/mnemonic.
 * expr is an expression.
 * Indirect Indexed means applying the index after the indirection.
 * Indexed Indirect means applying the index before the indirection.
 */

Expression syntax:
	/* TODO */
Instruction syntax:
	Base ISA, and Base Extension:
		Implied:
			<mnemonic>
		B register:
			<mnemonic> b
		Absolute/Zero Matrix:
			/* [, <x|y>] means Indexed with x, or y. */
			<mnemonic> <expr>[, <x|y>]
		Immediate Data:
			<mnemonic> #<expr>
		Absolute/Zero Matrix Indirect:
			/* Indexing with x means Indexed Indirect.
			 * Indexing with y means Indirect Indexed.
			 */
			<mnemonic> (<expr>[, x])[, y]
		E Indirect:
			<mnemonic> (e)
	Orthogonal Extension:
		<mnemonic> <operand>[, operand]
		Operand syntax:
			<\(
				/* The operand starts with a register.
				 * If the statment is inside brackets, then
				 * it's a register indirect mode.
				 */
				[(]reg[+<reg>][\(+|-\)<expr>][)]
				/* The operand starts with an expression.
				 * If the statment is inside brackets, then
				 * it's an indirect mode.
				 */
				|[(]expr
				/* Is the operand using Indirect, or Indirect Indexed? */
				\if (ind || ind_indexed) {
					[)]
				\}
				[\(+|-\)<reg[+<reg>]>]
				/* Is the operand using Indexed Indirect? */
				\if (indexed_ind) {
					[)]
				\}
			\)>