aboutsummaryrefslogtreecommitdiff
path: root/apply.s
blob: 113122a7a79a2869d5289bf2f90d1c65ad593a52 (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

.include "include/uskel.s"

.include "include/apply.s"
.include "include/intops.s"
.include "include/io.s"
.include "include/main_exit.s"

.thunkcode main
	# make an integer
	thunkto %r11, $INT_code, $1

	# make an empty closure for adding stuff
	thunkto %r12, $FUN2_code, $plus, $0

	# apply first argument
	thunkto %r12, $apply, $2, %r12, %r11

	# apply second argument (the p.a. function part is still in r12)
	thunkto %r12, $apply, $2, %r12, %r11

	# print the result
	thunkto %r12, $print, $1, %r12

	# make a continuation for main (exit) and set it for print call
	thunkto %rsi, $main_exit, $0

	# start evaluating the print
	enter %r12