made the function names for "C" like
This commit is contained in:
parent
176cb33c18
commit
8960a62da9
5 changed files with 17 additions and 19 deletions
|
@ -18,6 +18,6 @@ add_compile_options(-g)
|
|||
add_link_options(-fno-pie -m64 -no-pie -pedantic-errors)
|
||||
|
||||
#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)
|
||||
target_link_libraries(example z)
|
||||
|
|
16
example.asm
16
example.asm
|
@ -1,11 +1,11 @@
|
|||
extern puts
|
||||
extern length_func
|
||||
extern _case_func
|
||||
extern diff_func
|
||||
extern libz_strlen
|
||||
extern libz_strcmp
|
||||
extern libz_tolower
|
||||
|
||||
section .data
|
||||
text2 db 0,0
|
||||
text db 0,0,0
|
||||
text2 db "asdasdASDd",0
|
||||
text db "asdasdasd",0
|
||||
|
||||
|
||||
stoer db "0",0
|
||||
|
@ -18,7 +18,7 @@ main:
|
|||
sub rsp, 8 ;enter
|
||||
|
||||
mov rdi, text
|
||||
call _case_func
|
||||
call libz_tolower
|
||||
|
||||
mov rdi, text
|
||||
cld
|
||||
|
@ -33,7 +33,7 @@ main:
|
|||
|
||||
|
||||
mov rdi, text2
|
||||
call length_func
|
||||
call libz_strlen
|
||||
|
||||
add [stoer], rax
|
||||
|
||||
|
@ -43,7 +43,7 @@ main:
|
|||
|
||||
mov rdi, text
|
||||
mov rsi, text2
|
||||
call diff_func
|
||||
call libz_strcmp
|
||||
cmp rax, 1
|
||||
je _differ
|
||||
jmp _notdiffer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
global diff_func
|
||||
global libz_strcmp
|
||||
section .text
|
||||
|
||||
diff_func:
|
||||
libz_strcmp:
|
||||
sub rsp, 8 ;enter
|
||||
|
||||
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)
|
|
@ -1,9 +1,7 @@
|
|||
global length_func
|
||||
section .data
|
||||
testasd dq 0
|
||||
global libz_strlen
|
||||
section .text
|
||||
|
||||
length_func:
|
||||
libz_strlen:
|
||||
sub rsp, 8 ;enter
|
||||
|
||||
mov r10, rdi
|
|
@ -1,14 +1,14 @@
|
|||
extern length_func
|
||||
extern libz_strlen
|
||||
|
||||
global _case_func
|
||||
global libz_tolower
|
||||
section .text
|
||||
|
||||
_case_func:
|
||||
libz_tolower:
|
||||
sub rsp, 8 ;enter
|
||||
|
||||
mov r11, rdi
|
||||
|
||||
call length_func
|
||||
call libz_strlen
|
||||
mov r10, rax
|
||||
|
||||
|
Loading…
Reference in a new issue