被30h搞懵了,输出不对,求老哥们指点
DISP_STRMACROX ;宏定义.MOVDX, OFFSET X
MOVAH, 9 ;输出字符串
INT21H
ENDM
;----------------------------------------------
DATASEGMENT ;数据段.
MSG1 DB13, 10, 'Input N
MSG2 DB13, 10, 'I can not count so much !
MSG3 DB13, 10, 'Please Input NUM (1~9, 0 end):
MSG4 DB13, 10, 'Please Input Matrix from 0~15,remember to have a space between each data!!!
MSG5 DB13, 10, 'The sum of leading diagonal is :
MSG6 DB13, 10, 'Reprint the matrix:
IN_N1 DB16 DUP ('$$) ;影响
ONLY DB 0
SUM DD 0
N DB30H ;序数.
DATAENDS
;----------------------------------------------
CODE SEGMENT ;代码段.
ASSUME CS: CODE, DS: DATA
START:
MOVAX, DATA
MOVDS, AX
;--------------------------------
MOVBX, OFFSET IN_N1;数据
MOVCX, 16 ;循环次数
;--------------------------------
DISP_STRMSG4
CALL INPUT
;==========================================================
LEA SI,IN_N1
LEA DI,SUM
mov ax, ;1
add ,ax
mov ax,
adc ,ax
JCSS1 ;如果进位 跳转到SS1
B1:
ADD SI,25 ;6
mov ax,
add ,ax
mov ax,
adc ,ax
JC SS2
B2:
ADD SI,25 ;11
mov ax,
add ,ax
mov ax,
adc ,ax
JC SS3
B3:
ADD SI,25 ;16
mov ax,
add ,ax
mov ax,
adc ,ax
JC SS4
JMP IN_END
SS1:
INC ONLY
JMP B1
SS2:
INC ONLY
JMP B2
SS3:
INC ONLY
JMP B3
SS4:
INC ONLY
;=============================
IN_END:
DISP_STRMSG5
MOV DL,ONLY
ADD DL,30H
MOVAH, 2
INT21H
LEA SI,SUM
MOV DL,
ADD DL,30H
MOVAH, 2
INT21H
MOV DL,
ADD DL,30H
MOVAH, 2
INT21H
MOV DL,
ADD DL,30H
MOVAH, 2
INT21H
MOV DL,
ADD DL,30H
MOVAH, 2
INT21H
MOVDL, 13 ;换行
MOVAH, 2
INT21H
MOVDL,10
MOVAH, 2
INT21H
;=========================================
DISP_STRMSG6;未施工完成
JMP EXIT
;--------------------------------
_IN_ERR:
DISP_STRMSG2 ;宏调用,提示 can not count so much !
EXIT:
MOVAH, 4CH
INT21H
;--------------------------------------------
INPUT: ;所有输入过程
IN_X:
PUSH CX
DISP_STRMSG1 ;宏调用,提示 Please Input :
INCN
;MOVDL, N
;MOVAH, 2
;INT21H
MOVDL, ':'
MOVAH, 2
INT21H
MOVDX, BX
IN_LOOP:
MOVAH, 1 ;输入字符.
INT21H
CMPAL, ' ' ;空格?
JZ IN_Y ;本数字结束.
CMPAL, 30H
JB _IN_ERR ;小于'0',输入错误.
CMPAL, 3AH
JNB_IN_ERR ;大于'9',输入错误.
SUB AL,30H;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MOV, AL
INCBX
MOVAX, BX
SUBAX, 3 ;影响
SUBAX, DX
JA IN_Y
JMPIN_LOOP ;继续输入.
IN_Y:
ADDDX, 5 ;影响
MOVBX, DX
POPCX
LOOP IN_X
RET
;--------------------------------
CODEENDS
ENDSTART
输入进去16个数,想象成一个矩阵,想把其中几个数加起来。但是不管怎么调,结果都是一堆乱七八糟的符号,感觉是和30h有关系,可自己太菜了找不到哪错了....求老哥们指点啊啊啊!!!
页:
[1]