zombie-lib/example.asm
zombie bba6630833 i (hopefully) made atoi return 0 if its not a number
@quantum fix
i should probably make it more complient with the spec
2021-11-21 03:21:48 -05:00

74 lines
864 B
NASM

extern puts
extern libz_strlen
extern libz_strcmp
extern libz_tolower
extern libz_atoi
section .data
text2 db "asdasdASDd",0
text db "asdasdasd",0
text3 dq "5",0
textstore dq 0,0
stoer db "0",0
differ db "they differ",0
notdiffer db "they dont differ",0
section .text
global main
main:
sub rsp, 8 ;enter
mov rdi, text
call libz_tolower
mov rdi, text
cld
call puts ;this is the puts way of printing a string
mov rdi, text2
cld
call puts
mov rdi, text3
call libz_atoi
mov [textstore], rax
mov rdi, textstore
cld
call puts
mov rdi, text2
call libz_strlen
add [stoer], rax
mov rdi, stoer
cld
call puts
mov rdi, text
mov rsi, text2
call libz_strcmp
cmp rax, 1
je _differ
jmp _notdiffer
_differ:
mov rdi, differ
cld
call puts
jmp _end
_notdiffer:
mov rdi, notdiffer
cld
call puts
_end:
add rsp, 8 ;exit
ret