-
Notifications
You must be signed in to change notification settings - Fork 1
/
vvm.ksy
112 lines (110 loc) · 2.22 KB
/
vvm.ksy
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
meta:
id: vvm
endian: be
seq:
- id: head
type: header
- id: regs
type: registers
- id: flags
type: flags
- id: interrupt_code
type: u1
- id: code
type: code_section
types:
header:
seq:
- id: magic
contents: 'VVM'
- id: version
size: 1
- id: code_offset
size: 1
- id: reserved
size: 3
registers:
seq:
- id: state
type: u1
enum: states
- id: stack_head
type: u2
- id: eax
type: u2
- id: ebx
type: u2
- id: ecx
type: u2
- id: eip
type: u2
- id: edi
type: u2
flags:
seq:
- id: reserved_flag
type: b1
- id: zf
type: b1
- id: outf
type: b1
- id: intf
type: b1
instruction:
seq:
- id: opcode
type: u1
enum: opcodes
- id: arg1_m
if: opcode == opcodes::mov_mm
or opcode == opcodes::mov_mb
or opcode == opcodes::inc
or opcode == opcodes::cmp_mm
or opcode == opcodes::cmp_mc
or opcode == opcodes::jne_m
or opcode == opcodes::add_mb
type: address
- id: arg2_m
if: opcode == opcodes::mov_mm
type: address
- id: arg2_b
if: opcode == opcodes::mov_mb
or opcode == opcodes::cmp_mb
or opcode == opcodes::add_mb
type: u1
- id: arg2_c
if: opcode == opcodes::cmp_mc
type: u2
address:
seq:
- id: meta
seq:
- id: redirect
type: b1
- id: offset
type: u2
code_section:
seq:
- type: instruction
repeat: eos
enums:
opcodes:
0x00: invalid
0x03: add_mb
0x88: mov_mm
0x8a: mov_mb
0x40: inc
0x38: cmp_mm
0x39: cmp_mc
0x3a: cmp_mb
0x75: jne_m
states:
0x01: init
0x02: exec
0x03: pause
0x10: erro
0xff: end
interrupts:
0x21: int_pritn
0xfa: int_test
0xff: int_end