小弟又來了~麻煩大大了~最後了 ~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.