zombie-lib/example.asm
2021-09-26 20:58:38 -04:00

65 lines
696 B
NASM

extern puts
extern length_func
extern _case_func
extern diff_func
section .data
text2 db 0,0
text db 0,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 _case_func
mov rdi, text
cld
call puts ;this is the puts way of printing a string
mov rdi, text2
cld
call puts
mov rdi, text2
call length_func
add [stoer], rax
mov rdi, stoer
cld
call puts
mov rdi, text
mov rsi, text2
call diff_func
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