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:
@ -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) )
|
||||
|
Reference in New Issue
Block a user