updated copyright notice to include 2014
[voodoo-lang.git] / test / at.voo
blob2a3ad21c49e603f0962f72d55a948af92c77ca3d
1 #### Test case for at-expressions
3 section data
4 p:
5 word 12
7 q:
8 word r
11 word 42
13 array:
14 word 1
15 word 2
16 word 3
18 array_ptr:
19 word array
21 str:
22 string "xyzzy"
24 str_ptr:
25 word str
27 format:
28 string "%d\n\x00"
30 char_format:
31 string "%c\n\x00"
33 section functions
34 import printf
35 export main
37 main:
38 function argc argv
39     let x @q
40     call printf format @p
41     call printf format @x
43     set x get-word @array_ptr 1
44     call printf format x
46     set-word @array_ptr 2 4
47     set x get-word @array_ptr 2
48     call printf format x
50     set x get-byte @str_ptr 4
51     call printf char_format x
53     set-byte @str_ptr 1 65
54     set x get-byte @str_ptr 1
55     call printf char_format x
57     set @p -9
58     call printf format @p
60     set @r @p
61     call printf format @r
63     set @r get-word @array_ptr 0
64     call printf format @r
66     set @r get-word @array_ptr @array
67     call printf format @r
69     set @p 2
70     set @r 0
71     set-word @array_ptr @p @r
72     set @p get-word array 2
73     call printf format @p
75     return 0
76 end function