blob: ccf15549a9bc90e2465b562a8623f77e53fa6278 (
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
|
byteOpFlag: bit{1}
RRC := b000
SWPB:= b001
RRA := b010
SXT := b011
PUSH:= b100
CALL:= b101
RETI:= b110
oneOpCode: bit{3} :=
RRC | SWPB | RRA | SXT | PUSH | CALL | RETI
JNE := b000
JEQ := b001
JNC := b010
JC := b011
JN := b100
JGE := b101
JL := b110
JMP := b111
jumpCondition: bit{3} :=
JNE | JEQ | JNC | JC | JN | JGE | JL | JMP
MOV := b0100
ADD := b0101
ADDC:= b0110
SUBC:= b0111
SUB := b1000
CMP := b1001
DADD:= b1010
BIT := b1011
BIC := b1100
BIS := b1101
XOR := b1110
AND := b1111
twoOpCode: bit{4} :=
MOV | ADD | ADDC | SUBC | SUB | CMP | DADD | BIT | BIC | BIS | XOR | AND
Symbolic := b1
Absolute := b1
RegisterDirect := b0
Indexed := b1
twoOpDestMode: bit{1} :=
RegisterDirect | Indexed | Absolute | Symbolic
NextWord := b11
Const0 := b00
Const1 := b01
Const2 := b10
Const4 := b10
Const8 := b11
ConstNeg1 := b11
RegisterDirect := b00
Indexed := b01
RegisterIndirect := b10
IndirectAutoInc := b11
twoOpSourceMode: bit{2} :=
NextWord | Const0 | Const1 |
Const2 | Const4 | Const8 |
ConstNeg1 | RegisterDirect | Indexed |
RegisterIndirect | IndirectAutoInc
oneOpDestMode: bit{2} := twoOpSourceMode
twoOpDestModePrime :=
Symbolic:b0000 |
Absolute:b0010 |
RegisterDirect:register |
Indexed:register
# replace with register names!
twoOpSourceModePrime :=
NextWord:b0000
Const4:b0010
Const8:b0010
Const0:b0011
Const1:b0011
Const2:b0011
ConstNeg1:b0011
RegisterDirect:register
Indexed:register
RegisterIndirect:register
IndirectAutoInc:register
sourceReg: bit{4}
destReg: bit{4} := sourceReg
noOp := b001:jumpCondition:pcOffset
oneOp:= b000100:oneOpCode:byteOpFlag:oneOpDestMode:destReg
twoOp := twoOpCode:sourceReg:twoOpDestMode:byteOpFlag:twoOpSourceMode:destReg
twoOpRewrite $= twoOp =>
twoOpCode:byteOpFlag:twoOpSourceMode:sourceReg:sourceReg:twoOpDestMode:destReg:destReg
twoOpPrime := twoOpCode:byteOpFlag:twoOpSourceModePrime:sourceReg:twoOpDestModePrime:destReg
root := oneOp | twoOp | noOp
|