diff options
Diffstat (limited to 'src/test_if.tpc')
-rw-r--r-- | src/test_if.tpc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test_if.tpc b/src/test_if.tpc new file mode 100644 index 0000000..356061f --- /dev/null +++ b/src/test_if.tpc | |||
@@ -0,0 +1,43 @@ | |||
1 | extern printf | ||
2 | section .data | ||
3 | format_int db "%d",10,0 | ||
4 | |||
5 | section .bss | ||
6 | section .text | ||
7 | |||
8 | global _start | ||
9 | print: ;print needs an argument in rax | ||
10 | push rbp | ||
11 | mov rbp, rsp | ||
12 | push rsi | ||
13 | mov rsi, rax | ||
14 | mov rdi, format_int | ||
15 | mov rax, 0 | ||
16 | call printf WRT ..plt | ||
17 | pop rsi | ||
18 | pop rbp | ||
19 | ret | ||
20 | |||
21 | _start: | ||
22 | push rbp | ||
23 | mov rbp, rsp | ||
24 | |||
25 | push 0 | ||
26 | push 1 | ||
27 | pop QWORD [rbp - 0] ;bool | ||
28 | push QWORD [rbp - 0] ;bool | ||
29 | pop rax | ||
30 | cmp rax,0 | ||
31 | jz .end_if0 | ||
32 | push QWORD [rbp - 0] ;bool | ||
33 | pop rax | ||
34 | call print | ||
35 | .end_if0 | ||
36 | mov rax,60 | ||
37 | mov rdi,0 | ||
38 | syscall | ||
39 | ;global table | ||
40 | |||
41 | ;local table | ||
42 | ;entier: bool, pos: 0 | ||
43 | |||