Permalink
Browse files

Merge pull request #139 from martinolsen/m0-prototype

add test for xor from mro++
  • Loading branch information...
2 parents 57ad086 + 5e0a584 commit b226909c899336ad2f357ea2b1c6762e28d53bb4 @cotto cotto committed Jul 9, 2011
Showing with 37 additions and 0 deletions.
  1. +37 −0 t/m0/integration/m0_xor.m0
View
37 t/m0/integration/m0_xor.m0
@@ -0,0 +1,37 @@
+.version 0
+.chunk "noop"
+.constants
+0 "1..1\n"
+1 "n\n"
+2 "ok 1 xor: 9 xor 90 = 83\n"
+.metadata
+.bytecode
+
+ set_imm S0, 0, 0
+ deref S0, CONSTS, S0
+ set_imm I0, 0, 1
+ print_s I0, S0, x
+
+ set_imm I1, 0, 9
+ set_imm I2, 0, 90
+ xor I2, I2, I1
+ set_imm I3, 0, 83
+ sub_i I3, I3, I2
+
+ goto_if xor_nok, I3
+ goto xor_ok, x
+
+xor_ok:
+ set_imm S0, 0, 2
+ deref S0, CONSTS, S0
+ print_s I0, S0, x
+ exit 0, x, x
+
+xor_nok:
+ set_imm S0, 0, 1
+ deref S0, CONSTS, S0
+ print_s I0, S0, x
+ exit 1, x, x
+
+# This code isn't really PASM, but the highlighting works well.
+# vim: expandtab shiftwidth=4 ft=pasm:

0 comments on commit b226909

Please sign in to comment.