汇编实现数组字节数相加

程序中还有一些bug,请各大网友指正

DATAS SEGMENT
BUF DB 11H,11H,11H,11H,11H,11H
RESULT DB 'The result is: '
NUM DB 0
DB 13,10,'OVER','$'
COUNT Dw 5H
DATAS ENDS
;--------------------------------------
CODES SEGMENT
ASSUME DS:DATAS,CS:CODES
START:
MOV AX,DATAS
MOV DS,AX
XOR AX,AX
MOV SI,OFFSET BUF
ADD AX,[SI]
MOV CX,COUNT
NEXT:
INC SI
ADC AX,[SI]
LOOP NEXT
AND AX,00FFH
CBW
MOV DL,6H
IDIV DL
ADD AL,30H
MOV BYTE PTR NUM,AL
LEA DX,RESULT

MOV AH,9H
INT 21H
OK: MOV AH,4CH
INT 21H
CODES ENDS
END START


你可能感兴趣的:(Assembly,Language)