diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-08-11 22:30:22 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-08-11 22:30:22 +0200 |
| commit | 5184299c7dfddeba4d2d2ba95d390040368f9736 (patch) | |
| tree | e3debfdc11073435a5459266d6dcec61b1fc30b1 /apply.s | |
| parent | 74cad993376dc269e8389fbf150be9ecc36890c7 (diff) | |
| download | uskel-5184299c7dfddeba4d2d2ba95d390040368f9736.tar.gz uskel-5184299c7dfddeba4d2d2ba95d390040368f9736.tar.bz2 | |
ap aps
Diffstat (limited to 'apply.s')
| -rw-r--r-- | apply.s | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -0,0 +1,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 |
