Compare commits
No commits in common. "4ae491bdb5b482a7536eeca5232139d1071dcc25" and "1ffb79454bfe3c1c542ca958681cb9a74ac7fa4a" have entirely different histories.
4ae491bdb5
...
1ffb79454b
3 changed files with 0 additions and 114 deletions
|
@ -21,4 +21,3 @@ add_executable(length length.asm)
|
||||||
add_executable(yes yes.asm)
|
add_executable(yes yes.asm)
|
||||||
add_executable(case case.asm)
|
add_executable(case case.asm)
|
||||||
add_executable(diff diff.asm)
|
add_executable(diff diff.asm)
|
||||||
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
extern puts
|
|
||||||
|
|
||||||
|
|
||||||
section .data
|
|
||||||
text db "####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10,"####################################################################################################",10
|
|
||||||
store dq 0
|
|
||||||
section .text
|
|
||||||
global main
|
|
||||||
|
|
||||||
main:
|
|
||||||
sub rsp, 8 ;enter
|
|
||||||
|
|
||||||
_setup:
|
|
||||||
xor r8, r8
|
|
||||||
mov r8, text
|
|
||||||
|
|
||||||
mov qword [store], text
|
|
||||||
|
|
||||||
mov r9, [store]
|
|
||||||
|
|
||||||
|
|
||||||
mov rdi, text
|
|
||||||
cld
|
|
||||||
call puts
|
|
||||||
|
|
||||||
_end:
|
|
||||||
add rsp, 8 ;exit
|
|
||||||
ret
|
|
|
@ -1,85 +0,0 @@
|
||||||
extern puts
|
|
||||||
|
|
||||||
%include "../inc/length_func.inc"
|
|
||||||
|
|
||||||
section .data
|
|
||||||
text db "42",0
|
|
||||||
section .text
|
|
||||||
global main
|
|
||||||
|
|
||||||
main:
|
|
||||||
sub rsp, 8
|
|
||||||
|
|
||||||
|
|
||||||
mov r8, text
|
|
||||||
call length_func
|
|
||||||
mov r9, rax
|
|
||||||
mov r11, r9
|
|
||||||
|
|
||||||
mov r8, text
|
|
||||||
_loop:
|
|
||||||
mov r10b, [r8]
|
|
||||||
cmp r10b, 0
|
|
||||||
jz _exitloop ;if its zero we have reached the end of the string
|
|
||||||
|
|
||||||
|
|
||||||
mov r10b, [r8]
|
|
||||||
sub r10b, 48 ; change "0" into 0
|
|
||||||
mov [r8], r10b
|
|
||||||
|
|
||||||
|
|
||||||
add r8, 1
|
|
||||||
jmp _loop
|
|
||||||
|
|
||||||
|
|
||||||
xor rcx, rcx
|
|
||||||
add rcx, 1
|
|
||||||
_exitloop:
|
|
||||||
cmp r9, r8
|
|
||||||
je _addvalues
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mov r10b [r9]
|
|
||||||
mul r10b, rcx
|
|
||||||
mov [r9], r10b
|
|
||||||
|
|
||||||
sub r9, 1
|
|
||||||
mul rcx, 10
|
|
||||||
|
|
||||||
jmp _exitloop
|
|
||||||
|
|
||||||
add r9, 1
|
|
||||||
_addvalues:
|
|
||||||
cmp r9, r11
|
|
||||||
je _end
|
|
||||||
|
|
||||||
|
|
||||||
mov r10b, [r8]
|
|
||||||
mov r11b, [r9]
|
|
||||||
add r11b, r10b
|
|
||||||
mov [r9], r11b
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add r8, 1
|
|
||||||
add r9, 1
|
|
||||||
|
|
||||||
jmp _addvalues
|
|
||||||
;this returns the r8 pointer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;mov rdi, text
|
|
||||||
;cld
|
|
||||||
;call puts ;this is the put s way of printing a string
|
|
||||||
|
|
||||||
_end:
|
|
||||||
add rsp, 8
|
|
||||||
ret
|
|
||||||
|
|
||||||
; mov rax, 60 ; exit
|
|
||||||
; mov edi, 1 ; error 1 dont need the exit anymore beacue libc or somthing
|
|
||||||
; syscall
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue