aboutsummaryrefslogtreecommitdiff
path: root/print_123.s
blob: 612b4c8e98e9259a96cf0b8f1e46a975353b5e72 (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

.include "include/uskel.s"

.include "include/data.s"
.include "include/io.s"
.include "include/intops.s"

# || -> cont
.thunkcode main
	# push a new integer
	pushq $100
	pushq $INT_code
	mov %rsp, %r11 # backup first arg

	# push another new integer
	pushq $23
	pushq $INT_code
	mov %rsp, %r12 # backup second arg

	# push the plus
	push %r12
	push %r11
	pushq $2
	pushq $plus
	mov %rsp, %r11 # backup plus

	# push the print
	push %r11
	pushq $1
	pushq $print
	mov %rsp, %r11 # backup print

	# push a cont thunk for main_exit
	push %rsi
	pushq $1
	pushq $main_exit

	# evaluate into main_exit
	mov %rsp, %rsi
	enter %r11

.include "include/main_exit.s"