-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathop.h
More file actions
100 lines (73 loc) · 1.96 KB
/
Copy pathop.h
File metadata and controls
100 lines (73 loc) · 1.96 KB
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
/*
** op.h
**
** Nicolas Sadirac
** Tue Jul 13 18:53:48 1993
*/
#ifndef _OP_H_
# define _OP_H_
#define MEM_SIZE (6*1024)
#define IDX_MOD 512 /* modulo de l'index < */
#define MAX_ARGS_NUMBER 4 /* this may not be changed 2^*IND_SIZE */
#define COMMENT_CHAR '#'
#define LABEL_CHAR ':'
#define DIRECT_CHAR '%'
#define SEPARATOR_CHAR ','
#define LABEL_CHARS "abcdefghijklmnopqrstuvwxyz_0123456789"
#define NAME_CMD_STRING ".name"
#define COMMENT_CMD_STRING ".comment"
/*
** regs
*/
#define REG_NUMBER 16 /* r1 <--> rx */
/*
**
*/
typedef char args_type_t;
#define T_REG 1 /* registre */
#define T_DIR 2 /* directe (ld #1,r1 met 1 dans r1) */
#define T_IND 4 /* indirecte toujours relatif
( ld 1,r1 met ce qu'il y a l'adress (1+pc)
dans r1 (4 octecs )) */
#define T_LAB 8 /* LABEL */
struct op_s
{
char *mnemonique;
char nbr_args;
args_type_t type[MAX_ARGS_NUMBER];
char code;
int nbr_cycles;
char *comment;
};
typedef struct op_s op_t;
/*
** size
*/
#define IND_SIZE 2 /* en octet */
#define REG_SIZE 4 /* en octet */
#define DIR_SIZE REG_SIZE /* en octet */
/*
** op_tab
*/
extern op_t op_tab[];
/*
** header
*/
#define PROG_NAME_LENGTH 128
#define COMMENT_LENGTH 2048
struct header_s
{
int magic;
#define COREWAR_EXEC_MAGIC 0xea83f3 /* why not */
char prog_name[PROG_NAME_LENGTH+1];
int prog_size;
char comment[COMMENT_LENGTH+1];
};
typedef struct header_s header_t;
/*
** live
*/
#define CYCLE_TO_DIE 1536 /* nombre de cycle pour etre d\'eclarer mort */
#define CYCLE_DELTA 5
#define NBR_LIVE 40
#endif