zombie-lib/example.asm

66 lines
696 B
NASM
Raw Normal View History

2021-09-26 17:30:13 -04:00
extern puts
extern length_func
2021-09-26 20:58:38 -04:00
extern _case_func
2021-09-26 17:30:13 -04:00
extern diff_func
section .data
2021-09-26 20:58:38 -04:00
text2 db 0,0
text db 0,0,0
2021-09-26 17:30:13 -04:00
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
2021-09-26 20:58:38 -04:00
call _case_func
2021-09-26 17:30:13 -04:00
mov rdi, text
cld
call puts ;this is the puts way of printing a string
2021-09-26 20:58:38 -04:00
mov rdi, text2
cld
call puts
2021-09-26 17:30:13 -04:00
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