From c07174515227200c01685690198103d84e320ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Szostak?= Date: Sat, 20 Apr 2024 13:35:02 +0200 Subject: [PATCH] Lets-a-go --- .gitignore | 4 ++++ src/sillymachine.adb | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .gitignore create mode 100644 src/sillymachine.adb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..54bc858 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +sillymachine +*.bin +*.ali +*.o diff --git a/src/sillymachine.adb b/src/sillymachine.adb new file mode 100644 index 0000000..45a7242 --- /dev/null +++ b/src/sillymachine.adb @@ -0,0 +1,41 @@ +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Sequential_IO; +with Ada.Command_Line; use Ada.Command_Line; + +procedure sillymachine is + type Byte is mod 256; + package Bin_IO is new Ada.Sequential_IO (Byte); + type ByteArr is array (Integer range <>) of Byte; + + F : Bin_IO.File_Type; + FileName : String (1 .. 255); + FileNameLength : Integer := 0; + ValidHeader : ByteArr (0 .. 15); + Arr : ByteArr (0 .. 15); + I : Integer := 0; + Value : Byte; + +begin + + if Argument_Count = 0 then + New_Line(1); + Put_Line("Usage: sillymachine "); + New_Line(1); + goto THE_END; + end if; + + FileNameLength := Argument (1)'Length; + FileName(1 .. FileNameLength) := Argument (1); + + --Bin_IO.Open(F, Bin_IO.In_File, FileName); + --while not Bin_IO.End_Of_File (F) loop + -- Bin_IO.Read(F, Value); + -- Arr (I) := Value; + -- I := I + 1; + --end loop; + --for i in 0 .. 15 loop + -- Put_Line(Byte'Image(Arr (i))); + --end loop; + +<< THE_END >> +end sillymachine;