Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .386
- ASSUME CS: CODE, DS: DATA
- DATA SEGMENT USE16 PUBLIC
- STRING1 DB 100, 99 DUP ('$')
- STRING2 DB 100, 99 DUP ('$')
- HELP DB 100, 99 DUP ('$')
- DUMMY DB 0AH, '$'
- RESULT DB 100 DUP ('$')
- SUM DB 100 DUP ('$')
- OVERFLOW DB ?
- END1 DB ?
- END2 DB ?
- ONE DB ?
- TWO DB ?
- IS DB ?
- GREAT DB ?
- MINUS DB ?
- COUNT DW ?
- TEN DB 10
- NUMOFSTEP DW ?
- C1 DW ?
- C2 DW ?
- M1 DB ?
- M2 DB ?
- CURMINUS DB ?
- CURSTEP DB ?
- LEN DW ?
- DATA ENDS
- CODE SEGMENT USE16 PUBLIC
- CLEAR1 PROC
- MOV STRING1[SI], '$'
- INC SI
- CMP SI, 99
- JNE CLEAR1
- RET
- CLEAR1 ENDP
- CLEAR2 PROC
- MOV STRING2[SI], '$'
- INC SI
- CMP SI, 99
- JNE CLEAR2
- RET
- CLEAR2 ENDP
- SCAN1 PROC
- mov dx, offset string1
- mov ax, 0
- mov ah, 0Ah
- int 21h
- mov dx, offset dummy
- mov ah, 09h
- int 21h
- mov dx, offset string1
- RET
- SCAN1 ENDP
- SCAN2 PROC
- mov dx, offset string2
- mov ax, 0
- mov ah, 0Ah
- int 21h
- mov dx, offset dummy
- mov ah, 09h
- int 21h
- mov dx, offset string2
- RET
- SCAN2 ENDP
- SET0L PROC
- MOV ONE, 48
- MOV END2, 1
- JMP SL
- SET0L ENDP
- SET0H PROC
- MOV TWO, 48
- MOV END1, 1
- JMP SH
- SET0H ENDP
- OVER PROC
- MOV OVERFLOW, 1
- SUB ONE, 10
- JMP OV
- OVER ENDP
- RET1 PROC
- CMP OVERFLOW, 1
- JE ADD1
- A1:
- CMP IS, 1
- JE IS1
- CALL REVERSE
- RET1 ENDP
- ADD1 PROC
- MOV RESULT[BX], 49
- INC BX
- JMP A1
- ADD1 ENDP
- REVERSE PROC
- DEC BX
- CMP BX, 0
- JL RETURN1
- MOV DL, RESULT[BX]
- MOV AH, 02H
- INT 21H
- CALL REVERSE
- REVERSE ENDP
- IS1 PROC
- DEC BX
- CMP RESULT[BX], 48
- JNE ADDBX
- ABX:
- MOV RESULT[BX], 45
- INC BX
- JMP REVERSE
- IS1 ENDP
- ADDBX PROC
- INC BX
- JMP ABX
- ADDBX ENDP
- AOUND PROC
- DEC SI
- DEC DI
- MOV AL, STRING1[SI]
- MOV ONE, AL
- CMP SI, 1
- JLE SET0L
- SL:
- MOV AL, ONE
- SUB AL, 48
- MOV ONE, AL
- MOV AL, STRING2[DI]
- MOV TWO, AL
- CMP DI, 1
- JLE SET0H
- SH:
- MOV AL, TWO
- SUB AL, 48
- MOV TWO, AL
- MOV AL, END1
- ADD AL, END2
- CMP AL, 2
- JE RET1
- MOV AL, ONE
- ADD AL, TWO
- ADD AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV ONE, AL
- CMP ONE, 10
- JAE OVER
- OV:
- MOV AL, ONE
- ADD AL, 48
- MOV RESULT[BX], AL
- INC BX
- CALL AOUND
- AOUND ENDP
- SET0LH PROC
- MOV ONE, 48
- MOV END2, 1
- JMP SLH
- SET0LH ENDP
- SET0HH PROC
- MOV TWO, 48
- MOV END1, 1
- JMP SHH
- SET0HH ENDP
- SUB71 PROC
- SUB AL, 7
- JMP S71
- SUB71 ENDP
- SUB72 PROC
- SUB AL, 7
- JMP S72
- SUB72 ENDP
- ADD1H PROC
- MOV RESULT[BX], 49
- INC BX
- JMP ADH
- ADD1H ENDP
- RET2 PROC
- CMP OVERFLOW, 1
- JE ADD1H
- ADH:
- CALL REVERSEH
- RET2 ENDP
- REVERSEH PROC
- DEC BX
- CMP BX, 0
- JL RETURN2
- MOV DL, RESULT[BX]
- CMP DL, 57
- JA ADD7
- A7:
- MOV AH, 02H
- INT 21H
- CALL REVERSEH
- REVERSEH ENDP
- ADD7 PROC
- ADD DL, 7
- JMP A7
- ADD7 ENDP
- OVERH PROC
- MOV OVERFLOW, 1
- SUB ONE, 16
- JMP OVH
- OVERH ENDP
- AOUNH PROC
- DEC SI
- DEC DI
- MOV AL, STRING1[SI]
- MOV ONE, AL
- CMP SI, 1
- JLE SET0LH
- SLH:
- MOV AL, ONE
- SUB AL, 48
- CMP AL, 17
- JAE SUB71
- S71:
- MOV ONE, AL
- MOV AL, STRING2[DI]
- MOV TWO, AL
- CMP DI, 1
- JLE SET0HH
- SHH:
- MOV AL, TWO
- SUB AL, 48
- CMP AL, 17
- JAE SUB72
- S72:
- MOV TWO, AL
- MOV AL, END1
- ADD AL, END2
- CMP AL, 2
- JE RET2
- MOV AL, ONE
- ADD AL, TWO
- ADD AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV ONE, AL
- CMP ONE, 16
- JAE OVERH
- OVH:
- MOV AL, ONE
- ADD AL, 48
- MOV RESULT[BX], AL
- INC BX
- CALL AOUNH
- AOUNH ENDP
- SET0L1 PROC
- MOV ONE, 48
- MOV END2, 1
- CMP IS, 2
- JE SL1R
- JMP SL1
- SET0L1 ENDP
- SET0H1 PROC
- MOV TWO, 48
- MOV END1, 1
- CMP IS, 2
- JE SH1R
- JMP SH1
- SET0H1 ENDP
- OVER1 PROC
- MOV OVERFLOW, 1
- ADD ONE, 10
- JMP OV1
- OVER1 ENDP
- REVERSE3 PROC
- DEC BX
- CMP BX, 0
- JL RET3
- JE DRAWMINUS
- DM:
- MOV DL, RESULT[BX]
- MOV AH, 02H
- INT 21H
- CALL REVERSE
- REVERSE3 ENDP
- DRAW PROC
- CMP MINUS, 1
- JE DRAWMINUS
- JMP REVERSE3
- DRAW ENDP
- DRAWMINUS PROC
- DEC BX
- MOV RESULT[BX], 45
- INC BX
- JMP REVERSE3
- DRAWMINUS ENDP
- RET3 PROC
- CMP IS, 0
- JA RETURN4
- JMP RETURN3
- RET3 ENDP
- SOUN PROC
- DEC SI
- DEC DI
- MOV AL, STRING1[SI]
- MOV ONE, AL
- CMP SI, 1
- JLE SET0L1
- SL1:
- MOV AL, ONE
- SUB AL, 48
- MOV ONE, AL
- MOV AL, STRING2[DI]
- MOV TWO, AL
- CMP DI, 1
- JLE SET0H1
- SH1:
- MOV AL, TWO
- SUB AL, 48
- MOV TWO, AL
- MOV AL, END1
- ADD AL, END2
- CMP AL, 2
- JE DRAW
- MOV AL, ONE
- SUB AL, TWO
- SUB AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV ONE, AL
- CMP ONE, 0
- JL OVER1
- OV1:
- MOV AL, ONE
- ADD AL, 48
- MOV RESULT[BX], AL
- INC BX
- CALL SOUN
- SOUN ENDP
- OVER1R PROC
- MOV OVERFLOW, 1
- ADD TWO, 10
- JMP OV1R
- OVER1R ENDP
- SOUNREVERSE PROC
- DEC SI
- DEC DI
- MOV AL, STRING1[SI]
- MOV ONE, AL
- CMP SI, 1
- JLE SET0L1
- SL1R:
- MOV AL, ONE
- SUB AL, 48
- MOV ONE, AL
- MOV AL, STRING2[DI]
- MOV TWO, AL
- CMP DI, 1
- JLE SET0H1
- SH1R:
- MOV AL, TWO
- SUB AL, 48
- MOV TWO, AL
- MOV AL, END1
- ADD AL, END2
- CMP AL, 2
- JE DRAW
- MOV AL, TWO
- SUB AL, ONE
- SUB AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV TWO, AL
- CMP TWO, 0
- JL OVER1R
- OV1R:
- MOV AL, TWO
- ADD AL, 48
- MOV RESULT[BX], AL
- INC BX
- CALL SOUNREVERSE
- SOUNREVERSE ENDP
- ADDMINUS1 PROC
- MOV END1, 1
- MOV SI, 2
- MOV BL, STRING2[SI]
- CMP BL, 45
- JE ADDMINUS2
- JMP C4
- ADDMINUS1 ENDP
- ADDMINUS2 PROC
- MOV END2, 1
- JMP C4
- ADDMINUS2 ENDP
- COMPARE1 PROC
- CMP END2, 1
- JE COMPARE11
- CMP END2, 0
- JE COMPARE10
- COMPARE1 ENDP
- COMPARE11 PROC
- MOV SI, 2
- MOV STRING1[SI], 48
- MOV STRING2[SI], 48
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- MOV IS, 1
- CALL AOUND
- COMPARE11 ENDP
- SUB101 PROC
- MOV SI, 2
- MOV STRING1[SI], 48
- MOV IS, 1
- MOV MINUS, 1
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- CALL SOUN
- SUB101 ENDP
- SUB102 PROC
- MOV SI, 2
- MOV STRING1[SI], 48
- MOV IS, 2
- MOV MINUS, 0
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- CALL SOUNREVERSE
- SUB102 ENDP
- COMPARE10 PROC
- MOV SI, 1
- MOV DL, STRING1[SI]
- MOV DH, STRING2[SI]
- DEC DL
- CMP DL, DH
- JA SUB101
- JB SUB102
- MOV SI, 2
- MOV DI, 1
- CALL COMPARE
- C10:
- CMP GREAT, 1
- JE SUB101
- CMP GREAT, 2
- JE SUB102
- COMPARE10 ENDP
- COMPARE0 PROC
- CMP END2, 1
- JE COMPARE01
- CMP END2, 0
- JE COMPARE00
- COMPARE0 ENDP
- COMPARE00 PROC
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- MOV IS, 2
- CALL AOUND
- COMPARE00 ENDP
- COMPARE01 PROC
- MOV SI, 1
- MOV DL, STRING1[SI]
- MOV DH, STRING2[SI]
- DEC DL
- CMP DL, DH
- JA SUB011
- JB SUB012
- MOV SI, 1
- MOV DI, 2
- CALL COMPARE
- C01:
- CMP GREAT, 1
- JE SUB011
- CMP GREAT, 2
- JE SUB012
- COMPARE01 ENDP
- SUB011 PROC
- MOV SI, 2
- MOV STRING2[SI], 48
- MOV IS, 1
- MOV MINUS, 0
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- CALL SOUN
- SUB011 ENDP
- SUB012 PROC
- MOV SI, 2
- MOV STRING2[SI], 48
- MOV IS, 2
- MOV MINUS, 1
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 2
- MOV DI, 1
- MOV BL, STRING2[DI]
- XOR BH, BH
- MOV DI, BX
- ADD DI, 2
- MOV BX, 0
- MOV OVERFLOW, 0
- MOV END1, 0
- MOV END2, 0
- CALL SOUNREVERSE
- SUB012 ENDP
- EQUAL PROC
- CMP BL, '$'
- JE PRINT0
- JMP COMPARE
- EQUAL ENDP
- PRINT0 PROC
- MOV AH, 02H
- MOV DL, 48
- INT 21H
- JMP RETURN4
- PRINT0 ENDP
- COMPARE PROC
- INC SI
- INC DI
- MOV BL, STRING1[SI]
- MOV BH, STRING2[DI]
- CMP BL, BH
- JE EQUAL
- JA SET1
- JB SET2
- COMPARE ENDP
- SET2 PROC
- MOV GREAT, 2
- CMP END1, 1
- JE C10
- JMP C01
- SET2 ENDP
- SET1 PROC
- MOV GREAT, 1
- CMP END1, 0
- JE C01
- JMP C10
- SET1 ENDP
- MINUS2 PROC
- MOV SI, 2
- MOV BL, STRING2[SI]
- CMP BL, 45
- JE ADDMINUS2
- JMP C4
- MINUS2 ENDP
- SETEND11 PROC
- MOV END1, 1
- JMP E1
- SETEND11 ENDP
- SETEND10 PROC
- MOV END1, 0
- JMP E1
- SETEND10 ENDP
- SETEND21 PROC
- MOV END2, 1
- JMP E2
- SETEND21 ENDP
- SETEND20 PROC
- MOV END2, 0
- JMP E2
- SETEND20 ENDP
- ADDZERO PROC
- CMP C2, 0
- JE AZ
- MOV RESULT[BX], 0
- INC BX
- DEC C2
- CALL ADDZERO
- ADDZERO ENDP
- CHECKLAST PROC
- MOV AL, SUM[BX]
- CMP AL, '$'
- JE CHL
- INC BX
- CALL CHECKLAST
- CHECKLAST ENDP
- PRINTM PROC
- CMP IS, 1
- JE EXML
- CMP MINUS, 1
- JE MMS
- MMM:
- MOV BX, 0
- CALL CHECKLAST
- CHL:
- CALL SHOWM
- PRINTM ENDP
- MMS PROC
- MOV DL, 45
- MOV AH, 02H
- INT 21H
- JMP MMM
- MMS ENDP
- SHOWM PROC
- DEC BX
- CMP BX, 0
- JL RETURN5
- MOV AH, 02H
- MOV DL, SUM[BX]
- ADD DL, 48
- INT 21H
- CALL SHOWM
- SHOWM ENDP
- MOSN PROC
- MOV BX, NUMOFSTEP
- MOV C2, BX
- MOV BX, 0
- CALL ADDZERO
- AZ:
- MOV AX, 1
- ADD AL, M2
- CMP DI, AX
- JE PRINTM
- MOV SI, COUNT
- MOV AL, STRING2[DI]
- MOV TWO, AL
- SUB TWO, 48
- MOV OVERFLOW, 0
- JMP STEP
- STE:
- MOV BX, 0
- MOV SI, 0
- MOV C1, 0
- MOV END1, 0
- MOV END2, 0
- MOV OVERFLOW, 0
- CALL MULSUM
- MS:
- INC NUMOFSTEP
- DEC DI
- CALL MOSN
- MOSN ENDP
- ADDSM PROC
- CMP OVERFLOW, 0
- JNE ADDDIGIT
- AD:
- JMP STE
- ADDSM ENDP
- ADDDIGIT PROC
- MOV AL, OVERFLOW
- MOV RESULT[BX], AL
- INC BX
- JMP AD
- ADDDIGIT ENDP
- STEP PROC
- MOV AX, 1
- ADD AL, M1
- CMP SI, AX
- JE ADDSM
- MOV AL, STRING1[SI]
- SUB AL, 48
- MUL TWO
- ADD AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV ONE, AL
- CMP ONE, 10
- JAE OVERM
- OVM:
- MOV AL, ONE
- MOV RESULT[BX], AL
- INC BX
- DEC SI
- CALL STEP
- STEP ENDP
- OVERM PROC
- MOV AL, ONE
- XOR AH, AH
- DIV TEN
- MOV OVERFLOW, AL
- MOV ONE, AH
- JMP OVM
- OVERM ENDP
- SET0LSM PROC
- MOV AL, 0
- MOV END1, 1
- JMP SLSM
- SET0LSM ENDP
- SET0HSM PROC
- MOV AL, 0
- MOV END2, 1
- JMP SHSM
- SET0HSM ENDP
- OVERSM PROC
- MOV OVERFLOW, 1
- SUB ONE, 10
- JMP OVSM
- OVERSM ENDP
- RETSM PROC
- CMP OVERFLOW, 1
- JE ADD1SM
- A1SM:
- MOV BX, 0
- CALL CHANGESM
- RM:
- MOV BX, 0
- JMP MS
- RETSM ENDP
- ADD1SM PROC
- MOV HELP[BX], 49
- INC BX
- JMP A1SM
- ADD1SM ENDP
- CHANGESM PROC
- MOV AL, HELP[BX]
- CMP AL, '$'
- JE RM
- MOV SUM[BX], AL
- INC BX
- CALL CHANGESM
- CHANGESM ENDP
- MULSUM PROC
- MOV AL, SUM[SI]
- CMP AL, '$'
- JE SET0LSM
- SLSM:
- MOV ONE, AL
- MOV AL, RESULT[BX]
- CMP AL, '$'
- JE SET0HSM
- SHSM:
- MOV TWO, AL
- MOV AL, END1
- ADD AL, END2
- CMP AL, 2
- JE RETSM
- MOV AL, ONE
- ADD AL, TWO
- ADD AL, OVERFLOW
- MOV OVERFLOW, 0
- MOV ONE, AL
- CMP ONE, 10
- JAE OVERSM
- OVSM:
- MOV AL, ONE
- MOV C2, BX
- MOV BX, C1
- MOV HELP[BX], AL
- MOV BX, C2
- INC BX
- INC SI
- INC C1
- CALL MULSUM
- MULSUM ENDP
- ;----------------------------------------
- SETMINUS PROC
- MOV MINUS, 1
- JMP SM
- SETMINUS ENDP
- COPY PROC
- CMP SI, 1
- JE CP
- MOV AL, STRING1[SI]
- MOV STRING2[SI], AL
- DEC SI
- CALL COPY
- COPY ENDP
- EOFN PROC
- CMP GREAT, 0
- JE PRINTEM
- CMP MINUS, 1
- JE SM0
- EOFNM:
- MOV SI, 2
- CALL TESTP
- T:
- MOV SI, 0
- CMP CURSTEP, 0
- JE SETSICOUNT
- JNE SETSI
- SSC:
- ;MOV SI, COUNT
- MOV DI, LEN
- MOV END1, 0
- MOV END2, 0
- ;MOV COUNT, SI
- MOV NUMOFSTEP, 0
- CALL MOSN
- EXML:
- MOV SI, 0
- CALL MSTS
- MSTS1:
- DEC SI
- MOV DI, 2
- CALL COPYSUM
- CS1:
- DEC GREAT
- CALL EOFN
- EOFN ENDP
- TESTP PROC
- MOV AL, STRING1[SI]
- CMP AL, '$'
- JE T
- MOV AH, 02H
- MOV DL, AL
- INT 21H
- INC SI
- CALL TESTP
- TESTP ENDP
- COPYSUM PROC
- CMP SI, 0
- JL CS1
- MOV AL, SUM[SI]
- ADD AL, 48
- MOV STRING1[DI], AL
- INC DI
- DEC SI
- CALL COPYSUM
- COPYSUM ENDP
- SETSICOUNT PROC
- MOV SI, LEN
- MOV COUNT, SI
- JMP SSC
- SETSICOUNT ENDP
- SETSI PROC
- MOV AL, STRING1[SI]
- CMP AL, '$'
- JE SETCOUNT
- INC SI
- CALL SETSI
- SETSI ENDP
- SETCOUNT PROC
- DEC SI
- MOV COUNT, SI
- JMP SSC
- SETCOUNT ENDP
- MSTS PROC
- MOV AL, SUM[SI]
- CMP AL, '$'
- JMP MSTS1
- INC SI
- CALL MSTS
- MSTS ENDP
- SETCURMINUS PROC
- MOV CURMINUS, 1
- JMP SCM
- SETCURMINUS ENDP
- SM0 PROC
- MOV AL, 1
- XOR AL, CURMINUS
- JMP EOFNM
- SM0 ENDP
- PRINTEM PROC
- CMP MINUS, 1
- JE PM
- PMM:
- MOV BX, 0
- CALL CHECKLASTE
- CHLE:
- CALL SHOWME
- PRINTEM ENDP
- CHECKLASTE PROC
- MOV AL, SUM[BX]
- CMP AL, '$'
- JE CHLE
- INC BX
- CALL CHECKLASTE
- CHECKLASTE ENDP
- PM PROC
- MOV AH, 02H
- MOV DL, 45
- INT 21H
- JMP PMM
- PM ENDP
- SHOWME PROC
- DEC BX
- CMP BX, 0
- JL RETURN6
- MOV DL, SUM[BX]
- ADD DL, 48
- MOV AH, 02H
- INT 21H
- CALL SHOWME
- SHOWME ENDP
- FAST1 PROC
- MOV DX, OFFSET STRING1
- ADD DX, 2
- MOV AH, 09H
- INT 21H
- JMP RETURN6
- FAST1 ENDP
- START:
- MOV AX, DATA
- MOV DS, AX
- ;-------ADDING OF UNSIGNED NUMBERS (DECIMAL)--------
- ;CALL SCAN1
- ;CALL SCAN2
- ;MOV SI, 1
- ;MOV BL, STRING1[SI]
- ;XOR BH, BH
- ;MOV SI, BX
- ;ADD SI, 2
- ;MOV DI, 1
- ;MOV BL, STRING2[DI]
- ;XOR BH, BH
- ;MOV DI, BX
- ;ADD DI, 2
- ;MOV BX, 0
- ;MOV OVERFLOW, 0
- ;MOV END1, 0
- ;MOV END2, 0
- ;CALL AOUND
- RETURN1:
- CMP IS, 0
- JA RETURN4
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;MOV SI, 1
- ;CALL CLEAR1
- ;MOV SI, 1
- ;CALL CLEAR2
- ;-----------------------------------------
- ;-------ADDING OF UNSIGNED NUMBERS (HEX)--------
- ;CALL SCAN1
- ;CALL SCAN2
- ;MOV SI, 1
- ;MOV BL, STRING1[SI]
- ;XOR BH, BH
- ;MOV SI, BX
- ;ADD SI, 2
- ;MOV DI, 1
- ;MOV BL, STRING2[DI]
- ;XOR BH, BH
- ;MOV DI, BX
- ;ADD DI, 2
- ;MOV BX, 0
- ;MOV OVERFLOW, 0
- ;MOV END1, 0
- ;MOV END2, 0
- ;CALL AOUNH
- RETURN2:
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;MOV SI, 1
- ;CALL CLEAR1
- ;MOV SI, 1
- ;CALL CLEAR2
- ;----------------------------------------
- ;-------SUBTRACT OF UNSIGNED NUMBERS--------
- ;CALL SCAN1
- ;CALL SCAN2
- ;MOV SI, 1
- ;MOV BL, STRING1[SI]
- ;XOR BH, BH
- ;MOV SI, BX
- ;ADD SI, 2
- ;MOV DI, 1
- ;MOV BL, STRING2[DI]
- ;XOR BH, BH
- ;MOV DI, BX
- ;ADD DI, 2
- ;MOV BX, 0
- ;MOV OVERFLOW, 0
- ;MOV END1, 0
- ;MOV END2, 0
- ;MOV IS, 0
- ;MOV MINUS, 0
- ;CALL SOUN
- RETURN3:
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;MOV SI, 1
- ;CALL CLEAR1
- ;MOV SI, 1
- ;CALL CLEAR2
- ;----------------------------------------
- ;-------ADDING OF SIGNED NUMBERS--------
- ;CALL SCAN1
- ;CALL SCAN2
- ;MOV SI, 2
- ;MOV BL, STRING1[SI]
- ;CMP BL, 45
- ;JE ADDMINUS1
- ;JNE MINUS2
- C4:
- ;CMP END1, 1
- ;JE COMPARE1
- ;CMP END1, 0
- ;JE COMPARE0
- RETURN4:
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;MOV SI, 1
- ;CALL CLEAR1
- ;MOV SI, 1
- ;CALL CLEAR2
- ;-----------------------------------------
- ;-------MULTIPLY OF SIGNED NUMBERS--------
- ;CALL SCAN1
- ;CALL SCAN2
- ;MOV SI, 2
- ;MOV BL, STRING1[SI]
- ;MOV BH, STRING2[SI]
- ;MOV END1, 0
- ;MOV END2, 0
- ;CMP BL, 45
- ;JE SETEND11
- ;JNE SETEND10
- E1:
- ;CMP BH, 45
- ;JE SETEND21
- ;JNE SETEND20
- E2:
- ;MOV AL, END1
- ;ADD AL, END2
- ;MOV IS, AL
- ;MOV AL, END1
- ;MOV M1, AL
- ;MOV AL, END2
- ;MOV M2, AL
- ;MOV AH, END1
- ;XOR AH, END2
- ;MOV MINUS, AH
- ;MOV SI, 1
- ;MOV BL, STRING1[SI]
- ;XOR BH, BH
- ;MOV SI, BX
- ;ADD SI, 2
- ;MOV DI, 1
- ;MOV BL, STRING2[DI]
- ;XOR BH, BH
- ;MOV DI, BX
- ;ADD DI, 2
- ;DEC DI
- ;DEC SI
- ;MOV END1, 0
- ;MOV END2, 0
- ;MOV COUNT, SI
- ;MOV NUMOFSTEP, 0
- ;MOV IS, 0
- ;CALL MOSN
- RETURN5:
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;MOV SI, 1
- ;CALL CLEAR1
- ;MOV SI, 1
- ;CALL CLEAR2
- ;-----------------------------------------
- ;-------EXPONENTIATION OF SIGNED NUMBERS--------
- CALL SCAN1
- CALL SCAN2
- MOV AH, 02H
- MOV DL, 55
- INT 21H
- MOV MINUS, 0
- MOV IS, 1
- MOV SI, 2
- MOV AL, STRING1[SI]
- CMP AL, 45
- JE SETMINUS
- SM:
- MOV CURMINUS, 0
- CMP MINUS, 1
- JE SETCURMINUS
- SCM:
- MOV SI, 1
- MOV BL, STRING1[SI]
- XOR BH, BH
- MOV SI, BX
- ADD SI, 1
- MOV COUNT, SI
- MOV LEN, SI
- MOV DI, 2
- MOV AL, STRING2[DI]
- MOV GREAT, AL
- DEC GREAT
- MOV AL, GREAT
- SUB AL, 48
- MOV GREAT, AL
- CMP GREAT, 0
- JE FAST1
- MOV SI, COUNT
- CALL COPY
- CP:
- MOV CURSTEP, 0
- CALL EOFN
- RETURN6:
- MOV AH, 02H
- MOV DL, 10
- INT 21H
- MOV AH, 02H
- MOV DL, 13
- INT 21H
- ;-----------------------------------------
- MOV AH, 4CH
- INT 21H
- CODE ENDS
- END START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement