External include files

This commit is contained in:
2025-10-12 21:29:22 -04:00
parent 33175e2c19
commit 510c21ae4e
4 changed files with 52 additions and 36 deletions

39
functions.asm Normal file
View File

@@ -0,0 +1,39 @@
SYS_EXIT equ 1
SYS_WRITE equ 4
STDOUT equ 1
strlen:
push ebx
mov ebx, eax
nextchar:
cmp byte[eax], 0
jz finished
inc eax
jmp nextchar
finished:
sub eax, ebx
pop ebx
ret
print:
push ebx
push ecx
push edx
mov ebx, eax
call strlen
mov edx, eax
mov ecx, ebx
mov ebx, STDOUT
mov eax, SYS_WRITE
int 0x80
pop edx
pop ecx
pop ebx
ret
quit:
mov ebx, 0
mov eax, SYS_EXIT
int 0x80