組何語言新手作業_
小弟這學期剛開始學組合語言,結果第一次作業就讓我好頭大啦,所以來這邊求幫忙了QQ
這是其中一題的題目:
Write a program with a loop and addressing that exchanges every pair of values in an array with an even number of elements. Therefore, item i will exchange with i+1, and item i+2 will exchange with item i+3, and so on.
然後以下是我目前的程式碼:
TITLE 4_10_2 (4_10_2.asm)
; This program is homework1 4_10_2
INCLUDE Irvine32.inc
.data
array BYTE 00h, 11h, 22h, 33h, 44h, 55h, 66h, 77h, 88h, 99h
.code
main PROC
mov ecx, lengthof array
L1:
mov al, [array+ecx-1]
xchg al, [array+ecx-2]
mov [array+ecx-1], al
sub ecx, 1
loop L1
exit
main ENDP
END main
--------------------------------------------------------------------------------------
我的問題是我不知道該如何把array輸出到螢幕上.... 還有不知道我這樣寫有沒有符合題目的要求??
|