Browse Source

Deux versions Compilateur et Interpreteur terminé, TAF : finir la version non sécurisée du processeur, tester

Paul Faure 2 years ago
parent
commit
be9c40eece
6 changed files with 33 additions and 23 deletions
  1. 1
    1
      Compilateur
  2. 1
    1
      Interpreteur
  3. 2
    2
      Makefile
  4. 26
    0
      juste_prix.c
  5. 3
    16
      max.c
  6. 0
    3
      prog.c

+ 1
- 1
Compilateur

1
-Subproject commit 7718e9c861a78b48272d5d8a759a922594e25a16
1
+Subproject commit b501ce3389db4142df557e6bca95434e591741f6

+ 1
- 1
Interpreteur

1
-Subproject commit 9c38352e612609ceb06ea82c10c31790e89feae8
1
+Subproject commit c9c60001de4ae1f8e379dbc210b7a70a6b2dd934

+ 2
- 2
Makefile View File

53
 	@echo "Compilation terminée"
53
 	@echo "Compilation terminée"
54
 else ifeq ($(QUOI),interprete)
54
 else ifeq ($(QUOI),interprete)
55
 	@echo "Interpretation"
55
 	@echo "Interpretation"
56
-	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
56
+	Interpreteur/rondoudou_interpreter $(SOURCE).memasm 
57
 	@echo "Interpretation terminée"
57
 	@echo "Interpretation terminée"
58
 else ifeq ($(QUOI),cross_assemble)
58
 else ifeq ($(QUOI),cross_assemble)
59
 	@echo "CrossAssemblage"
59
 	@echo "CrossAssemblage"
72
 	@mv output.txt $(SOURCE).memasm
72
 	@mv output.txt $(SOURCE).memasm
73
 	@echo "Compilation terminée"
73
 	@echo "Compilation terminée"
74
 	@echo "Interpretation"
74
 	@echo "Interpretation"
75
-	cat $(SOURCE).memasm | Interpreteur/rondoudou_interpreter
75
+	Interpreteur/rondoudou_interpreter $(SOURCE).memasm 
76
 	@echo "Interpretation terminée"
76
 	@echo "Interpretation terminée"
77
 	@echo "CrossAssemblage"
77
 	@echo "CrossAssemblage"
78
 	cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur
78
 	cat $(SOURCE).memasm | CrossAssembleur/rondoudou_cross_assembleur

+ 26
- 0
juste_prix.c View File

1
+int chose_number() {
2
+	int i = get();	
3
+	return i;
4
+}
5
+
6
+int compare(int nb, int prop) {
7
+	int rt;
8
+	if (prop > nb) {
9
+		rt = -1;
10
+	} else if (prop < nb) {
11
+		rt = 1;
12
+	} else {
13
+		rt = 0;
14
+	}
15
+
16
+	return rt;
17
+}
18
+
19
+int main() {
20
+	int valeur = chose_number();
21
+	int prop = valeur + 50;
22
+	while (!(prop == valeur)) {
23
+		prop = get();
24
+		printf(compare(valeur, prop));
25
+	}
26
+}

+ 3
- 16
max.c View File

1
 int get_value() {
1
 int get_value() {
2
-	int i = 0;
3
-	while (i<5) {
4
-		printf(0);
5
-		stop(1);
6
-		printf(255);
7
-		stop(1);
8
-		i = i+1;
9
-	}
10
-	stop(15);
11
-	i = get();
2
+	int i = get();
12
 	return i;
3
 	return i;
13
 }
4
 }
14
 
5
 
32
 		i = i+1;
23
 		i = i+1;
33
 	}
24
 	}
34
 	i = 0;
25
 	i = 0;
35
-	while (i<5) {
36
-		printf(170);
37
-		stop(1);
38
-		printf(85);
39
-		stop(1);
26
+	while (i<10) {
27
+		printf(tab[i]);
40
 		i = i+1;
28
 		i = i+1;
41
 	}
29
 	}
42
-	stop(3);
43
 	printf(max(tab, 10));
30
 	printf(max(tab, 10));
44
 }
31
 }

+ 0
- 3
prog.c View File

1
 int max(int * tab, int size) {
1
 int max(int * tab, int size) {
2
 	int i = 0;
2
 	int i = 0;
3
 	int max = 0;
3
 	int max = 0;
4
-	printf(size);
5
 	while (i<size) {
4
 	while (i<size) {
6
-		printf(tab[i]);
7
 		if (tab[i] > max) {
5
 		if (tab[i] > max) {
8
 			max = tab[i];
6
 			max = tab[i];
9
-			printf(200);
10
 		}
7
 		}
11
 		i = i+1;
8
 		i = i+1;
12
 	}
9
 	}

Loading…
Cancel
Save