rubyx/lib/slot_machine/macro/putstring.rb
Torsten 17a7f29b0c 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)
2020-03-22 14:31:43 +02:00

19 lines
625 B
Ruby

module SlotMachine
class Putstring < Macro
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
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
end
end
end