DATA SEGMENT
TABLE DB 7,2,3,4,5,6,7,8,9
DB 2,4,7,8,10,12,14,16,18
DB 3,6,9,12,15,18,21,24,27
DB 4,8,12,16,7,24,28,32,36
DB 5,10,15,20,25,30,35,40,45
DB 6,12,18,24,30,7,42,48,54
DB 7,14,21,28,35,42,49,56,63
DB 8,16,24,32,40,48,56,7,72
DB 9,18,27,36,45,54,63,72,81
ERROR DB 'error'
ANSWER DB 81 DUP(?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
MOV BX,OFFSET TABLE
LEA SI,ANSWER
MOV DI,1
MOV CX,1
LP3: MOV AX,DI
MUL CX
CMP DI,9
JA EXIT
CALL L_CMP
CMP CX,9
JE LP1
INC CX
INC BX
JMP LP3
LP1: MOV CX,1
INC DI
INC BX
JMP LP3
EXIT: CALL L_SHOW
MOV AH,4CH
INT 21H
L_CMP PROC
PUSH CX
PUSH DI
PUSH BX
PUSH AX
CMP AL,BYTE PTR [BX]
JZ L1
MOV BX,DI
MOV BYTE PTR[SI],BL
INC SI
MOV BYTE PTR [SI],CL
INC SI
L1:
POP AX
POP BX
POP DI
POP CX
RET
L_CMP ENDP
L_SHOW PROC
PUSH BX
PUSH CX
PUSH SI
PUSH DI
DEC SI
MOV BX,SI
LEA SI,ANSWER
LL1: CMP SI,BX
JE EXIT1
MOV DL,BYTE PTR [SI]
INC SI
MOV AH,2
INT 21H MOV DL,' '
MOV AH,2
INT 21H
MOV DL,BYTE PTR [SI]
MOV AH,2
INT 21H
INC SI
MOV DL,' '
MOV AH,2
INT 21H
MOV AH,10
MOV DX,OFFSET ERROR
INT 21H
JMP LL1
EXIT1:
POP DI
POP SI
POP CX
POP BX
RET
L_SHOW ENDP
CODE ENDS
END START
主要是红色部分,总是运行出一个笑脸,难道输出有问题???我单步执行检查后发现那里总是不对头,但是又不知道错在哪里,所以麻烦各位大大帮忙查查
------解决方案--------------------------------------------------------