Compare commits
3 commits
8d54648b3e
...
015f460d7f
Author | SHA1 | Date | |
---|---|---|---|
015f460d7f | |||
67363c7013 | |||
34e6f127b5 |
4 changed files with 41 additions and 53 deletions
|
@ -1,5 +1,10 @@
|
||||||
# zombie-core-utils
|
# zombie-core-utils
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
```bash
|
||||||
|
yay -S nasm
|
||||||
|
```
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
32
case.asm
32
case.asm
|
@ -1,43 +1,17 @@
|
||||||
extern puts
|
extern puts
|
||||||
|
|
||||||
%include "../inc/length_func.inc"
|
%include "../inc/case_func.inc"
|
||||||
|
|
||||||
section .data
|
section .data
|
||||||
text db "rEEEeee!EEeeeEeEEeE!EEEEEeEEE$eeeEE)EEeEeEEeeeEeEEEEEeeeEeeEeeEeeeeeEeEeEeeE",0
|
text db "rEEEeee!EEeeeEeEEeE!EEEEEeEEE$eeeEE)EEeEeEEeeeEeEEEEEeeeEeeEeeEeeeeeEeEeEeeE",0
|
||||||
textlength db 0
|
|
||||||
section .text
|
section .text
|
||||||
global main
|
global main
|
||||||
|
|
||||||
main:
|
main:
|
||||||
sub rsp, 8 ;enter
|
sub rsp, 8 ;enter
|
||||||
|
|
||||||
mov r8, text ;get textlength
|
mov r8, text
|
||||||
call length_func
|
call case_func
|
||||||
mov [textlength], rax
|
|
||||||
|
|
||||||
|
|
||||||
xor rcx, rcx ;we do this to clear rcx incase it had garbage in it before
|
|
||||||
_loop:
|
|
||||||
;do loop things
|
|
||||||
|
|
||||||
mov r9, text
|
|
||||||
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, [textlength]
|
|
||||||
jle _loop
|
|
||||||
|
|
||||||
|
|
||||||
mov rdi, text
|
mov rdi, text
|
||||||
cld
|
cld
|
||||||
|
|
24
diff.asm
24
diff.asm
|
@ -1,9 +1,4 @@
|
||||||
extern puts
|
extern puts
|
||||||
%include "../inc/length_func.inc"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
section .data
|
section .data
|
||||||
text db "REEEEEEEEEE",0
|
text db "REEEEEEEEEE",0
|
||||||
|
@ -19,25 +14,6 @@ main:
|
||||||
sub rsp, 8 ;enter
|
sub rsp, 8 ;enter
|
||||||
|
|
||||||
|
|
||||||
;below we are getting the length of each string
|
|
||||||
;we do this because we dont want to compare with memory that isnt ours
|
|
||||||
|
|
||||||
mov r8, text
|
|
||||||
call length_func
|
|
||||||
mov [textlength], rax
|
|
||||||
|
|
||||||
mov r8, text2
|
|
||||||
call length_func
|
|
||||||
mov [text2length], rax
|
|
||||||
|
|
||||||
mov r8, [textlength]
|
|
||||||
mov r9, [text2length]
|
|
||||||
|
|
||||||
cmp r8, r9
|
|
||||||
jne _differ
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
_loop:
|
_loop:
|
||||||
;loop tings
|
;loop tings
|
||||||
|
|
33
inc/case_func.inc
Normal file
33
inc/case_func.inc
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
%include "../inc/length_func.inc"
|
||||||
|
|
||||||
|
case_func:
|
||||||
|
mov r11, r8
|
||||||
|
|
||||||
|
;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
|
Loading…
Reference in a new issue