题目: 求最大数
内容:DAT开始的字单元中存放N个无符号数,求出最大数存入MAX单元中。
DAT DW X1,……,XN
MAX DW ?
要求:熟练掌握分支程序设计方法
cnt equ ($-DAT) : cnt 是个常量且等于DAT数组长度
equ 是宏定义
INCLUDE irvine32.inc
.data
DAT dw 12,55,87,31,5,4,6,19,199
cnt equ ($-DAT)/2;equ 宏定义
MAX dw 0
.code
start :
xor eax,eax;清零eax
xor esi,esi
mov ecx,cnt
again:
mov ax,DAT[esi*2]
cmp ax,MAX
jbe next
mov MAX,ax
next:
inc esi
loop again
xor eax,eax
mov ax,MAX
call writeint
exit
end start