define and use syscall_XX registers

rather than use hardcoded r0 etc use syscall_X
change the syscalls and interpreter to use them
later use platform to map from syscall_X to actually used register (like r0 in arm)
This commit is contained in:
2020-03-16 17:31:14 +02:00
parent 3b50fee158
commit 17a7f29b0c
5 changed files with 19 additions and 9 deletions

View File

@ -3,9 +3,13 @@ module SlotMachine
def to_risc(compiler)
builder = compiler.builder(compiler.source)
integer = builder.prepare_int_return # makes integer_tmp variable as return
word = Risc.syscall_reg(1).set_compiler(compiler)
length = Risc.syscall_reg(2).set_compiler(compiler)
builder.build do
word = message[:receiver].to_reg.known_type(:Word)
integer << word[:char_length]
string = message[:receiver].to_reg.known_type(:Word)
integer << string[:char_length]
word << string # into right
length << integer # registers
end
SlotMachine::Macro.emit_syscall( builder , :putstring )
compiler