Lets-a-go
This commit is contained in:
		
						commit
						c071745152
					
				
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
sillymachine
 | 
			
		||||
*.bin
 | 
			
		||||
*.ali
 | 
			
		||||
*.o
 | 
			
		||||
							
								
								
									
										41
									
								
								src/sillymachine.adb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/sillymachine.adb
									
									
									
									
									
										Normal 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;
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user