diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-11-01 18:25:26 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-11-01 18:25:26 +0100 |
| commit | 1909e97d4615045e707710a2aaeae8bf702a8355 (patch) | |
| tree | acba7fd278ef27dbdb749f936b38a812a056176a /sumac.s | |
| parent | 32d71ef9f25b4cebb2ae95b4f528bbc02f62ea31 (diff) | |
| parent | 970ffb4684dbd88bd54e909820bbc5a66a87b18d (diff) | |
| download | uskel-1909e97d4615045e707710a2aaeae8bf702a8355.tar.gz uskel-1909e97d4615045e707710a2aaeae8bf702a8355.tar.bz2 | |
Merge branch 'gc-attempt-1'
Diffstat (limited to 'sumac.s')
| -rw-r--r-- | sumac.s | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ + + +.include "include/uskel.s" + +.include "include/data.s" +.include "include/io.s" +.include "include/intops.s" + +.primop2 sumac + needs_alloc $0100 + + mov 020(%rbp), %rdi #1st arg + mov 010(%rdi), %rcx #1st arg val + mov 010(%rsi), %rax #2nd arg val + + cmp $0, %rcx + jz sumac_ret + + add %rcx, %rax + dec %rcx + thunkto %r10, $INT_code, %rcx + thunkto %r11, $INT_code, %rax + thunkto %r10, $sumac, $2, %r10, %r11 + primop2_cont_indirect %r10 + + sumac_ret: + primop2_ret_int %rax + +.thunkcode main + needs_alloc $0150 + + thunkto %r11, $INT_code, $10000000 + thunkto %r12, $INT_code, $0 + thunkto %r11, $sumac, $2, %r11, %r12 + + thunkto %r11, $print, $1, %r11 + thunkto %rsi, $main_exit, $0 + enter %r11 + +.include "include/main_exit.s" |
