在x86-64汇编算法中进行冒泡排序?

问题描述

我不熟悉汇编,正在尝试在64位体系结构上使用SASM编写冒泡排序算法。这是我目前为止(不完整)的情况,但是感觉我可能走错了方向,因此非常感谢您的帮助!

    %include "io64.inc"
section .data
a dw 14,10,23,45,17,9,54,22,1,76   ;array of values
size dw 10                                  ;length of array

section .text
global CMAIN
CMAIN:
        mov rbp,rsp; for correct debugging
        ;write your code here
        mov rdx,[size]     ;size for outer loop count
        xor ecx,ecx        ;counter
        lea r8,[a]         
    
for:    cmp rcx,rdx        ;comparison to zero
        je  end_for         ;jump out if array end is reached
        mov rax,[r8+rcx*2] ;a[0]
        
end_for:        
        xor rax,rax
        retenter code here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)