removes the asm from assemble signature (not used)

This commit is contained in:
Torsten Ruger 2014-04-25 11:56:53 +03:00
parent 93e4178017
commit d08e6702f0
9 changed files with 15 additions and 9 deletions

View File

@ -122,7 +122,7 @@ module Asm
def assemble(io) def assemble(io)
@values.each do |obj| @values.each do |obj|
obj.assemble io, self obj.assemble io
end end
end end

View File

@ -8,7 +8,7 @@ module Asm
super(opcode,args) super(opcode,args)
end end
def assemble(io, as) def assemble(io)
s = @update_status_flag? 1 : 0 s = @update_status_flag? 1 : 0
case opcode case opcode
when :b, :bl when :b, :bl

View File

@ -40,7 +40,7 @@ module Asm
4 4
end end
def assemble(io, as) def assemble(io)
raise "Abstract class, should not be called/instantiated #{self.inspect}" raise "Abstract class, should not be called/instantiated #{self.inspect}"
end end
end end

View File

@ -2,7 +2,6 @@ module Asm
class Label class Label
def initialize(name , asm) def initialize(name , asm)
@@oh = 1
@name = name @name = name
@asm = asm @asm = asm
@position = nil @position = nil
@ -23,7 +22,7 @@ module Asm
0 0
end end
def assemble(io, as) def assemble(io)
self.position = io.tell self.position = io.tell
end end
def set! def set!

View File

@ -69,7 +69,7 @@ module Asm
end end
end end
def assemble(io, as) def assemble(io)
build build
val = operand.is_a?(Register) ? operand.bits : operand val = operand.is_a?(Register) ? operand.bits : operand
val |= (rd.bits << 12) val |= (rd.bits << 12)

View File

@ -56,7 +56,7 @@ module Asm
end end
end end
def assemble(io, as) def assemble(io)
build build
#not sure about these 2 constants. They produce the correct output for str r0 , r1 #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 # but i can't help thinking that that is because they are not used in that instruction and

View File

@ -26,7 +26,7 @@ module Asm
attr_accessor :cond, :inst_class, :pre_post_index, :up_down, attr_accessor :cond, :inst_class, :pre_post_index, :up_down,
:update_status_flag, :write_base, :is_pop, :rn, :operand :update_status_flag, :write_base, :is_pop, :rn, :operand
def assemble(io, as) def assemble(io)
build build
cond = @cond.is_a?(Symbol) ? COND_CODES[@cond] : @cond cond = @cond.is_a?(Symbol) ? COND_CODES[@cond] : @cond
rn = reg "sp" # sp register rn = reg "sp" # sp register

View File

@ -19,7 +19,7 @@ module Asm
def length def length
@string.length @string.length
end end
def assemble(io, as) def assemble(io)
io << @string io << @string
end end
end end

View File

@ -28,6 +28,13 @@ class NodesCase < MiniTest::Test
assert tree[:args].is_a? Vm::NumberExpression assert tree[:args].is_a? Vm::NumberExpression
assert_equal 42 , tree[:args].value assert_equal 42 , tree[:args].value
end end
def test_arg_list
@parser = @parser.args
tree = parse "(42, foo)"
assert_equal Array , tree.class
assert_equal 42 , tree.first.value
assert_equal "foo" , tree.last.name
end
end end