-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinternals.h
More file actions
75 lines (59 loc) · 1.57 KB
/
internals.h
File metadata and controls
75 lines (59 loc) · 1.57 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
#ifndef INTERNALS
#define INTERNALS
#include <string.h>
#include <stdlib.h>
#include "libs/arg_table.h"
#include "libs/bin_buffer.h"
#include "libs/symbol_table.h"
#include "y.tab.h"
extern char* keywords [];
extern int keyword_id [];
/*Structs for the instruction maching*/
typedef struct
{
int op; //Instruction op
char* name; //Name to match
int nargs;
int *ntypes; //Number of permissive types per argument
int *type;
int n_templates;
void (*asm_func)(BIN_BUFFER* bin_buffer, ARG_TABLE* arg_table, int op); //Function pointer to assembler function
//int relative_args []; //array of 0 or 1 to set relative arguments
ARG_TEMPLATE *arg_templates [];
} INS_NODE_TEMPLATE;
typedef struct
{
int op;
ARG_TABLE args;
} INS_NODE;
typedef struct
{
int val;
char* name;
} KEYWORD;
//number handdling
void set_values(int);
int return_token(char* identifier);
/*16bit HI LO */
#define BYTE_LO(Data) (Data & 0xff)
#define BYTE_HI(Data) ((Data >> 8) & 0xff)
//Identifier stuff
extern char* identifiers [2];
extern int identifier_index;
#define IDENTIFIER_0 identifiers [0]
#define IDENTIFIER_1 identifiers [1]
#define IDENTIFIER_2 identifiers [2]
void set_identifier(char* identifier_name);
void reset_identifiers();
/*TYPES of symbols*/
#define TYPE_LABEL 0x00
#define TYPE_DEF 0x01
#define TYPE_REG 0x02
#define TYPE_STRUCT 0x03
#define TYPE_STRUCT_MEMBER 0x03
#define TYPE_DONT_CARE 0xffae
//Register clases Classess
#define CLASS_GPR 0
#define CLASS_SPR 1
#define CLASS_SEC 2
#endif