Implemented adding file size to memory size to ensure executable always fits
This commit is contained in:
parent
b7b8ce8054
commit
8897298e11
@ -16,6 +16,7 @@ procedure sillymachine is
|
||||
I : Integer := 0;
|
||||
Value : Byte;
|
||||
|
||||
ExecSize : Integer := 0;
|
||||
MemorySize : Integer := 1048576; -- default memory is 1 mb (TODO: figure out why 8 mb produces STORAGE_ERROR)
|
||||
|
||||
begin
|
||||
@ -73,6 +74,9 @@ begin
|
||||
MemorySize := 1048576 * Integer'Value(Argument (2));
|
||||
end if;
|
||||
|
||||
ExecSize := Integer(Ada.Directories.Size(FileName));
|
||||
MemorySize := MemorySize + ExecSize;
|
||||
|
||||
declare
|
||||
MemoryArr : ByteArr (0 .. MemorySize);
|
||||
begin
|
||||
@ -89,7 +93,7 @@ begin
|
||||
end loop;
|
||||
Bin_IO.Close(F);
|
||||
|
||||
for i in 0 .. 15 loop
|
||||
for i in 0 .. 30 loop
|
||||
Put_Line(Byte'Image(MemoryArr (i)));
|
||||
end loop;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user