-
Notifications
You must be signed in to change notification settings - Fork 0
/
isa.h
71 lines (63 loc) · 917 Bytes
/
isa.h
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
/* instructions */
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef int8_t i8;
typedef int16_t i16;
typedef uint32_t u32;
typedef int32_t i32;
typedef u8 byte;
typedef intptr_t WORD;
enum
{
INOP,
IARRAY,
ISLICE,
IFRAME,
ICALL,
IJMP,
PCALL,
IRET,
IREF,
ILEN,
ILEA,
IADDW,
ISUBW,
IMULW,
IMULB,
IMOVW,
IMOVM,
ILTW,
IEQW,
INEQW,
ILEQW,
IBEQW,
IBNEQW,
IEND,
};
enum
{
AMP = 0x00, /* Src/Dst op addressing */
AFP = 0x01,
AIMM = 0x02,
AXXX = 0x03,
AIND = 0x04,
AMASK = 0x07,
AOFF = 0x08,
AVAL = 0x10,
ARM = 0xC0, /* Middle op addressing */
AXNON = 0x00,
AXIMM = 0x40,
AXINF = 0x80,
AXINM = 0xC0,
IBY2WD = sizeof(WORD),
REGRET = 4,
StrSize = 256,
ArrHead = IBY2WD * 4,
};
#define SRC(x) ((x)<<3)
#define DST(x) ((x)<<0)
#define USRC(x) (((x)>>3)&AMASK)
#define UDST(x) ((x)&AMASK)
#define UXSRC(x) ((x)&(AMASK<<3))
#define UXDST(x) ((x)&(AMASK<<0))