Add small constants set, exit() and tests entry/exit

This commit is contained in:
2025-07-05 01:33:33 +02:00
parent e12b8f0365
commit 3b275a6166
3 changed files with 47 additions and 0 deletions

View File

@@ -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

View File

@@ -1 +1,9 @@
%include "src/constants.asm"
section .text
global exit
;----- exit(exit_code) -----;
exit:
mov rax, NR_exit
syscall

View File

@@ -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