This repository has been archived on 2025-10-23. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nub-lang-archive/src/runtime/runtime.asm
2025-05-22 19:31:11 +02:00

35 lines
591 B
NASM

global _start
extern main
section .text
_start:
; The args already match our array structure, so we pass the result directly
mov rdi, rsp
call main ; main returns int in rax
; Exit with main's return value
mov rdi, rax ; exit code
mov rax, 60 ; syscall: exit
syscall
global nub_strcmp
nub_strcmp:
xor rdx, rdx
.loop:
mov al, [rsi + rdx]
mov bl, [rdi + rdx]
inc rdx
cmp al, bl
jne .not_equal
cmp al, 0
je .equal
jmp .loop
.not_equal:
mov rax, 0
ret
.equal:
mov rax, 1
ret