diff --git a/src/constants.asm b/src/constants.asm index b0a1a47..fd30701 100644 --- a/src/constants.asm +++ b/src/constants.asm @@ -1 +1,23 @@ section .rodata + ; syscall + NR_read equ 0 + NR_write equ 1 + NR_exit equ 60 + + ; file descriptors + FD_stdin equ 0 + FD_stdout equ 1 + FD_stderr equ 2 + + ; ASCII + EOS equ 0 + TAB equ 9 + NL equ 10 + DQUO equ 34 + + ; Sizes + RBP_OFFSET_CALLER equ 16 + SIZE_QWORD equ 8 + SIZE_DWORD equ 4 + SIZE_WORD equ 2 + SIZE_BYTE equ 1 diff --git a/src/core.asm b/src/core.asm index 2e069bf..a19062f 100644 --- a/src/core.asm +++ b/src/core.asm @@ -1 +1,9 @@ %include "src/constants.asm" + +section .text + global exit + +;----- exit(exit_code) -----; +exit: + mov rax, NR_exit + syscall diff --git a/src/tests.asm b/src/tests.asm index 2e069bf..b9715c4 100644 --- a/src/tests.asm +++ b/src/tests.asm @@ -1 +1,18 @@ %include "src/constants.asm" + +; core.asm +extern exit +; console.asm +; string.asm +; convert.asm + +section .text + global _start +_start: + push rbp + mov rbp, rsp + sub rsp, SIZE_QWORD + + leave + mov rdi, 0 + call exit