zombie-lib/example.asm
2021-10-02 13:33:15 -04:00

65 lines
723 B
NASM

extern puts
extern libz_strlen
extern libz_strcmp
extern libz_tolower
section .data
text2 db "asdasdASDd",0
text db "asdasdasd",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, 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