summaryrefslogtreecommitdiff
path: root/miniasm/README.IntelSubset
blob: fbdadd88a7d9edf539b1de01008c44524010aa44 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
Idea: emulate subset of IA32, so that we can run on real old
i386 hardware, without floating point

		opcode bits
R0	EAX	0
R1	ECX	1
R2	EDX	2
R3	EBX	3
R4	ESP	4
R5	EBP	5
R6	ESI	6	
R7	EDI	7
	EIP
	EFLAGS
	
have only a minimal set of operations:

mov
add
sub
and
or
not
xor
neg

cmp
je/jne/ja/jae/jb/jbe

ror
shr

pop
push

call/jsr
ret
jmp


this is special stuff not really needed in the high-level language,
but we need it in order to write an operating system on a PC
(Oberon puts those things into a system module in order to keep
it away from the general purpose language):

cli
sti
reti
in
out
hlt
int

nop may be useful for patchable binary formats and timing issues
(implementing loops with known timing)

early output, e.g. PC port 0x80 POST

usual abbreviations, they make code more compact or/and execution faster:

xor eax, eax -> mov eax, 0
inc eax -> add eax, 1
test eax, eax -> cmp eax, 0
lea -> mov, add, etc.

links
-----

http://pages.cs.wisc.edu/~markhill/cs354/Fall2008/notes/Pentium.html