第乙個ARM匯程式設計序 氣泡排序

2021-06-02 02:29:00 字數 1264 閱讀 2144

area sort,code,readonly		;declare for code area

entry ;entry for the whole code

start ;main code flag

mov r4,#0 ;clear r4

ldr r6,=src ;r6 point to the begining of numbers

add r6,r6,#len ;r6 point to the end of numbers

outer ;outer loop begining

ldr r1,=src ;r1 point to the begining of numbers

inner ;inner loop begining

ldr r2,[r1] ;get the number in address of r1

ldr r3,[r1,#4] ;get the number in address next to r1

cmp r2,r3 ;compare two numbers we gotten

strgt r3,[r1] ;if the first > the second

strgt r2,[r1,#4] ;exchange the position of two numbers

add r1,r1,#4 ;the point of r1 move

cmp r1,r6 ;compare position current and ending

blt inner ;if not meet the ending go on to loop

add r4,r4,#4 ;global counter +1

cmp r4,#len ;compare the current position

suble r6,r6,#4 ;if not meet the ending

ble outer ;go on to loop

area array,data,readwrite ;decare for data area

src dcd 2,4,10,8,14,1,20 ;init the original numbers

len equ 7*4 ;get the length of numbers

end ;end of whole code

第乙個匯程式設計序hello world

程式原始碼如下 assume cs code,ds data 定義 段和資料段框架 data segment 資料段 msg db hello world 定義字串 data ends code segment 段 start mov ax,data mov ds,ax 資料段初始化 mov bx,...

01 第乙個匯程式設計序

在閱讀 x86組合語言 從實模式到保護模式 這本書的時候,從b站上看到 教程,使用虛擬機器然後將彙編檔案寫入磁碟0面0扇區,然後啟動,在螢幕輸出字元,這個程式本身就很簡單,之前學習過王爽的彙編,知道視訊記憶體位置08b00h,字低8位是ascii編碼,高8位是字元的顏色 但是在看 的 發現不同之處 ...

除錯第乙個匯程式設計序 下

接 除錯第乙個匯程式設計序 上 很抱歉,在此篇博文中我截了很多的圖,這樣便於講解清楚,各位也看得明白,但是現在我上傳的太多,不能再繼續上傳,以後一旦解禁,我會把缺失的補上。在watch標籤頁視窗中,我們在command命令視窗輸入了命令 ws 1,r0來監控r0暫存器的變化,在此就會顯示r0暫存器的...