diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2023-05-13 23:16:50 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2023-05-13 23:16:50 -0400 |
commit | 4a5751ef9fa7775732d749d6d9688131f2aaa199 (patch) | |
tree | 010e854a04e6c31372469e81503d59a1c7d3e863 /tnslc/c_wrap.tnsl | |
parent | e458ba03aab8a2eeac50bb133a6ad4847c0e79a5 (diff) |
Partially fix calls
Diffstat (limited to 'tnslc/c_wrap.tnsl')
-rw-r--r-- | tnslc/c_wrap.tnsl | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/tnslc/c_wrap.tnsl b/tnslc/c_wrap.tnsl index 7348417..9c0faf6 100644 --- a/tnslc/c_wrap.tnsl +++ b/tnslc/c_wrap.tnsl @@ -1,14 +1,15 @@ asm "extern malloc" asm "extern realloc" asm "extern free" +asm "extern printf" /; _alloc (uint size) [~void] ~void out # Mov size into proper register, and set all extras to zero - asm "mov rdi, rax" - asm "mov rsi, 0" + asm "mov rcx, rax" asm "mov rdx, 0" - asm "mov rcx, 0" + asm "mov rdi, 0" + asm "mov rsi, 0" asm "mov r8, 0" asm "mov r9, 0" asm "mov r10, 0" @@ -22,10 +23,10 @@ asm "extern free" /; _realloc (~void ptr, uint new_size) [~void] ~void out # Mov ptr and new size into proper registers, and set all extras to zero - asm "mov rdi, rax" - asm "mov rsi, rbx" - asm "mov rdx, 0" - asm "mov rcx, 0" + asm "mov rcx, rax" + asm "mov rdx, rbx" + asm "mov rdi, 0" + asm "mov rsi, 0" asm "mov r8, 0" asm "mov r9, 0" asm "mov r10, 0" @@ -39,10 +40,10 @@ asm "extern free" /; _delete (~void ptr) # setup call by clearing most values - asm "mov rdi, rax" - asm "mov rsi, 0" + asm "mov rcx, rax" asm "mov rdx, 0" - asm "mov rcx, 0" + asm "mov rdi, 0" + asm "mov rsi, 0" asm "mov r8, 0" asm "mov r9, 0" asm "mov r10, 0" @@ -51,6 +52,20 @@ asm "extern free" # there's no more to do 'cause free returns nothing ;/ +/; _printf (~void str) + # setup call by clearing most values + asm "mov rcx, rax" + asm "mov rdx, 0" + asm "mov rdi, 0" + asm "mov rsi, 0" + asm "mov r8, 0" + asm "mov r9, 0" + asm "mov r10, 0" + # do call + asm "call printf" + # there's no more to do 'cause free returns nothing +;/ + struct Vector { uint el_size, |