-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.txt
More file actions
62 lines (43 loc) · 981 Bytes
/
README.txt
File metadata and controls
62 lines (43 loc) · 981 Bytes
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
57
58
59
60
61
62
usage: asm [-h]
Asm implements a simple x86-like processor.
Instructions are read from standard input and executed.
INSTRUCTIONS
The instructions are similar to their x86 counterparts.
The following instructions are supported:
mov
push
pop
inc
dec
add
sub
mul
cmp
jmp
je, jz
jne, jnz
jg
jge
jl
jle
call
leave
ret
p (prints processor state)
exit (terminates this program)
REGISTERS
6 general purpose registers are available:
%a, %b, %c, %d, %e, %f
Special registers:
%ip: stores index of next instruction
%fp: frame pointer
%sp: stack pointer
CALLING PROCEDURE
Stack usage is identical to x86.
Return register: %a
Caller-saved registers: %a, %b, %c
Callee-saved registers: %d, %e, %f
MEMORY ADDRESSING MODES
imm = mem[imm]
(reg) = mem[reg]
num(reg) = mem[num + reg]