汇编程序。我以列出部分,求高手把SUM求和添加进去
把地址偏移量为100H单元开始的256个单元分别写入数据00H,01H,02H,03H,…,FFH,并用DOS功能调用显示各单元的内容。为了使显示清晰明了,要求每行显示16个数据,两个数据之间用空格分开,将它们累加求和,把和放在SUM单元。并以十六进制显示输出。程序如下:
DATA SEGMENT
0RG 100H
BUF1 DB 256DUP(?)
COUNT EQU $-BUF1
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV SI,OFFSET BUF1
MOV CX,COUNT
PUSH SI
PUSH CX
XOR AL,AL
NEXT: MOV [SI],AL
INC AL
INC SI
LOOP NEXT
POP CX
POP SI
ZRBH: MOV BH,16
NEXT1: MOV AL,[SI]
MOV BL,AL
SHR AL,1
SH RAL,1
SH RAL,1
SHR AL,1
CMP AL,0AH
JC JIA30
ADD AL,7
JIA30: ADD AL,30H
CALL DISP
MOV AL,BL
AND AL,0FH
CMP AL,0AH
JC JIA30A
ADD AL,7
JIA30A:ADD AL,30H
CALL DISP
MOV AL,20H
CALL DISP
INC SI
LOOP NEXT2
JMPSTOP
NEXT2: DECBH
JNZ NEXT1
MOV AL,0AH
CALL DISP
MOV AL,0DH
CALL DISP
JMP ZRBH
DISP PROC NEAR
MOV DL,AL
MOV AH,2
INT 21H
RET
DISP ENDP
STOP: MOV AH,4CH
INT 21H
CODE ENDS
END START