This commit is contained in:
Thomas Muller 2021-10-02 13:33:46 -04:00
parent 415651cd0e
commit e6d0d6aebc
Signed by untrusted user: thomas
GPG key ID: AF006EB730564952
9 changed files with 20 additions and 107 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "lib/zombie-lib"]
path = lib/zombie-lib
url = ssh://git@play.qtechofficial.com:9940/ZNG_Zombie-Not-GNU/zombie-lib.git

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.14)
project (yes)
project (zombie-core-utils)
#set(CMAKE_ASM_NASM_LINK_EXECUTABLE ld)
@ -13,6 +13,7 @@ set(CMAKE_ASM_NASM_LINK_EXECUTABLE "gcc <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS>
add_compile_options(-g)
add_subdirectory(lib/zombie-lib)
add_link_options(-fno-pie -m64 -no-pie -pedantic-errors)
@ -21,4 +22,8 @@ add_executable(length length.asm)
add_executable(yes yes.asm)
add_executable(case case.asm)
add_executable(diff diff.asm)
add_executable(arg arg.asm)
# add_executable(arg arg.asm)
target_link_libraries(length z)
target_link_libraries(case z)
target_link_libraries(diff z)

View file

@ -1,6 +1,5 @@
extern puts
%include "../inc/case_func.inc"
global case_func
extern libz_tolower
section .data
@ -23,7 +22,7 @@ main:
mov rdi, [tempstore]
call case_func ;case_func modifies the text you send it
call libz_tolower ;libz_tolower modifies the text you send it
mov rdi, [tempstore]
cld

View file

@ -1,6 +1,5 @@
extern puts
%include "../inc/diff_func.inc"
extern libz_strcmp
section .data
tempstore db 0
@ -28,12 +27,12 @@ main:
mov rdi, [tempstore]
mov rsi, [tempstore2]
call diff_func
call libz_strcmp
cmp r10b, 1 ;why tf did i make ut r10b as the return like tf?!?!?!?
jz _notdiffer
_differ:
mov rdi, differ
cld
@ -48,10 +47,10 @@ _notdiffer:
_end:
add rsp, 8 ;exit
ret
_argument_error:
mov rdi, argument_error
cld
call puts
jmp _end

View file

@ -1,33 +0,0 @@
%include "../inc/length_func.inc"
case_func:
mov r11, rdi
;length_funcx accepts r8
call length_func
mov r10, rax
xor rcx, rcx ;we do this to clear rcx incase it had garbage in it before
_loop:
;do loop things
mov r9, r11
add r9, rcx
mov r8b, [r9] ;this block here makes sure that our character is a capital letter and if its not a capital letter do nothing and return
cmp r8b, 90
ja _endloop
cmp r8b, 65
jb _endloop
add r8b, 32 ;make the letter capital
mov [r9], r8b
_endloop:
;end loop
inc rcx
cmp rcx, r10
jle _loop
ret

View file

@ -1,42 +0,0 @@
diff_func:
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)
mov r8, rdi
mov r9, rsi
_loopwasp12bsharknado:
;loop tings
mov rdi, r8
mov rsi, r9
add rdi, rcx
add rsi, rcx
mov r10b, [rdi]
mov r11b, [rsi]
cmp r10b, r11b
jne _differiwikeassembwy
cmp r10b, 0
je _notdifferiwikeassembwy
cmp r11b, 0
je _notdifferiwikeassembwy
inc rcx
jmp _loopwasp12bsharknado
_differiwikeassembwy:
mov r10b, 1
jmp _end123432345
_notdifferiwikeassembwy:
mov r10b, 0
_end123432345:
ret

View file

@ -1,17 +0,0 @@
length_func:
mov r10, rdi
_loop67865432:
mov r9b, [rdi]
cmp r9b, 0
jz _exitloop4323567
inc rdi
jmp _loop67865432
_exitloop4323567:
sub rdi, r10
mov rax, rdi
ret

View file

@ -1,9 +1,7 @@
extern puts
extern printf
extern libz_strlen
default rel
%include "../inc/length_func.inc"
section .rodata
@ -30,7 +28,7 @@ main:
mov rdi, [tempstore]
call length_func
call libz_strlen
mov [testasd], rax

1
lib/zombie-lib Submodule

@ -0,0 +1 @@
Subproject commit b5e1d53f010a65710144608018bd0274315988a5