fixes to get opal to work
opal has bug with << and |=, but changing syntax works
This commit is contained in:
parent
fa7d2ced6d
commit
b670e058a9
@ -1,11 +1,11 @@
|
|||||||
module Arm
|
module Arm
|
||||||
# ADDRESSING MODE 4
|
# ADDRESSING MODE 4
|
||||||
|
|
||||||
class StackInstruction < Instruction
|
class StackInstruction < Instruction
|
||||||
include Arm::Constants
|
include Arm::Constants
|
||||||
|
|
||||||
def initialize(first , attributes)
|
def initialize(first , attributes)
|
||||||
super(attributes)
|
super(attributes)
|
||||||
@first = first
|
@first = first
|
||||||
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
|
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
|
||||||
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
|
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
|
||||||
@ -17,16 +17,16 @@ module Arm
|
|||||||
# downward growing, decrement before memory access
|
# downward growing, decrement before memory access
|
||||||
# official ARM style stack as used by gas
|
# official ARM style stack as used by gas
|
||||||
end
|
end
|
||||||
|
|
||||||
def assemble(io)
|
def assemble(io)
|
||||||
# don't overwrite instance variables, to make assembly repeatable
|
# don't overwrite instance variables, to make assembly repeatable
|
||||||
operand = @operand
|
operand = @operand
|
||||||
|
|
||||||
if (@first.is_a?(Array))
|
if (@first.is_a?(Array))
|
||||||
operand = 0
|
operand = 0
|
||||||
@first.each do |r|
|
@first.each do |r|
|
||||||
raise "nil register in push, index #{r}- #{inspect}" if r.nil?
|
raise "nil register in push, index #{r}- #{inspect}" if r.nil?
|
||||||
operand |= (1 << reg_code(r))
|
operand = operand | (1 << reg_code(r))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise "invalid operand argument #{inspect}"
|
raise "invalid operand argument #{inspect}"
|
||||||
@ -46,14 +46,14 @@ module Arm
|
|||||||
@rn = :sp # sp register
|
@rn = :sp # sp register
|
||||||
#assemble of old
|
#assemble of old
|
||||||
val = operand
|
val = operand
|
||||||
val |= (reg_code(@rn) << 16)
|
val = val | (reg_code(@rn) << 16)
|
||||||
val |= (is_pop << 16+4) #20
|
val = val | (is_pop << 16+4) #20
|
||||||
val |= (write_base << 16+4+ 1)
|
val = val | (write_base << 16+4+ 1)
|
||||||
val |= (@attributes[:update_status] << 16+4+ 1+1)
|
val = val | (@attributes[:update_status] << 16+4+ 1+1)
|
||||||
val |= (up_down << 16+4+ 1+1+1)
|
val = val | (up_down << 16+4+ 1+1+1)
|
||||||
val |= (pre_post_index << 16+4+ 1+1+1+1)#24
|
val = val | (pre_post_index << 16+4+ 1+1+1+1)#24
|
||||||
val |= (instuction_class << 16+4+ 1+1+1+1 +2)
|
val = val | (instuction_class << 16+4+ 1+1+1+1 +2)
|
||||||
val |= (cond << 16+4+ 1+1+1+1 +2+2)
|
val = val | (cond << 16+4+ 1+1+1+1 +2+2)
|
||||||
io.write_uint32 val
|
io.write_uint32 val
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -76,5 +76,5 @@ module Arm
|
|||||||
"#{opcode} [#{@first.collect {|f| f.to_asm}.join(',') }] #{super}"
|
"#{opcode} [#{@first.collect {|f| f.to_asm}.join(',') }] #{super}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user