diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2023-03-24 19:10:30 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2023-03-24 19:10:30 -0400 |
commit | 72fa7d598bfe67e9a12c695648243f031f5e1aaf (patch) | |
tree | 11a91e9da0d83b80078448c424cd77d9511adeb9 /tnslc/simple.tnsl | |
parent | 5e0d74b70b15d63993539c07905e0a9ba8117b5b (diff) |
Parse input parameters
Diffstat (limited to 'tnslc/simple.tnsl')
-rw-r--r-- | tnslc/simple.tnsl | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tnslc/simple.tnsl b/tnslc/simple.tnsl index b140c7a..d871e92 100644 --- a/tnslc/simple.tnsl +++ b/tnslc/simple.tnsl @@ -1,15 +1,18 @@ {}uint8 str1 = "abcd" -{}uint8 str2 = "abce" - -/; main [int] - /; loop (int i = 0; i < 4) [i++] - /; if (str1{i} !== str2{i}) - /; if (str2{i} == 'e') - return 3 - ;/ - return 1 - ;/ - ;/ - return 0 +{}uint8 str2 = "abcd" + +/; call_me [int] + return 4 +;/ + +/; main (int argc, ~~uint argv) [int] + # On windows, the first two arguments are passed in RCX and RDX, so we need to + # update their positions here or else tnsl willhave 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 + + # return the number of arguments + return argc ;/ |