diff options
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 |
