fixin up mov arguments

This commit is contained in:
Torsten Ruger
2014-05-18 12:30:49 +03:00
parent 2be96dccdc
commit 9fc8bfbb55
9 changed files with 26 additions and 25 deletions

View File

@ -4,11 +4,11 @@ class TestMoves < MiniTest::Test
include ArmHelper
def test_mov
code = @machine.mov :r0, right: 5
code = @machine.mov :r0, 5
assert_code code , :mov , [0x05,0x00,0xa0,0xe3] #e3 a0 10 05
end
def test_mvn
code = @machine.mvn :r1, right: 5
code = @machine.mvn :r1, 5
assert_code code , :mvn , [0x05,0x10,0xe0,0xe3] #e3 e0 10 05
end
end

View File

@ -5,7 +5,7 @@ def fibonaccit(n) # n == r0
tmp = a # r3 <- r1
a = b # r1 <- r2
b = tmp + b # r4 = r2 + r3 (r4 transient) r2 <- r4
tmp = inttos(b)
tmp = putint(b)
putstring(tmp)
n = n - 1 # r2 <- 0 ???? #call ok
end #r5 <- r0 - 1 # r0 <- r5

View File

@ -14,7 +14,7 @@ class TestSmallProg < MiniTest::Test
def test_loop
@program.main.instance_eval do
mov :r0, right: 5 #1
mov :r0, 5 #1
start = Vm::Block.new("start")
add_code start
start.instance_eval do
@ -29,10 +29,10 @@ class TestSmallProg < MiniTest::Test
hello = Vm::StringConstant.new "Hello Raisa\n"
@program.add_object hello
@program.main.instance_eval do
mov :r7, right: 4 # 4 == write
mov :r0 , right: 1 # stdout
mov :r7, 4 # 4 == write
mov :r0 , 1 # stdout
add :r1 , hello , nil # address of "hello Raisa"
mov :r2 , right: hello.length
mov :r2 , hello.length
swi 0 , {} #software interupt, ie kernel syscall
end
write(7 + hello.length/4 + 1 , 'hello')