![]() |
|
論壇說明 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
![]() ![]() |
|
主題工具 | 顯示模式 |
![]() |
#1 |
註冊會員
|
![]() 小弟又來了~麻煩大大了~最後了 ~QQ
語法:
Assignment 2 Due :12/30/2005 (-20% for each day late) (遲交的每天-20%) • The goal of assignment 2 is to learn to implement an assembly program using procedures. and condition jmp 學習使用jmp實作一個組合程式。 • In this assignment, you will implement an insertion sort program. Your program should contain at least two procedures: insertion_sort for sorting a data array, and dump_array for displaying the sorted array. 你的程式只少需要包含2個功能: 1. 插入排序法(Insertion Sort):輸入數個數值,並以插入排序法由小至大將數值排序 2. 保存資料的陣列(dump_array):供你使用排序功能的陣列 • In the assignment , u need let user input how many integers you want to sort and print the data 本程式中…你需要把使用者輸入的數字排序跟印出 • arry before sort and after sort . The numbers of sorting integers is between 0 and 100. 本程式中…需要讓使用者輸入一個數字(介於0~100之間) The following is a pseudo code of insertion sort: ========================================= Insertion-Sort(A) for j←2 for length[A] do key←A[j] △Insert A[j] into the sorted sequence A[1..j-1] i←j-1 while i>0 and A[i]>key do A[i+1]←A[i] i←i-1 A[i+1]←key ========================================= • Use WriteDec, WriteString, ReadDec, Crlf…etc. in Irvine32.inc to implement your program * WriteDec: 在標準輸出中寫入一個32-bit無號整數,以十進位顯示 mov eax , 295 call WriteDec ; 顯示 "295" * WriteString: 寫入一個以null作結尾的字串到標準輸出 prompt BYTE "Enter your name:" , 0 mov edx , OFFSET prompt call WriteString * Crlf : 換行 call Crlf * ReadDec : ??? • Graded will based on o 60% A completely working program is finished. The code should be complete or almost done (meaning the basic structure of the code is correct but the code may still have bugs), and it should have no compilation error. o (30%) The program produces correct results. o (10%) Readability. • Write Homework by yourself or discuss with classmates, but Never Copy , or Both Graded will be zero. |
![]() |
送花文章: 23,
![]() |
![]() |
#4 (permalink) |
管理版主
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() key 是一個暫存用變數
可以用 暫存器 或 記憶體變數 來實現 比如 for j←2 for length[A] do key←A[j] 翻譯過來就變成 語法:
.data key Byte 1 DUP (0) .code mov EBX,2 ;EBX 比作 j mov ECX,LENGTHOF A NEXT: mov key,A+EBX ;A+EBX = A[j] ;... INC EBX loop NEXT 所以也不多說什麼 |
![]() |
送花文章: 2027,
![]() |