Code:
; Program to perform operation Z = (A+B) * (C+D)
; using Procedure
.MODEL SMALL
.STACK 100H
.DATA
A DB 1
B DB 2
C DB 3
D DB 4
Z DW ?
RES DB ?
.CODE
MOV AX , @DATA ;Initializing Data Segment
MOV DS , AX
MOV AL , A
MOV AH , B
CALL ADD_BYTE
MOV RES , AL ; STORING RESULT OF A+B
MOV AL , C
MOV AH , D
CALL ADD_BYTE
MOV BL , RES
MUL BL
AAM ; ASCII ADJUST AFTER MULTIPLICATION
MOV Z , AX
; PRINTING RESULT
MOV BH , AL
MOV DL , AH
ADD DL , 48
MOV AH , 02
INT 21H
MOV DH , 00
MOV DL , BH
ADD DL , 48
MOV AH , 02
INT 21H
MOV AH , 4CH ; Service Routine for exit
INT 21H
; Creating Procedure
ADD_BYTE PROC
ADD AL , AH
RET
ENDP
END
Output:
; Program to perform operation Z = (A+B) * (C+D)
; using Procedure
.MODEL SMALL
.STACK 100H
.DATA
A DB 1
B DB 2
C DB 3
D DB 4
Z DW ?
RES DB ?
.CODE
MOV AX , @DATA ;Initializing Data Segment
MOV DS , AX
MOV AL , A
MOV AH , B
CALL ADD_BYTE
MOV RES , AL ; STORING RESULT OF A+B
MOV AL , C
MOV AH , D
CALL ADD_BYTE
MOV BL , RES
MUL BL
AAM ; ASCII ADJUST AFTER MULTIPLICATION
MOV Z , AX
; PRINTING RESULT
MOV BH , AL
MOV DL , AH
ADD DL , 48
MOV AH , 02
INT 21H
MOV DH , 00
MOV DL , BH
ADD DL , 48
MOV AH , 02
INT 21H
MOV AH , 4CH ; Service Routine for exit
INT 21H
; Creating Procedure
ADD_BYTE PROC
ADD AL , AH
RET
ENDP
END
Output:
1 Comments:
Click here for Commentsgd