summaryrefslogtreecommitdiff
path: root/misc-test/compilateur_c_en_c/reloc.h
blob: 684030b71829eb0162ed035746d8256a4a3070b2 (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
#ifndef RELOC_H
#define RELOC_H

#define EXT_CODE ".obj"
#define EXT_LABELS ".lbl"
#define EXT_HOLES ".hol"
#define EXT_EXEC ".bin"
#define MAX_LABEL_LEN 16

#include "table_sym.h"
#include <stdio.h>

struct labels {
	char *label;
	int relAddr;
};

struct holes {
	int holeAddr;
	char *label;
};

int openWriteDestFiles(char fileName[]);


int writeCode(int opcode, int op1, int op2, int op3); // Retourne l'adresse relative du debut de l'instruction
void writeLabel(char *label); 
void writeHole(int holeAddr, char *label); 

void closeDestFiles();

//int ftellCode(); // Retourne l'adresse relative de la prochaine instruction à écrire dans le fichier .obj

void linker(char fileName[], int baseAddress); // Génère le .bin a partir des .obj, .lbl, .hol


#endif /* RELOC_H */