summaryrefslogtreecommitdiff
path: root/ecomp-c/tests/if_statement.easm
blob: 220660119a71e66bd79f72c85dcd997e2f1cfd38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
format binary
use32
org $1000000
jmp __global_0
; DECL a -> integer, 0
; DECL b -> integer, 0
; DECL c -> integer, 0
__global_0:
; LET a <- 2 
mov eax, 2
push eax
pop eax
mov [a], eax
; LET b <- 1 
mov eax, 1
push eax
pop eax
mov [b], eax
; TEST a b > 
mov eax, [a]
push eax
mov eax, [b]
push eax
pop ebx
pop eax
cmp eax, ebx
ja __global_3
mov eax, 0
jmp __global_4
__global_3: mov eax, 1
__global_4:
push eax
pop eax
mov ebx, 0
cmp eax, ebx
je __global_1
; LET c <- 42 
mov eax, 42
push eax
pop eax
mov [c], eax
jmp __global_2
__global_1:
; LET c <- 0 
mov eax, 0
push eax
pop eax
mov [c], eax
__global_2:
hlt
c: dd $00000000
b: dd $00000000
a: dd $00000000