Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Frequency_of_an_element_from_an_array
;nasm 2.11.08 section .text global _start _start: call print_array mov esi,9 ; outer loop controller outer_loop: mov edi,0 ; inner loop controller inner_loop: mov ebx, arr ; base index add ebx, edi ; index of edi mov ecx, ebx inc ecx ; index of edi+1 mov al, [ebx] ; first value mov dl, [ecx] ; second value cmp al,dl jle after_swap ; here swap is done... mov [ebx], dl mov [ecx], al after_swap: inc edi cmp edi,esi jne inner_loop ;inner loop ends... dec esi cmp esi,0 jne outer_loop ;outer_loop ends call print_array exit: mov eax,1 int 0x80 print_array: mov esi,0 print_loop: mov edi,arr add edi,esi mov edx,1 mov ecx,edi mov ebx, 1 mov eax, 4 int 0x80 mov edx,1 mov ecx,space mov ebx, 1 mov eax, 4 int 0x80 inc si cmp si,10 jne print_loop mov edx,2 mov ecx,line mov ebx, 1 mov eax, 4 int 0x80 ret section .data arr db 0,0,0,0,0,0,0,0,0,0 line db 0xa,0xd space db ' ' section .bss x: resb 2 y: resb 2 arrlen: resb 2
run
|
edit
|
history
|
help
0
pushpop.asm
helloLab
fib.asm
FirstProgramLab
FirstProgram
Positive And Negative Count In Array
dfsfsafsdfds
intmain2
helloworldgroup1
dynstrlen