trying to get function calls to work (but will have to rework regeister handling)

This commit is contained in:
Torsten Ruger
2014-05-10 15:24:56 +03:00
parent 7d69132d90
commit 79a28ac5fa
9 changed files with 25 additions and 7 deletions

View File

@ -31,6 +31,7 @@ module Arm
end
def word_load value , reg
raise "nnn " unless reg.class == Symbol
mov( :left => reg , :right => value )
end
def string_load str_lit , reg

View File

@ -21,6 +21,9 @@ module Arm
if( arg.is_a? Fixnum ) #HACK to not have to change the code just now
arg = Arm::NumLiteral.new( arg )
end
if( arg.is_a? Vm::Signed ) #HACK to not have to change the code just now
arg = Arm::NumLiteral.new( arg.value )
end
if (arg.is_a?(Arm::NumLiteral))
if (arg.value.fits_u8?)
# no shifting needed
@ -57,7 +60,6 @@ module Arm
elsif (arg.type == 'rrx')
shift_imm = 0
end
@operand = rm_ref | (shift_op << 4) | (shift_imm << 4+3)
else
raise "invalid operand argument #{arg.inspect} , #{inspect}"
@ -68,6 +70,7 @@ module Arm
build
instuction_class = 0b00 # OPC_DATA_PROCESSING
val = @operand.is_a?(Symbol) ? reg_code(@operand) : @operand
raise inspect unless reg_code(@rd)
val |= (reg_code(@rd) << 12)
val |= (reg_code(@rn) << 12+4)
val |= (@update_status_flag << 12+4+4)#20