diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-17 18:14:42 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-17 18:14:42 +0200 |
commit | 9f46f4559625d62bd8d289e9ac75dc6369d7e7ed (patch) | |
tree | 4342a73e97ba98504a806645aea81de1336b862d /asm/jo_c_args.asm | |
parent | Starting the main program, bus error somehow (diff) | |
download | lowbat-bsd-9f46f4559625d62bd8d289e9ac75dc6369d7e7ed.tar.gz lowbat-bsd-9f46f4559625d62bd8d289e9ac75dc6369d7e7ed.tar.bz2 lowbat-bsd-9f46f4559625d62bd8d289e9ac75dc6369d7e7ed.tar.xz lowbat-bsd-9f46f4559625d62bd8d289e9ac75dc6369d7e7ed.tar.zst lowbat-bsd-9f46f4559625d62bd8d289e9ac75dc6369d7e7ed.zip |
Still bus error, it's not willing to print
Diffstat (limited to 'asm/jo_c_args.asm')
-rw-r--r-- | asm/jo_c_args.asm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/asm/jo_c_args.asm b/asm/jo_c_args.asm new file mode 100644 index 0000000..47a2032 --- /dev/null +++ b/asm/jo_c_args.asm @@ -0,0 +1,39 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; File : jo_c_args.asm /_________/ ;; +;; Author : Joe | ;; +;; Date : 04/2020 | ;; +;; Info : Check args | ;; +;; / | ;; +;; \ / ;; +;; \_____/ ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +section .text + extern strncmp + global jo_c_args + +jo_c_args: ; jo_c_args(argc: rdi, *argv[]: rdi) + cmp rdi, 0x2 + jle no_args + push rdi + mov rdi, [rsi + 4 * 0] + push rsi + mov rsi, reference + mov rdx, len + call strncmp + pop rsi + pop rdi + cmp rax, 0x0 + jne no_args + mov rax, [rsi + 4 * 0] + retq + +no_args: + xor rax, rax + retq + +section .data + reference: db "--say", 0x0 + len: equ $ - reference ; reference len |