Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Copy-a-string/X86-Assembly/copy-a-string-1.x86
Normal file
20
Task/Copy-a-string/X86-Assembly/copy-a-string-1.x86
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
section .data
|
||||
string db "Hello World", 0
|
||||
|
||||
section .bss
|
||||
string2 resb 12
|
||||
|
||||
section .text
|
||||
global _main
|
||||
_main:
|
||||
mov ecx, 0
|
||||
looping:
|
||||
mov al, [string + ecx]
|
||||
mov [string2 + ecx], al
|
||||
inc ecx
|
||||
cmp al, 0 ;copy until we find the terminating 0
|
||||
je end
|
||||
jmp looping
|
||||
end:
|
||||
xor eax, eax
|
||||
ret
|
||||
22
Task/Copy-a-string/X86-Assembly/copy-a-string-2.x86
Normal file
22
Task/Copy-a-string/X86-Assembly/copy-a-string-2.x86
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
section .data
|
||||
string db 11,"Hello World"
|
||||
|
||||
section .bss
|
||||
string2 resb 12
|
||||
|
||||
section .text
|
||||
global _main
|
||||
_main:
|
||||
xor ecx, ecx ;clear ecx
|
||||
mov cl, [string]
|
||||
mov [string2], cl ;copy byte signaling length
|
||||
mov edx, 1
|
||||
looping: ;copy each single byte
|
||||
mov al, [string + edx]
|
||||
mov [string2 + edx], al
|
||||
inc edx
|
||||
dec ecx
|
||||
cmp ecx, 0
|
||||
jg looping
|
||||
xor eax, eax
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue