Implemented instruction to dump data from registers to memory
This commit is contained in:
parent
337ed7d795
commit
96386d56e3
26
Makefile
26
Makefile
@ -1,27 +1,23 @@
|
||||
|
||||
default: sillymachine
|
||||
|
||||
floattobitshelper: ./src/floattobitshelper.c ./src/floattobitshelper.h
|
||||
gcc -c src/floattobitshelper.c -o floattobitshelper.o
|
||||
ar -crs floattobitshelper.a floattobitshelper.o
|
||||
|
||||
floatwin: ./src/floattobitshelper.c ./src/floattobitshelper.h
|
||||
x86_64-w64-mingw32-gcc -c src/floattobitshelper.c -o floatwin.o -lwinmm -lgdi32
|
||||
ar -crs floattobitshelper.a floatwin.o
|
||||
|
||||
|
||||
sillymachine: ./src/sillymachine.adb ./src/*.adb ./src/*.ads floattobitshelper
|
||||
sillymachine: ./src/sillymachine.adb ./src/*.adb ./src/*.ads ./src/floattobitshelper.h ./src/floattobitshelper.c
|
||||
gcc -c src/floattobitshelper.c -o floattobitshelper.o
|
||||
ar -crs floattobitshelper.a floattobitshelper.o
|
||||
gnatmake ./src/sillymachine.adb -largs -L./ -l:floattobitshelper.a
|
||||
|
||||
debug: ./src/sillymachine.adb ./src/*.adb ./src/*.ads floattobitshelper
|
||||
debug: ./src/sillymachine.adb ./src/*.adb ./src/*.ads ./src/floattobitshelper.h ./src/floattobitshelper.c
|
||||
gcc -g -c src/floattobitshelper.c -o floattobitshelper.o
|
||||
ar -crs floattobitshelper.a floattobitshelper.o
|
||||
gnatmake ./src/sillymachine.adb -o sillymachine-debug -g -largs -L./ -l:floattobitshelper.a
|
||||
|
||||
win: ./src/sillymachine.adb ./src/*.adb ./src/*.ads floatwin
|
||||
|
||||
x86_64-w64-mingw32-gnatmake src/sillymachine.adb -lwinmm -lgdi32 -largs -L./ -l:floattobitshelper.a
|
||||
win: ./src/sillymachine.adb ./src/*.adb ./src/*.ads ./src/floattobitshelper.h ./src/floattobitshelper.c
|
||||
x86_64-w64-mingw32-gcc -c src/floattobitshelper.c -o floatwin.o -lwinmm -lgdi32
|
||||
ar -crs floatwin.a floatwin.o
|
||||
x86_64-w64-mingw32-gnatmake src/sillymachine.adb -lwinmm -lgdi32 -largs -L./ -l:floatwin.a
|
||||
|
||||
|
||||
all: sillymachine win
|
||||
|
||||
clean:
|
||||
rm *.o *.ali *.a sillymachine.exe sillymachine sillymachine-debug
|
||||
rm *.o *.ali *.a sillymachine sillymachine.exe sillymachine-debug
|
||||
|
@ -262,10 +262,18 @@ package body Shardware is
|
||||
Length : Integer := Integer(Registers (3));
|
||||
CharBuff : String (1 .. Length);
|
||||
begin
|
||||
for i in 1 .. Length loop
|
||||
CharBuff (i) := Character'Val(Memory (Pointer + Unsigned_32(i)));
|
||||
end loop;
|
||||
Put(CharBuff);
|
||||
if InputTypeFlag = LEString then
|
||||
for i in 1 .. Length loop
|
||||
CharBuff (i) := Character'Val(Memory (Pointer + Unsigned_32(i)));
|
||||
end loop;
|
||||
Put(CharBuff);
|
||||
elsif InputTypeFlag = LEUint then
|
||||
Put(Unsigned_32'Image(Registers (26)));
|
||||
elsif InputTypeFlag = LEInt then
|
||||
Put(Integer'Image(UnToSignedInt(Registers (26))));
|
||||
elsif InputTypeFlag = LEFloat then
|
||||
Put(Float'Image(BytesToF(UToBytes(Registers (26)))));
|
||||
end if;
|
||||
end;
|
||||
when others => null;
|
||||
end case;
|
||||
|
@ -213,6 +213,27 @@ begin
|
||||
when 3 => InputTypeFlag := LEFloat;
|
||||
when others => InputTypeFlag := LEString;
|
||||
end case;
|
||||
when 44 => -- Dump Register to Memory (Unsigned)
|
||||
declare
|
||||
Buffer : ByteArr(1 .. 4);
|
||||
begin
|
||||
Buffer := UToBytes(RegisterU(Integer(Instruction(3))));
|
||||
WriteMem(MemoryArr, BytesToU(TempBytes(Instruction)), Buffer, True);
|
||||
end;
|
||||
when 45 => -- Dump Register to Memory (Int)
|
||||
declare
|
||||
Buffer : ByteArr(1 .. 4);
|
||||
begin
|
||||
Buffer := IToBytes(RegisterI(Integer(Instruction(3))));
|
||||
WriteMem(MemoryArr, BytesToU(TempBytes(Instruction)), Buffer, True);
|
||||
end;
|
||||
when 46 => -- Dump Register to Memory (Float)
|
||||
declare
|
||||
Buffer : ByteArr(1 .. 4);
|
||||
begin
|
||||
Buffer := FToBytes(RegisterF(Integer(Instruction(3))));
|
||||
WriteMem(MemoryArr, BytesToU(TempBytes(Instruction)), Buffer, True);
|
||||
end;
|
||||
when 65535 =>
|
||||
goto THE_END; -- exit opcode
|
||||
when others => null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user