设在变量BUF为起始地址的字节存储单元中存放了5个有符号字节数,编写源程序找出其中最大和最小的数存放于MAX和MIN两个字节单元中。
程序员文章站
2022-03-10 11:51:13
...
DATA SEGMENT
BUF DB 55H,66H,11H,44H,55H
MAX DB ?
MIN DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:MOV AX,DATA
MOV DS,AX
LEA SI,BUF
MOV CX,5
MOV BL,[SI]
MOV AL,BL
DEC CX
NEXT:INC SI
CMP AL,[SI]
JGE A1
MOV AL,[SI]
JMP A2
A1:CMP BL,[SI]
JLE A2
MOV BL,[SI]
A2:LOOP NEXT
MOV MAX,AL
MOV MIN,BL
MOV AH,4CH
INT 21H
CODE ENDS
END START