From 217f4b1ab43b9fda34512261659d368e6c682b8d Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sun, 26 Mar 2023 16:08:16 -0400 Subject: Initual function calling --- tnslc/simple.tnsl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'tnslc/simple.tnsl') diff --git a/tnslc/simple.tnsl b/tnslc/simple.tnsl index d996c1b..9e0f700 100644 --- a/tnslc/simple.tnsl +++ b/tnslc/simple.tnsl @@ -11,8 +11,8 @@ struct Test { int i, j, k } -/; call_me [int] - return 4 +/; call_me (int i) [int] + return i + 1 ;/ /; main (int argc, ~~uint argv) [int] @@ -20,17 +20,23 @@ struct Test { # update their positions here or else tnsl will have garbage values in r8 and r9 asm "mov r8, rcx" asm "mov r9, rdx" + # If on linux, you would use rdi and rsi instead of rcx and rdx, respectively + # simply comment out the bove asm, and uncomment the below lines + # asm "mov r8, rdi" + # asm "mov r9, rsi" + Test m - ~int i = ~m.i - i{1} = 3 + ~int j = ~m.i + ~~int i = ~j + i{0}{1} = 3 /; if (argc > 8) argc = 90 ;/ - - call_me() - # return the number of arguments + m.j = call_me(m.j) + + # return 3 return m.j ;/ -- cgit v1.2.3