summaryrefslogtreecommitdiff
path: root/sys/src/games/v8e/dat.h
blob: 5a07dd6f2d5db311e3d8d63e2c0bde9b0ca95d29 (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
typedef char s8int;
typedef short s16int;
typedef int s32int;
typedef vlong s64int;

extern u32int r[16];
extern u32int ps;
extern u32int curpc;
extern int trace;

#define U32(x) ((x)[0] | (x)[1] << 8 | (x)[2] << 16 | (x)[3] << 24)

typedef struct Segment Segment;
typedef struct Chan Chan;

struct Segment {
	enum {
		SEGRO = 1,
	} flags;
	u32int start, size;
	u32int *data;
};

extern Segment segs[3];

enum {
	STACKSIZE = 16*1024*1024
};

enum {
	EPERM = 1,
	ENOENT = 2,
	EIO = 5,
	EBADF = 9,
	EINVAL = 22,
	EMFILE = 24,
	ENOTTY = 25,
};

struct Chan {
	int fd;
	enum {
		DONTCLOSE = 1,
		DIR = 2,
		FAKETTY = 4,
	} flags;
	char *buf, *bufp, *bufe;
};

enum { NCHANS = 128 };

enum {
	FLAGN = 8,
	FLAGZ = 4,
	FLAGV = 2,
	FLAGC = 1,
};