1、DATA SEGMENTSTR1 DB 0DH,0AH,FIRST NUMBER:$STR2 DB 0DH,0AH,SECOND NUMBER:$SUMSTR DB 0DH,0AH,SUM IS:$CUO DB 0DH,0AH,Please input the digit!,0DH,0AH,the right number:$WELCOME DB Welcome to the two six decimal number addition system!$FIRST DB 6 DUP (?)SECOND DB 6 DUP (?)SUM DB 7 DUP (?)DATA ENDSSTACK SE
2、GMENTSTA DB 100 DUP (?)TOP EQU LENGTH STASTACK ENDSCODE SEGMENTASSUME DS:DATA,CS:CODE,ES:DATA,SS:STACKSTART:MOV AX,DATA;给数据段寄存器赋值MOV DS,AXMOV AX,STACK;定位堆栈段MOV SS,AXMOV AX,TOPMOV SP,AXMOV DX,OFFSET WELCOMEMOV AH,9INT 21HMOV DX,OFFSET STR1 MOV AH,9INT 21HCALL INPUT1 MOV DX,OFFSET STR2 MOV AH,9INT 21H
3、CALL INPUT2 CALL ADDXY MOV DX,OFFSET SUMSTR MOV AH,9INT 21HCALL OUTPUT MOV AH,4CH INT 21HINPUT1 PROC NEAR MOV SI,OFFSET FIRST ADD SI,5MOV CX,6AAAAA: MOV AH,1INT 21HCMP AL,30HJL EXIT1CMP AL,39HJG EXIT1SUB AL,30H MOV SI,AL DEC SILOOP AAAAA JMP FAN1EXIT1: CALL CHUCUO1FAN1: RETINPUT1 ENDPINPUT2 PROC NEA
4、R MOV DI,OFFSET SECOND ADD DI,5MOV CX,6BBBBB: MOV AH,1INT 21HCMP AL,30HJL EXIT2CMP AL,39HJG EXIT2SUB AL,30H MOV DI,AL DEC DILOOP BBBBB JMP FAN2EXIT2: CALL CHUCUO2FAN2: RETINPUT2 ENDPADDXY PROC NEAR MOV SI,OFFSET FIRST MOV DI,OFFSET SECOND MOV BX,OFFSET SUMMOV CX,6 MOV AH,0 SAHFCCCCC: MOV AL,SIADC AL
5、,DIAAA LAHF MOV BX,AL INC SIINC DIINC BXLOOP CCCCC MOV AL,0SAHFADC AL,0 MOV BX,AL RETADDXY ENDPOUTPUT PROC NEAR MOV BX,OFFSET SUM ADD BX,6MOV CX,6 MOV AX,BX CMP AX,0JE OUTOUMOV AL,BXMOV DL,ALADD DL,30H MOV AH,2INT 21HOUTOU: DEC BXDDDDD: MOV AL,BX MOV DL,ALADD DL,30H MOV AH,2INT 21HDEC BXLOOP DDDDD RETOUTPUT ENDPCHUCUO1 PROC NEARMOV DX,OFFSET CUO MOV AH,9INT 21HCALL INPUT1 RETCHUCUO1 ENDPCHUCUO2 PROC NEAR MOV DX,OFFSET CUO MOV AH,9INT 21HCALL INPUT2 RETCHUCUO2 ENDPCODE ENDSEND START