Implemented code execution
This commit is contained in:
parent
8897298e11
commit
efbc5e94b3
@ -19,6 +19,9 @@ procedure sillymachine is
|
||||
ExecSize : Integer := 0;
|
||||
MemorySize : Integer := 1048576; -- default memory is 1 mb (TODO: figure out why 8 mb produces STORAGE_ERROR)
|
||||
|
||||
PC : Integer := 0; -- Program Counter
|
||||
Instruction : ByteArr (0 .. 15);
|
||||
|
||||
begin
|
||||
|
||||
ValidHeader (0) := 6;
|
||||
@ -93,8 +96,20 @@ begin
|
||||
end loop;
|
||||
Bin_IO.Close(F);
|
||||
|
||||
for i in 0 .. 30 loop
|
||||
Put_Line(Byte'Image(MemoryArr (i)));
|
||||
PC := 64; -- initialise program counter to entry point
|
||||
while True loop
|
||||
for i in 0 .. 15 loop -- load the instruction
|
||||
Instruction (i) := MemoryArr (PC + i);
|
||||
end loop;
|
||||
|
||||
case Instruction (0) is -- execute the instruction
|
||||
when 0 => Put_Line("-- japko --");
|
||||
when 1 => Put_Line("-- banan --");
|
||||
when 255 => goto THE_END;
|
||||
when others => New_Line(1);
|
||||
end case;
|
||||
|
||||
PC := PC + 16; -- increment program counter to next instruction
|
||||
end loop;
|
||||
|
||||
end;
|
||||
|
Loading…
x
Reference in New Issue
Block a user