made the function names for "C" like

This commit is contained in:
zombie maniac 2021-09-27 16:40:27 -04:00
parent 176cb33c18
commit 8960a62da9
5 changed files with 17 additions and 19 deletions

View file

@ -18,6 +18,6 @@ add_compile_options(-g)
add_link_options(-fno-pie -m64 -no-pie -pedantic-errors) add_link_options(-fno-pie -m64 -no-pie -pedantic-errors)
#Make a EXE with cpp and asm files #Make a EXE with cpp and asm files
add_library(z case.asm diff.asm length.asm) add_library(z tolower.asm strlen.asm strcmp.asm)
add_executable(example example.asm) add_executable(example example.asm)
target_link_libraries(example z) target_link_libraries(example z)

View file

@ -1,11 +1,11 @@
extern puts extern puts
extern length_func extern libz_strlen
extern _case_func extern libz_strcmp
extern diff_func extern libz_tolower
section .data section .data
text2 db 0,0 text2 db "asdasdASDd",0
text db 0,0,0 text db "asdasdasd",0
stoer db "0",0 stoer db "0",0
@ -18,7 +18,7 @@ main:
sub rsp, 8 ;enter sub rsp, 8 ;enter
mov rdi, text mov rdi, text
call _case_func call libz_tolower
mov rdi, text mov rdi, text
cld cld
@ -33,7 +33,7 @@ main:
mov rdi, text2 mov rdi, text2
call length_func call libz_strlen
add [stoer], rax add [stoer], rax
@ -43,7 +43,7 @@ main:
mov rdi, text mov rdi, text
mov rsi, text2 mov rsi, text2
call diff_func call libz_strcmp
cmp rax, 1 cmp rax, 1
je _differ je _differ
jmp _notdiffer jmp _notdiffer

View file

@ -1,7 +1,7 @@
global diff_func global libz_strcmp
section .text section .text
diff_func: libz_strcmp:
sub rsp, 8 ;enter sub rsp, 8 ;enter
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before) xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)

View file

@ -1,9 +1,7 @@
global length_func global libz_strlen
section .data
testasd dq 0
section .text section .text
length_func: libz_strlen:
sub rsp, 8 ;enter sub rsp, 8 ;enter
mov r10, rdi mov r10, rdi

View file

@ -1,14 +1,14 @@
extern length_func extern libz_strlen
global _case_func global libz_tolower
section .text section .text
_case_func: libz_tolower:
sub rsp, 8 ;enter sub rsp, 8 ;enter
mov r11, rdi mov r11, rdi
call length_func call libz_strlen
mov r10, rax mov r10, rax