|
1 | 1 | AO Programming Language
|
2 |
| -= = = = = = = = = = = = = |
| 2 | +- - - - - - - - - - - - - - - - - - - - - - - |
3 | 3 |
|
4 | 4 | The AO (ASM Operands) language is a very low-level assembly language designed for TurnaCore machines.
|
5 | 5 | It matches 1-to-1 to the equivalent compiled binary machine code. Actually, the only thing it makes is to
|
@@ -76,7 +76,31 @@ Later, when you want to jump to the label, you can simply do the following:
|
76 | 76 | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
77 | 77 | JMP this_is_a_label
|
78 | 78 | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
| 79 | + |
| 80 | +Sometimes, you would like to use certain constants in your program. These numbers can be defined in a way similar |
| 81 | +to the C language's #define. The syntax for defining constants is as follows: |
79 | 82 |
|
| 83 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| 84 | + #pi=3 |
| 85 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| 86 | + |
| 87 | +The # denotes that this expression is a constant definition. 'pi' is the name of your constant and 3 is the value. Please note that |
| 88 | +spaces are NOT allowed. |
| 89 | + |
| 90 | +After defining a constant, you can use it anywhere in your code by simply typing its name. For example, if you want to |
| 91 | +see whether pi is larger than the value in Register 2 and jump to a label if so, you can write the following: |
| 92 | + |
| 93 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| 94 | + MR1 pi |
| 95 | + JG some_label_defined_somewhere_else |
| 96 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| 97 | + |
| 98 | +Since we defined the value of pi as 3, this is esentially the same thing as writing: |
| 99 | + |
| 100 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| 101 | + MR1 3 |
| 102 | + JG some_label_defined_somewhere_else |
| 103 | + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = |
80 | 104 |
|
81 | 105 | AO files are compiled into CIS (compiled instruction sequence) files. These are the files which the CPU reads.
|
82 | 106 |
|
|
0 commit comments