This repository has been archived on 2025-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nub-lang-archive-2/std/core/itoa.asm
2025-05-03 16:55:06 +02:00

24 lines
262 B
NASM

section .bss
buffer resb 20
section .text
global itoa
itoa:
mov rax, rdi
mov rsi, buffer + 19
mov byte [rsi], 0
dec rsi
.loop:
xor rdx, rdx
mov rcx, 10
div rcx
add dl, '0'
mov [rsi], dl
dec rsi
test rax, rax
jnz .loop
inc rsi
mov rax, rsi
ret