fix the load memory instruction
This commit is contained in:
parent
31a55b07ac
commit
83d4ce55ca
@ -31,6 +31,7 @@ module Arm
|
||||
@rn = arg
|
||||
if @right
|
||||
@operand = @right
|
||||
unless( @operand.is_a? Symbol)
|
||||
if (@operand < 0)
|
||||
@add_offset = 0
|
||||
#TODO test/check/understand
|
||||
@ -42,6 +43,7 @@ module Arm
|
||||
raise "reference offset too large/small (max 4095) #{arg} #{inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif (arg.is_a?(Vm::StringConstant) ) #use pc relative
|
||||
@rn = :pc
|
||||
@operand = arg.position - self.position - 8 #stringtable is after code
|
||||
@ -62,8 +64,6 @@ module Arm
|
||||
|
||||
def assemble(io)
|
||||
build
|
||||
puts inspect
|
||||
i = 0 #I flag (third bit)
|
||||
#not sure about these 2 constants. They produce the correct output for str r0 , r1
|
||||
# but i can't help thinking that that is because they are not used in that instruction and
|
||||
# so it doesn't matter. Will see
|
||||
@ -71,13 +71,19 @@ module Arm
|
||||
# TODO to be continued
|
||||
@add_offset = 0 if @attributes[:add_offset]
|
||||
@pre_post_index = 1
|
||||
@pre_post_index = 0 if @attributes[:flaggie]
|
||||
w = 0 #W flag
|
||||
byte_access = opcode.to_s[-1] == "b" ? 1 : 0 #B (byte) flag
|
||||
instuction_class = 0b01 # OPC_MEMORY_ACCESS
|
||||
if @operand.is_a?(Symbol)
|
||||
val = reg_code(@operand)
|
||||
@pre_post_index = 0
|
||||
i = 1 # not quite sure about this, but it gives the output of as. read read read.
|
||||
else
|
||||
i = 0 #I flag (third bit)
|
||||
val = @operand
|
||||
val = reg_code(@operand) if @operand.is_a?(Symbol)
|
||||
end
|
||||
val = shift(val , 0 ) # for the test
|
||||
@pre_post_index = 0 if @attributes[:flaggie]
|
||||
val |= shift(reg_code(@result) , 12 )
|
||||
val |= shift(reg_code(@rn) , 12+4) #16
|
||||
val |= shift(@is_load , 12+4 +4)
|
||||
|
@ -88,7 +88,7 @@ module Core
|
||||
# make char out of digit (by using ascii encoding) 48 == "0"
|
||||
b = utoa_function.body.scope binding
|
||||
b.remainder = remainder + 48
|
||||
b.strb( remainder, right: str_addr )
|
||||
b.strb( remainder, str_addr )
|
||||
b.sub( str_addr, str_addr , 1 )
|
||||
b.cmp( number , 0 )
|
||||
b.callne( utoa_function )
|
||||
|
Loading…
Reference in New Issue
Block a user