blob: 21a1efcf1a6a3b930e2de53b0049ec657a81b4b4 (
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
|
.include "include/uskel.s"
.include "include/apply.s"
.include "include/intops.s"
.include "include/io.s"
.include "include/main_exit.s"
main:
# make an integer
pushq $1
pushq $INT_code
mov %rsp, %r11
# make a closure for adding stuff
pushq $0
pushq $plus
pushq $FUN2_code
mov %rsp, %r12
# apply first argument
push %r11
push %r12
pushq $2
pushq $apply1
mov %rsp, %r12
# apply second argument (the p.a. function part is still in r12)
push %r11
push %r12
pushq $2
pushq $apply1
mov %rsp, %r12
# print the result
push %r12
pushq $1
pushq $print
mov %rsp, %r12
# make the continuation for main (exit)
push %rsi
pushq $1
pushq $main_exit
mov %rsp, %rsi
enter %r12
|