add decent method to get the programs return to interpreter

only had such methods in tests, but they really belong in code
also adding fake values to true ,false and nil
This commit is contained in:
2020-03-28 18:39:49 +02:00
parent 8fa00d1413
commit 8dfcc0f5de
5 changed files with 35 additions and 4 deletions

View File

@ -266,7 +266,7 @@ module Risc
set_instruction(nil)
return false
when :died
raise "Method #{@registers[:r1].to_string} not found for #{@registers[std_reg(:syscall_1)]}"
raise "Method #{@registers[:r1]} not found for #{@registers[std_reg(:syscall_1)]}"
else
raise "un-implemented syscall #{name}"
end
@ -274,6 +274,15 @@ module Risc
true
end
def get_sys_return
val = get_register( std_reg(:syscall_1) ) # syscalls return into syscall_1
end
def run_all
tick while(@instruction)
clock
end
def handle_putstring
# should test length, syscall_3 (syscall_1 is file_descriptor, ie stdout)
str = get_register( std_reg(:syscall_2) )