From d0038394da1776a5b20f1343acda4576c0ba9747 Mon Sep 17 00:00:00 2001 From: BalkisJerad Date: Sun, 22 Mar 2026 03:23:43 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20.bin=20comme=20param=20=C3=A0=20simulat?= =?UTF-8?q?eur=5Ffront?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Epreuve0.asm | 1 + simulateur_front.py | 28 ++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Epreuve0.asm b/Epreuve0.asm index 282e8e8..a7bfdcf 100644 --- a/Epreuve0.asm +++ b/Epreuve0.asm @@ -18,4 +18,5 @@ _loop: JMP _loop _end: + MOV R0 'A' ;11100000 01000001 RET \ No newline at end of file diff --git a/simulateur_front.py b/simulateur_front.py index 5bd106c..15558e3 100644 --- a/simulateur_front.py +++ b/simulateur_front.py @@ -3,6 +3,7 @@ from tkinter import * import tkinter as tk import Epreuve3 as e3 import subprocess +import sys root = tk.Tk() # Widgets are added here @@ -149,12 +150,6 @@ label_sp.pack(pady=5) #val = subprocess.run(["/usr/bin/python3", "/home/aurelien/Documents/24hducode2026/24H_du_code_2026/Epreuve3.py", "test_bin_epreuve3/call_label.bin"] # transforme bytes en str) -with open("test_bin_epreuve3/cmp_reg.bin", "rb") as f: - program = f.read() - -sim = e3.Simulator(program) -sim_iter = sim.run() - previous_sp = None # Initialisation avant la première itération def update_gui(): @@ -200,5 +195,22 @@ def update_gui(): #Frame RAM -update_gui() -root.mainloop() \ No newline at end of file +# --------------------------------------------------------- +# LECTURE D'UN FICHIER .bin ET LANCEMENT +# --------------------------------------------------------- +if __name__ == "__main__": + # Nom du fichier binaire à exécuter + path ="" + args= sys.argv + if (len(args) > 1): + filename = args[1] + print("filename: " + filename) + with open(filename, "rb") as f: + program = f.read() + sim = e3.Simulator(program) + sim_iter = sim.run() + update_gui() + root.mainloop() + else: + print("Needs *.bin as parameter") +