summaryrefslogtreecommitdiff
path: root/samples/instructions.txt
blob: 6034e0d12993b9ef762abe74468d5d80e22c8ee7 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Champ d'instructions général
FI:c3,6;c2,6;c1,6;e,6;op,8

# Champ d'adressage
Fa:reserved,4;rm,2

# Pattern des registres
Pr:R0;R1;R2;R3;R4;R5;R6;R7;R8;R9;R10;R11;R12;R13;R14;R15;R16;R17;R18;R19;R20;R21;R22;R23;R24;R25;R26;R27;R28;R29;R30;R31;Rg;Rd;IP;Fl

# Pattern des adressages
# .O = Adresse absolue (relogée)
# .O = Adresse relative à l'instruction en cours (ex: Label, Label + 2, __current__ + 4)
Pm:regop=.Pr;.I=.O;[regop=.Pr;.I=.O[regop=.Pr

# bits 3 - 2
# ~~~~~~~~~~
# 00 overflow
# 01 zero
# 10 sign
# 11 parity

# bits 5 - 4
# ~~~~~~~~~~
# 00 test1
# 01 test1 || test2
# 10 test1 && !test2
# 11 test1 || !test2


# Arithmetique

I:ADD c1=.Pr,c2=.Pr,c3=.Pr;op=0x0;e=0x0
I:ADD c1=.Pr,c2=.Pr,.I=.C;op=0x0;e=0x1
I:ADU c1=.Pr,c2=.Pr,c3=.Pr;op=0x0;e=0x2
I:ADU c1=.Pr,c2=.Pr,.I=.C;op=0x0;e=0x3
I:ADD c2=.Pr,c3=.Pr;op=0x0;e=0x0;c1=c2
I:ADD c2=.Pr,.I=.C;op=0x0;e=0x1;c1=c2
I:ADU c2=.Pr,c3=.Pr;op=0x0;c1=c2;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NOP;op=0x9


# Branchements

# bits 3 - 2
# ~~~~~~~~~~
# 00 overflow
# 01 zero
# 10 sign
# 11 parity

# bits 5 - 4
# ~~~~~~~~~~
# 00 test1
# 01 test1 || test2 == !(!test1 && !test2)
# 10 test1 && !test2 == !(!test1 || test2)
# 11 test1 || !test2 == !(!test1 && test2)

I:JE c1=.Pr,c2=.Pr,.I=.O;op=0xa;e=0x0
I:JNE c1=.Pr,c2=.Pr,.I=.O;op=0xa;e=0x1
I:JL c1=.Pr,c2=.Pr,.I=.O;op=0xa;e=0x2
I:JLE c1=.Pr,c2=.Pr,.I=.O;op=0xa;e=0x3
I:JG c2=.Pr,c1=.Pr,.I=.O;op=0xa;e=0x2
I:JGE c2=.Pr,c1=.Pr,.I=.O;op=0xa;e=0x3

I:JO .I=.O;op=0xa;e=0x10
I:JZ .I=.O;op=0xa;e=0x14
I:JS .I=.O;op=0xa;e=0x18
I:JP .I=.O;op=0xa;e=0x1c

I:JNO .I=.O;op=0xa;e=0x30
I:JNZ .I=.O;op=0xa;e=0x34
I:JNS .I=.O;op=0xa;e=0x38
I:JNP .I=.O;op=0xa;e=0x3c

I:JMP .I=.O;op=0xa;e=0x0

I:HALT;op=0x7f
I:RESET;op=0x7f;e=1

I:RET;op=0xc
I:RET c1=.C;op=0xc

I:CALL .I=.O;op=0xc;e=3

I:PUSH c1=.Pr;op=0xe
I:PUSH .I=.C;op=0xe;e=1
I:POP c1=.Pr;op=0xf