-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.miasm
More file actions
22 lines (16 loc) · 771 Bytes
/
example.miasm
File metadata and controls
22 lines (16 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; mima assembly language example
.data ; anything written before .data is ignored
mem a1, a2, a3 ; a1, a2 and a3 are memory addresses in which the value 0 is stored
ask a1 ; mark a1 as an input field
out a3 ; mark a3 as an output field
.text ; end of data segment, start of text segment
LDV a1 ; instruction using a memory address (is replaced by the preprocessor)
NOT ; instruction without arguments
STV a2
LDC 0x1 ; instruction using a literal which will be appended to the opcode
ADD a2
STV a3
JMP end ; jump to section ":end"
LDC 0x0 ; (skipped)
STV a3 ; (skipped)
HALT :end ; the assembler will not check for unreachable code, you will have to do that yourself