Lets-a-go

This commit is contained in:
Bartłomiej Szostak 2024-04-20 13:35:02 +02:00
commit c071745152
No known key found for this signature in database
GPG Key ID: 562DACF230A18086
2 changed files with 45 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
sillymachine
*.bin
*.ali
*.o

41
src/sillymachine.adb Normal file
View File

@ -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 <sm binary file>");
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;