2017-01-19 09:02:29 +02:00
|
|
|
module Risc
|
2015-11-19 10:07:27 +02:00
|
|
|
|
2016-12-25 18:11:58 +02:00
|
|
|
# RegToByte moves a byte into memory from a register.
|
2015-11-19 10:07:27 +02:00
|
|
|
|
|
|
|
# indexes are 1 based !
|
|
|
|
|
2016-12-25 18:11:58 +02:00
|
|
|
class RegToByte < Setter
|
2015-11-19 10:07:27 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2016-12-25 18:11:58 +02:00
|
|
|
# Produce a RegToByte instruction.
|
2015-11-19 10:07:27 +02:00
|
|
|
# from and to are translated (from symbol to register if neccessary)
|
|
|
|
# but index is left as is.
|
2016-12-28 19:01:58 +02:00
|
|
|
def self.reg_to_byte( source , from , to , index)
|
2018-07-16 19:00:04 +03:00
|
|
|
raise "Not register #{to}" unless RegisterValue.look_like_reg(to)
|
|
|
|
index = to.resolve_index(index) if index.is_a?(Symbol)
|
2016-12-28 19:01:58 +02:00
|
|
|
RegToByte.new( source, from , to , index)
|
|
|
|
end
|
2015-11-19 10:07:27 +02:00
|
|
|
|
|
|
|
end
|