Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .MODEL LARGE
- .STACK 100
- .DATA
- MSG DB 'SUBTRACT 2 NUMBERS$'
- 1ST DB 10, 10, 13, 'ENTER 1ST NUMBER $'
- 2ND DB 10, 13, 'ENTER 2ND NUMBER $'
- SUM DB 10,13, 'SUM $'
- .CODE
- MAIN PROC
- MOV AX, @DATA
- MOV DS, AX
- LEA DX, MSG ; FOR STRING PRINT
- MOV AH, 9 ; FOR STRING RESULT
- INT 21H
- LEA DX, 1ST ; FOR STRING PRINT
- MOV AH, 9 ; FOR STRING RESULT
- INT 21H
- MOV AH, 1 ; FOR SINGLE DIGIT INPUT
- INT 21H
- MOV BL, AL ; SCAN FIRST INPUT INTO 'BL' FROM 'AL'
- LEA DX, 2ND ; FOR STRING PRINT
- MOV AH, 9 ; FOR STRING RESULT
- INT 21H
- MOV AH, 1 ; FOR SINGLE DIGIT INPUT
- INT 21H
- MOV CL, AL ; SCAN SECOND INPUT INTO 'CL' FROM 'AL'
- LEA DX, SUM ; FOR STRING PRINT
- MOV AH, 9 ; FOR STRING RESULT
- INT 21H
- SUB BL, 30H ; SUBTRACT FROM ACCUMALATOR
- SUB CL, 30H ; SUBTRACT FROM ACCUMALATOR
- SUB BL, CL ; SUBTRACT 'BL' - 'CL' FOR ADDITION
- ADD BL, 30H ; ADD 'BL' + ACCUMALTOR
- MOV DL, BL ; TRANFER VALUE OF 'BL' INTO 'DL'
- MOV AH, 2 ; FOR INTEGER RESULT PRINT
- INT 21H
- MOV AH, 4CH ; FIXING ERROR
- INT 21H ; RETURN
- MAIN ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement