1.

ADDITION OF TWO 8-BIT HEXADECIMAL NUMBERS
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 8-BIT NUMBER IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H ADD BL,DL JNC NEXT INC CL NEXT:CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H
1|Page

R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START OUTPUT: ENTER FIRST NUMBER : E9 ENTER SECOND NUMBER : FA SUM OF TWO 8-BIT NUMBER IS : 1E3

ENTER FIRST NUMBER : AB ENTER SECOND NUMBER : CD SUM OF TWO 8-BIT NUMBER IS : 178

2|Page

2. ADDITION OF TWO 8-BIT BCD
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 8-BIT NUMBER IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H MOV AL,BL ADD AL,DL DAA JNC NEXT INC CL NEXT:MOV BL,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H
3|Page

INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

4|Page

OUTPUT: ENTER FIRST NUMBER : 97 ENTER SECOND NUMBER : 56 SUM OF TWO 8-BIT NUMBER IS : 153

ENTER FIRST NUMBER : 82 ENTER SECOND NUMBER : 19 SUM OF TWO 8-BIT NUMBER IS : 101

5|Page

3. ADDITION OF TWO 16-BIT HEXADECIMAL NUMBERS
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 16-BIT NUMBER IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H ADD BX,DX JNC NEXT INC CL NEXT:CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3:MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H
6|Page

CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET

7|Page

DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER : 2345 ENTER SECOND NUMBER : 5646 SUM OF TWO 16-BIT NUMBER IS : 0798B ENTER FIRST NUMBER : FFFF ENTER SECOND NUMBER : AAAA SUM OF TWO 16-BIT NUMBER IS : 1AAA9

8|Page

4. ADDITION OF TWO 16-BIT BCD NUMBERS
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 16-BIT NUMBER IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H MOV AL,BL ADD AL,DL DAA MOV BL,AL MOV AL,BH ADC AL,DH DAA JNC NEXT INC CL NEXT:MOV BH,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3:MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H
9|Page

CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H
10 | P a g e

INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER : 6987 ENTER SECOND NUMBER : 3991 SUM OF TWO 16-BIT NUMBER IS : 10978 ENTER FIRST NUMBER : 9999 ENTER SECOND NUMBER : 8888 SUM OF TWO 16-BIT NUMBER IS : 18887

11 | P a g e

5. SUBTRACTION OF TWO 8-BIT HEXADECIMAL NUMBERS DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'SUBTRACTION OF TWO 8-BIT NUMBER IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H SUB BL,DL JNC NEXT NEG BL MOV CL,'-' NEXT:CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H
12 | P a g e

CMP AL,0AH JC R2 SUB AL,07H R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

13 | P a g e

OUTPUT: ENTER FIRST NUMBER : 55 ENTER SECOND NUMBER : AA SUBTRACTION OF TWO 8-BIT NUMBER IS : -55

ENTER FIRST NUMBER : FA ENTER SECOND NUMBER : 93 SUBTRACTION OF TWO 8-BIT NUMBER IS : -67

14 | P a g e

6. SUBTRACTION OF TWO 8-BIT BCD NUMBERS

DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NO:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NO:','$' MESS3 DB 0AH,0DH,'SUBTRACTION OF TWO 8-BIT NO IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H MOV AL,BL SUB AL,DL DAS JNC NEXT MOV CH,99H SUB CH,AL MOV AL,CH ADD AL,01H DAA MOV CL,'-' NEXT: MOV BL,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H
15 | P a g e

MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET
16 | P a g e

DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER : 98 ENTER SECOND NUMBER : 54 SUBTRACTION OF TWO 8-BIT NUMBER IS : 044

ENTER FIRST NUMBER : 87 ENTER SECOND NUMBER : 98 SUBTRACTION OF TWO 8-BIT NUMBER IS : -11

17 | P a g e

7. SUBTRACTION OF TWO 16-BIT HEXADECIMAL NUMBERS.
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER :''$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER :''$' MESS3 DB 0AH,0DH,'SUBTRACTION IS :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,' ' SUB BX,DX MOV CL,00H JNC NEXT INC CL MOV CL,'-' NEG BX NEXT: CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3: MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H
18 | P a g e

CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4:RET READ ENDP
DISP PROC NEAR PUBLIC DISP

LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL MOV AH,06H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET
DISP ENDP CODE ENDS END START 19 | P a g e

OUTPUT:
ENTER FIRST NUMBER : DE32 ENTER SECOND NUMBER : 97CA SUBTRACTION OF TWO 8-BIT NUMBER IS : 04668 ENTER FIRST NUMBER : 698F ENTER SECOND NUMBER : B2C6 SUBTRACTION OF TWO 8-BIT NUMBER IS : -4937

20 | P a g e

8. SUBTRACTION OF TWO 16-BIT BCD NUMBERS
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NO:','$' MESS2 DB 0AH,0DH,'ENTER SECOND NO:','$' MESS3 DB 0AH,0DH,'SUBTRACTION OF TWO 16-BIT NO IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV AX,BX MOV CL,' ' MOV AL,BL SUB AL,DL DAS MOV BL,AL MOV AL,BH SBB AL,DH DAS MOV BH,AL JNC NEXT MOV AX,0000H SUB AL,BL ADD DL,01H DAS MOV BL,AL MOV AL,AH SBB AL,BH DAS MOV BH,AL MOV CL,'-' NEXT: CALL DISP MOV AH,4CH INT 21H
21 | P a g e

READ PROC NEAR PUBLIC READ MOV CH,02H R3: MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL MOV AH,06H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H
22 | P a g e

INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER : 9873 ENTER SECOND NUMBER : 8642 SUBTRACTION OF TWO 8-BIT NUMBER IS : 01231 ENTER FIRST NUMBER : 2431 ENTER SECOND NUMBER : 9247 SUBTRACTION OF TWO 8-BIT NUMBER IS : -6816

23 | P a g e

9. MULTIPLICATION OF TWO 8-BIT HEXADECIMAL NUMBERS.
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE FIRST NUMBER:','$' MESS2 DB 0AH,0DH,'ENTER THE SECOND NUMBER:','$' MESS3 DB 0AH,0DH,'PRODUCT IS:','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV AX,BX MUL DL MOV BX,AX CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2
24 | P a g e

SUB AL,07H R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET DISP ENDP CODE ENDS END START

25 | P a g e

OUTPUT: ENTER FIRST NUMBER : 01 ENTER SECOND NUMBER : 01 PRODUCT IS : 0001 ENTER FIRST NUMBER : 0A ENTER SECOND NUMBER : 0A PRODUCT IS : 0064

26 | P a g e

10.MULTIPLICATION OF TWO 16-BIT NUMBERS (HEXADECIMAL) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER :''$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER :''$' MESS3 DB 0AH,0DH,'PRODUCT IS :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV AX,BX MUL DX MOV BX,DX MOV SI,AX CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3: MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H
27 | P a g e

INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4: RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,04H MOV CL,04H L3: MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL CMP CH,03H JNZ L5 MOV DX,SI L5:MOV BL,DH MOV DH,DL JMP L3
28 | P a g e

L4:RET DISP ENDP CODE ENDS END START

OUTPUT ENTER FIRST NUMBER : F4D9 ENTER SECOND NUMBER : 6A52 PRODUCT OF TWO NUMBERS : 65B04782

ENTER FIRST NUMBER : 23CD ENTER SECOND NUMBER : 542E PRODUCT OF TWO NUMBERS : 0BC5B2D6

29 | P a g e

10. DIVISION OF 8-BIT BY 8-BIT NUMBERS.
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE DIVIDEND:','$' MESS2 DB 0AH,0DH,'ENTER THE DIVISOR:','$' MESS3 DB 0AH,0DH,'DIVISION IS :','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV AH,00H MOV AL,BL DIV DL MOV BH,AL MOV AL,00H DIV DL MOV BL,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL
30 | P a g e

MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2:AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,02H LP1:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ NXT MOV DL,'.' MOV AH,06H INT 21H MOV BH,BL JMP LP1 NXT:RET DISP ENDP
31 | P a g e

CODE ENDS END START

OUTPUT: ENTER THE DIVIDEND : D1 ENTER THE DIVISOR : B2 DIVISION : 01.00 ENTER THE DIVIDEND : A2 ENTER THE DIVISOR : 13 DIVISION : 08.00

32 | P a g e

11. DIVISION OF 16-BIT BY 16-BIT NUMBERS. DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE DIVIDEND:','$' MESS2 DB 0AH,0DH,'ENTER THE DIVISOR:','$' MESS3 DB 0AH,0DH,'DIVISION IS :','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV SI,DX MOV DX,0000H MOV AX,BX DIV SI MOV BX,AX MOV AX,0000H DIV SI MOV SI,AX CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3:MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1
33 | P a g e

SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL DEC CH JZ R4 MOV DH,DL JMP R3 R4:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,02H MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H BACK:MOV DL,BL SHR DL,CL CMP DL,0AH JC L3
34 | P a g e

ADD DL,07H L3:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L4 ADD BL,07H L4:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H DEC CH JZ NXT MOV DL,'.' MOV AH,06H INT 21H MOV BX,SI MOV BL,BH JMP BACK NXT:RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER THE DIVIDEND : 6543 ENTER THE DIVISOR : 1234 DIVISION : 0005.90 ENTER THE DIVIDEND : FFFF ENTER THE DIVISOR : CCCC DIVISION : 0001.40

35 | P a g e

13.AVERAGE OF ‘N’ 8-BIT NUMBERS (HEXADECIMAL) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE LIMIT: ''$' MESS2 DB 0AH,0DH,'ENTER THE NUMBER:','$' MESS3 DB 0AH,0DH,'AVERAGE IS : ', '$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START :MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL MOV BH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,DL MOV dh,00h BACK: DEC CH MOV DL,',' MOV AH,06H INT 21H JZ NEXT CALL READ ADD BL,DL JNC LP1 INC DH LP1:JMP BACK NEXT:MOV AL,BL MOV AH,DH DIV BH MOV BL,AL MOV AL,00H DIV BH MOV BH,AL CALL DISP MOV AH,4CH INT 21H

36 | P a g e

READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,02H LP2: MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2: ADD BL,30H MOV DL,BL MOV AH,06H INT 21H DEC CH
37 | P a g e

JZ NXT MOV DL,'.' MOV AH,06H INT 21H MOV BL,BH JMP LP2 NXT:RET DISP ENDP CODE ENDS END START

OUPTUT: ENTER THE LIMIT: 05 ENTER THE NUMBERS: 34,65,24,87,45 THE AVERAGE IS : 4E.99

38 | P a g e

14. AVERAGE OF 8-BIT NUMBERS (BCD)

DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE LIMIT: ''$' MESS2 DB 0AH,0DH,'ENTER THE NUMBER:','$' MESS3 DB 0AH,0DH,'AVERAGE IS : ', '$' QUO DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START :MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,DL MOV DH,CH MOV BH,00H N1:MOV AL,CH SUB AL,01H DAS MOV CH,AL JZ N2 MOV DL,',' MOV AH,06H INT 21H CALL READ MOV AL,BL ADD AL,DL DAA MOV BL,AL JNC N3 MOV AL,BH ADD AL,01H DAA MOV BH,AL N3:JMP N1
39 | P a g e

N2:MOV CH,02H MOV DL,DH MOV DH,00H MOV CL,00H N4: MOV AX,BX SUB AL,DL DAS MOV BL,AL MOV AL,BH SBB AL,00H DAS MOV BH,AL MOV AL,CL ADD AL,01H DAA MOV CL,AL CMP BX,DX JAE N4 DEC CH JZ N5 MOV QUO,CL MOV CL,00H MOV BH,BL JMP N4 N5: MOV BL,QUO MOV BH,CL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H SHL AL,CL MOV DL,AL MOV AH,01H INT 21H AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR
40 | P a g e

PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CH,02H LOP:MOV CL,04H MOV DL,BL SHR DL,CL ADD DL,30H MOV AH,06H INT 21H AND BL,0FH ADD BL,30H MOV DL,BL MOV AH,06H INT 21H DEC CH JZ RT CMP CH,01H JNZ L3 MOV DL,'.' MOV AH,06H INT 21H L3:MOV BL,BH JMP LOP RT:RET DISP ENDP CODE ENDS END START OUPTUT: ENTER THE LIMIT: 05 ENTER THE NUMBERS: 34,45,56,67,78 THE AVERAGE IS : 56

41 | P a g e

15.ADDITION OF TWO 6-DIGIT NUMBERS (HEXADECIMAL) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE 1ST NUMBER: ''$' MESS2 DB 0AH,0DH,'ENTER THE 2ND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 6-DIGIT NUMBER IS : ', '$' QUO DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START :MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV SI,DX MOV BL,BH LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H ADD SI,DX ADC BL,BH JNC NEXT INC CL NEXT: CALL DISP MOV AH,4CH INT 21H

READ PROC NEAR PUBLIC READ MOV CH,03H X1:MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL
42 | P a g e

MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2:AND AL,0FH OR DL,AL DEC CH JZ X2 CMP CH,02H JNZ R3 MOV BH,DL JMP X1 R3:MOV DH,DL JMP X1 X2:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CH,03H LP1:MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H
43 | P a g e

DEC CH JZ LAST CMP CH,02H JNZ L3 MOV DX,SI L3: MOV BL,DH MOV DH,DL JMP LP1 LAST :RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER: 23ABCF ENTER FIRST NUMBER:F45C24 SUM OF TWO NUMBERS:11807F3

ENTER FIRST NUMBER: 111111 ENTER FIRST NUMBER:222222 SUM OF TWO NUMBERS:0333333

44 | P a g e

16.ADDITION OF TWO 6-DIGIT NUMBERS (BCD) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE 1ST NUMBER: ''$' MESS2 DB 0AH,0DH,'ENTER THE 2ND NUMBER:','$' MESS3 DB 0AH,0DH,'SUM OF TWO 6-DIGIT NUMBER IS : ', '$' QUO DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START :MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV SI,DX MOV BH,BL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV CL,00H ADD AL,DL DAA MOV DL,AL MOV AL,AH ADC BH,BL MOV DH,DL MOV SI,DX ADC BH,BL MOV AL,BH DAA MOV BH,AL JNC NEX INC CL NEXT: CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,03H X1:MOV AH,01H INT 21H
45 | P a g e

MOV DL,AL MOV CL,04H SUB DL,30H R1:SHL DL,CL MOV AH,01H INT 21H R2:AND AL,0FH OR DL,AL DEC CH JZ X2 CMP CH,01H JZ R3 R3:MOV DH,DL JMP X1 X2:RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV DL,CL ADD DL,30H MOV AH,06H INT 21H MOV CH,03H LP1:MOV CL,04H MOV DL,BH SHR DL,CL L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ LAST CMP CH,02H JNZ L3 MOV DX,SI L3: MOV BH,DH MOV DH,DL
46 | P a g e

JMP LP1 LAST :RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER: 234567 ENTER FIRST NUMBER:954132 SUM OF TWO NUMBERS:1188699

ENTER FIRST NUMBER: 111111 ENTER FIRST NUMBER:222222 SUM OF TWO NUMBERS:0333333

47 | P a g e

17.TO FIND MAXIMUM AND MINIMUM OF GIVEN NUMBERS.
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'ENTER NUMBERS :''$' MESS3 DB 0AH,0DH,'MAXIMUM IS :''$' MESS4 DB 0AH,0DH,'MINIMUM IS :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BH,DL MOV BL,DL L1:DEC CH JZ L2 MOV DL,',' MOV AH,06H INT 21H CALL READ MOV DH,DL CMP BH,DL JAE L3 XCHG BH,DL L3:CMP BL,DH JBE L4 XCHG BL,DH L4:JMP L1 L2:LEA DX,MESS3 MOV AH,09H INT 21H CALL DISP LEA DX,MESS4 MOV AH,09H
48 | P a g e

INT 21H MOV BH,BL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC N1 ADD DL,07H N1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC N2 ADD BH,07H N2:ADD BH,30H MOV DL,BH MOV AH,06H
49 | P a g e

INT 21H RET DISP ENDP CODE ENDS END START OUTPUT: ENTER LIMIT : 05 ENTER NUMBERS : 22, 78, 96, 30, 12 MAXIMUM IS : 96 MINIMUM IS : 12

ENTER LIMIT : 07 ENTER NUMBERS : 32,12,F4,09,67,F5,8D MAXIMUM IS : F5 MINIMUM IS : 09

50 | P a g e

18. SORTING OF ‘N’NUMBERS DATA SEGMENT M1 DB 0AH,0DH,'ENTER THE LIMIT:' , '$' M2 DB 0AH,0DH,'THE NUMBERS IS:' , '$' M3 DB 0AH,0DH,'THE SORTED NUMBERS ARE :' , '$' ARRAY DB 20 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START : MOV AX,DATA MOV DS,AX LEA DX,M1 MOV AH,09H INT 21H CALL READ MOV BL,CH MOV BH,CH MOV DI,BX LEA DX,M2 MOV AH,09H INT 21H LEA SI ,ARRAY L1: CALL READ MOV [SI],CH INC SI DEC BL JNZ L1 LEA DX,M3 MOV AH,09H INT 21H LEA BP,ARRAY L2: MOV BL,BH MOV SI,BP L4: DEC BL JZ L3 INC SI MOV AL,[BP] CMP AL,[SI] JNA L4 MOV AH,[SI] MOV [SI],AL MOV [BP],AH JMP L4
51 | P a g e

L3:INC BP DEC BH JNZ L2 LEA SI,ARRAY MOV BX,DI L5:CALL DISP INC SI DEC BH JNZ L5 MOV AX,4C00H INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R1 SUB AL,07H R1:MOV CL,04H SHL AL,CL MOV CH,AL MOV AH,01H INT 21H SUB AL,30H CMP AL, 0AH JC R2 SUB AL,07H AND AL,0FH R2:OR CH,AL MOV DL,' ' MOV AH,06H INT 21H RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV BL,[SI] MOV DL,BL SHR DL,CL CMP DL,0AH JC X1 ADD DL,07H
52 | P a g e

X1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC X2 ADD BL,07H X2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H MOV DL,' ' MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT:

ENTER THE LIMIT : 05 THE NO IS : 65 41 37 82 04 THE SORTED NUMBERS ARE : 04 37 41 65 82

ENTER THE LIMIT : 06 THE NO IS : 23 ,06,14,98,67,25 THE SORTED NUMBERS ARE : 06,14,23,25,67,98

53 | P a g e

19.ADDITION OF TWO MATRICES (HEXADECIMAL)
DATA SEGMENT M1 DB 'ENTER THE ORDER OF FIRST MATRIX:','$' M2 DB 0AH,0DH,0AH,'ENTER THE ORDER OF SECOND MATRIX:','$' M3 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF FIRST MATRIX:',0AH,0DH,'$' M4 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF SECOND MATRIX:',0AH,0DH,'$' M5 DB 0AH,0DH,0AH,' SUM OF TWO MATRICES: ',0AH,0DH, '$' M6 DB 0AH,0DH,0AH,' MATRICES CANNOT BE ADDED: ','$' MAT1 DB 10 DUP(0) MAT2 DB 10 DUP(0) MAT3 DB 30 DUP(0) ROW DB 00H COL DB 00H DATA ENDS MESSAGE MACRO MESS LEA DX,MESS MOV AH,09H INT 21H ENDM BSPCE MACRO ASC MOV DL,ASC MOV AH,06H INT 21H ENDM CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX MESSAGE M1 CALL READO MOV BX,DX MOV ROW,DH MOV COL,DL MESSAGE M2 CALL READO CMP BX,DX JZ L1 MESSAGE M6 JMP L7 L1:MESSAGE M3 LEA SI,MAT1
54 | P a g e

CALL READ1 MESSAGE M4 LEA SI,MAT2 CALL READ1 MESSAGE M5 BSPCE 0AH LEA DI,MAT1 LEA SI,MAT2 LEA BX,MAT3 MOV CH,ROW L6:MOV CL,COL L2:MOV DH,00H MOV DL,[SI] ADD DL,[DI] JNC L5 INC DH L5:MOV [BX],DH INC BX MOV [BX],DL INC DI INC SI INC BX DEC CL JNZ L2 DEC CH JZ L3 JMP L6 L3: CALL DISP L7: MOV AH,4CH INT 21H

READO PROC NEAR PUBLIC READO MOV AH,01H INT 21H MOV DH,AL SUB DH,30H BSPCE ' ' MOV AH,01H INT 21H MOV DL,AL SUB DL,30H RET READO ENDP

55 | P a g e

READ1 PROC NEAR PUBLIC READ1 BSPCE 0AH MOV CH,ROW N2:MOV BH,COL N1:CALL READ MOV [SI],DL INC SI BSPCE ' ' DEC BH JNZ N1 DEC CH JZ N3 BSPCE 0AH BSPCE 0DH JMP N2 N3:RET READ1 ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL, 0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA BX,MAT3 MOV CH,ROW D4:MOV DH,COL
56 | P a g e

LOP:MOV CL,04H MOV DL,[BX] ADD DL,30H MOV AH,06H INT 21H INC BX MOV CL,04H MOV DL,[BX] SHR DL,CL CMP DL,0AH JC D1 ADD DL,07H D1: ADD DL,30H MOV AH,06H INT 21H MOV DL,[BX] AND DL,0FH CMP DL,0AH JC D2 ADD DL,07H D2: ADD DL,30H MOV AH,06H INT 21H INC BX BSPCE ' ' DEC DH JNZ LOP DEC CH JZ D3 BSPCE 0AH BSPCE 0DH JMP D4 D3: RET DISP ENDP CODE ENDS END START

57 | P a g e

OUTPUT 1: ENTER THE ORDER OF FIRST MATRIX : 2 2 ENTER THE ORDER OF SECOND MATRIX : 2 2 ENTER THE ELEMENTS OF FIRST MATRIX: 11 11 11 11 ENTER THE ORDER OF SECOND MATRIX 02 02 02 02 SUM OF TWO MATRICES: 013 013 014 014

OUTPUT 2: ENTER THE ORDER OF FIRST MATRIX : 2 3 ENTER THE ORDER OF SECOND MATRIX : 2 2 MATRICES CANNOT BE ADDED

58 | P a g e

20.ADDITION OF TWO MATRICES (BCD)
DATA SEGMENT M1 DB 'ENTER THE ORDER OF FIRST MATRIX:','$' M2 DB 0AH,0DH,0AH,'ENTER THE ORDER OF SECOND MATRIX:','$' M3 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF FIRST MATRIX:',0AH,0DH,'$' M4 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF SECOND MATRIX:',0AH,0DH,'$' M5 DB 0AH,0DH,0AH,' SUM OF TWO MATRICES: ',0AH,0DH, '$' M6 DB 0AH,0DH,0AH,' MATRICES CANNOT BE ADDED: ','$' MAT1 DB 10 DUP(0) MAT2 DB 10 DUP(0) MAT3 DB 30 DUP(0) ROW DB 00H COL DB 00H DATA ENDS MESSAGE MACRO MESS LEA DX,MESS MOV AH,09H INT 21H ENDM BSPCE MACRO ASC MOV DL,ASC MOV AH,06H INT 21H ENDM CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX MESSAGE M1 CALL READO MOV BX,DX MOV ROW,DH MOV COL,DL MESSAGE M2 CALL READO CMP BX,DX JZ L1 MESSAGE M6 JMP L7 L1:MESSAGE M3 LEA SI,MAT1
59 | P a g e

CALL READ1 MESSAGE M4 LEA SI,MAT2 CALL READ1 MESSAGE M5 BSPCE 0AH LEA DI,MAT1 LEA SI,MAT2 LEA BX,MAT3 MOV CH,ROW L6:MOV CL,COL L2:MOV DH,00H MOV AL,[SI] ADD AL,[DI] DAA JNC L5 INC DH L5:MOV [BX],DH INC BX MOV [BX],AL INC DI INC SI INC BX DEC CL JNZ L2 DEC CH JZ L3 JMP l6 L3: CALL DISP L7: MOV AH,4CH INT 21H

READO PROC NEAR PUBLIC READO MOV AH,01H INT 21H MOV DH,AL SUB DH,30H BSPCE ' ' MOV AH,01H INT 21H MOV DL,AL SUB DL,30H RET READO ENDP
60 | P a g e

READ1 PROC NEAR BSPCE 0AH MOV CH,ROW N2:MOV BH,COL N1:CALL READ MOV [SI],DL INC SI BSPCE ' ' DEC BH JNZ N1 DEC CH JZ N3 BSPCE 0AH BSPCE 0DH JMP N2 N3:RET READ1 ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H SHL DL,CL MOV AH,01H INT 21H AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA BX,MAT3 MOV CH,ROW D4:MOV DH,COL LOP:MOV CL,04H MOV DL,[BX] ADD DL,30H MOV AH,06H INT 21H INC BX
61 | P a g e

MOV CL,04H MOV DL,[BX] SHR DL,CL ADD DL,30H MOV AH,06H INT 21H MOV DL,[BX] AND DL,0FH ADD DL,30H MOV AH,06H INT 21H INC BX BSPCE ' ' DEC DH JNZ LOP DEC CH JZ D3 BSPCE 0AH BSPCE 0DH JMP D4 D3: RET DISP ENDP CODE ENDS END START ENTER THE ORDER OF FIRST MATRIX : 2 2 ENTER THE ORDER OF SECOND MATRIX : 2 2 ENTER THE ELEMENTS OF FIRST MATRIX: 12 13 15 14 ENTER THE ORDER OF SECOND MATRIX 02 02 02 02 SUM OF TWO MATRICES: 014 016 017 016

62 | P a g e

21. SUBTRACTION OF TWO MATRICES (HEXADECIMAL)
DATA SEGMENT M1 DB 'ENTER THE ORDER OF FIRST MATRIX:','$' M2 DB 0AH,0DH,0AH,'ENTER THE ORDER OF SECOND MATRIX:','$' M3 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF FIRST MATRIX:',0AH,0DH,'$' M4 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF SECOND MATRIX:',0AH,0DH,'$' M5 DB 0AH,0DH,0AH,' DIFFERENCE OF TWO MATRICES: ',0AH,0DH, '$' M6 DB 0AH,0DH,0AH,' MATRICES CANNOT BE ADDED: ','$' MAT1 DB 10 DUP(0) MAT2 DB 10 DUP(0) MAT3 DB 30 DUP(0) ROW DB 00H COL DB 00H DATA ENDS MESSAGE MACRO MESS LEA DX,MESS MOV AH,09H INT 21H ENDM BSPCE MACRO ASC MOV DL,ASC MOV AH,06H INT 21H ENDM CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX MESSAGE M1 CALL READO MOV BX,DX MOV ROW,DH MOV COL,DL MESSAGE M2 CALL READO CMP BX,DX JZ L1 MESSAGE M6 JMP L7 L1:MESSAGE M3 LEA SI,MAT1
63 | P a g e

CALL READ1 MESSAGE M4 LEA SI,MAT2 CALL READ1 MESSAGE M5 BSPCE 0AH LEA DI,MAT1 LEA SI,MAT2 LEA BX,MAT3 MOV CH,ROW L6:MOV CL,COL L2:MOV DH,' ' MOV DL,[DI] SUB DL,[SI] JNC L52 NEG DL MOV DH,'-' L5:MOV [BX],DH INC BX MOV [BX],DL INC DI INC SI INC BX DEC CL JNZ L2 DEC CH JZ L3 JMP L6 L3: CALL DISP L7: MOV AH,4CH INT 21H

READO PROC NEAR PUBLIC READO MOV AH,01H INT 21H MOV DH,AL SUB DH,30H BSPCE ' ' MOV AH,01H INT 21H MOV DL,AL SUB DL,30H RET READO ENDP
64 | P a g e

READ1 PROC NEAR BSPCE 0AH MOV CH,ROW N2:MOV BH,COL N1:CALL READ MOV [SI],DL INC SI BSPCE ' ' DEC BH JNZ N1 DEC CH JZ N3 BSPCE 0AH BSPCE 0DH JMP N2 N3:RET READ1 ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H AND DL,0FH R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL, 0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA BX,MAT3 MOV CH,ROW D4:MOV DH,COL
65 | P a g e

LOP:MOV CL,04H MOV DL,[BX] MOV AH,06H INT 21H INC BX MOV DL,[BX] SHR DL,CL CMP DL,0AH JC D1 ADD DL,07H D1: ADD DL,30H MOV AH,06H INT 21H MOV DL,[BX] AND DL,0FH CMP DL,0AH JC D2 ADD DL,07H D2: ADD DL,30H MOV AH,06H INT 21H INC BX BSPCE ' ' DEC DH JNZ LOP DEC CH JZ D3 BSPCE 0AH BSPCE 0DH JMP D4 D3: RET DISP ENDP CODE ENDS END START

66 | P a g e

OUTPUT ENTER THE ORDER OF FIRST MATRIX : 2 2 ENTER THE ORDER OF SECOND MATRIX : 2 2 ENTER THE ELEMENTS OF FIRST MATRIX: 55 75 65 85

ENTER THE ORDER OF SECOND MATRIX 02 02 02 02 DIFFERENCE OF TWO MATRICES: 053 063 073 083 OUTPUT ENTER THE ORDER OF FIRST MATRIX : 2 2 ENTER THE ORDER OF SECOND MATRIX : 2 3 MATRICES CANNOT BE SUBTRACTED

67 | P a g e

22. SUBTRACTION OF TWO MATRICES (BCD) DATA SEGMENT M1 DB 'ENTER THE ORDER OF FIRST MATRIX:','$' M2 DB 0AH,0DH,0AH,'ENTER THE ORDER OF SECOND MATRIX:','$' M3 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF FIRST MATRIX:',0AH,0DH,'$ M4 DB 0AH,0DH,0AH,'ENTER THE ELEMENTS OF SECOND MATRIX:',0AH,0DH,'$' M5 DB 0AH,0DH,0AH,' DIFFERENCE OF TWO MATRICES: ',0AH,0DH, '$' M6 DB 0AH,0DH,0AH,' MATRICES CANNOT BE ADDED: ','$' MAT1 DB 10 DUP(0) MAT2 DB 10 DUP(0) MAT3 DB 30 DUP(0) ROW DB 00H COL DB 00H DATA ENDS MESSAGE MACRO MESS LEA DX,MESS MOV AH,09H INT 21H ENDM BSPCE MACRO ASC MOV DL,ASC MOV AH,06H INT 21H ENDM CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX MESSAGE M1 CALL READO MOV BX,DX MOV ROW,DH MOV COL,DL MESSAGE M2 CALL READO CMP BX,DX JZ L1 MESSAGE M6 JMP L7 L1:MESSAGE M3 LEA SI,MAT1
68 | P a g e

CALL READ1 MESSAGE M4 LEA SI,MAT2 CALL READ1 MESSAGE M5 BSPCE 0AH LEA DI,MAT1 LEA SI,MAT2 LEA BX,MAT3 MOV CH,ROW L6:MOV CL,COL L2:MOV DH,' ' MOV AL,[DI] SUB AL,[SI] DAS JNC L5 MOV DL,99H SUB DL,AL MOV AL,DL ADD AL,01H DAA MOV DH,'-' L5:MOV [BX],DH INC BX MOV [BX],AL INC DI INC SI INC BX DEC CL JNZ L2 DEC CH JZ L3 JMP L6 L3: CALL DISP L7: MOV AH,4CH INT 21H READO PROC NEAR PUBLIC READO MOV AH,01H INT 21H MOV DH,AL SUB DH,30H BSPCE ' ' MOV AH,01H INT 21H
69 | P a g e

MOV DL,AL SUB DL,30H RET READO ENDP READ1 PROC NEAR BSPCE 0AH MOV CH,ROW N2:MOV BH,COL N1:CALL READ MOV [SI],DL INC SI BSPCE ' ' DEC BH JNZ N1 DEC CH JZ N3 BSPCE 0AH BSPCE 0DH JMP N2 N3:RET READ1 ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H SHL DL,CL MOV AH,01H INT 21H AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA BX,MAT3 MOV CH,ROW D4:MOV DH,COL LOP:MOV CL,04H MOV DL,[BX]
70 | P a g e

MOV AH,06H INT 21H INC BX MOV DL,[BX] SHR DL,CL D1: ADD DL,30H MOV AH,06H INT 21H MOV DL,[BX] AND DL,0FH D2: ADD DL,30H MOV AH,06H INT 21H INC BX BSPCE ' ' DEC DH JNZ LOP DEC CH JZ D3 BSPCE 0AH BSPCE 0DH JMP D4 D3: RET DISP ENDP CODE ENDS END START OUTPUT ENTER THE ORDER OF FIRST MATRIX : 2 2 ENTER THE ORDER OF SECOND MATRIX : 2 2 ENTER THE ELEMENTS OF FIRST MATRIX: 10 10 10 10

ENTER THE ORDER OF SECOND MATRIX 02 02 02 02 DIFFERENCE OF TWO MATRICES: 08 08 08 08

71 | P a g e

23.TRANSPOSE OF THE MATRIX
DATA SEGMENT M1 DB 'ENTER THE ORDER OF THE MATRIX:','$' M2 DB 0AH,0DH,0AH,'ENTER THE ORDER OF SECOND MATRIX:','$' M3 DB 0AH,0DH,0AH,'TRANSPOSE MATRIX:',0AH,0DH,'$' MAT1 DB 10 DUP(0) MAT2 DB 10 DUP(0) ROW DB 00H COL DB 00H DATA ENDS MESSAGE MACRO MESS LEA DX,MESS MOV AH,09H INT 21H ENDM BSPCE MACRO ASC MOV DL,ASC MOV AH,06H INT 21H ENDM CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX MESSAGE M1 CALL READO MOV BX,DX MOV ROW,DH MOV COL,DL MESSAGE M2 LEA SI,MAT1 CALL READ1 LEA DI,MAT1 LEA SI,MAT2 MOV DH,00H MOV DL,COL MOV AH,COL L3:MOV AL,ROW MOV BX,DI L1:MOV CL,[BX] MOV [SI],CL
72 | P a g e

ADD BX,DX INC SI DEC AL JNZ L1 INC DI DEC AH JNZ L3 LEA SI,MAT2 CALL DISP MOV AH,4CH INT 21H

READO PROC NEAR PUBLIC READO MOV AH,01H INT 21H MOV DH,AL SUB DH,30H BSPCE ' ' MOV AH,01H INT 21H MOV DL,AL SUB DL,30H RET READO ENDP

READ1 PROC NEAR BSPCE 0AH MOV CH,ROW N2:MOV BH,COL N1:CALL READ MOV [SI],DL INC SI BSPCE ' ' DEC BH JNZ N1 DEC CH JZ N3 BSPCE 0AH BSPCE 0DH JMP N2 N3:RET READ1 ENDP

73 | P a g e

READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H AND DL,0FH R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL, 0AH JC R2 SUB AL,07H AND AL,0FH R2:OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MESSAGE M3 BSPCE 0AH MOV DH,COL D4:MOV BH,ROW LOP:MOV CL,04H MOV DL,[SI] SHR DL,CL CMP DL,0AH JC D1 ADD DL,07H D1: ADD DL,30H MOV AH,06H INT 21H MOV DL,[SI] AND DL,0FH CMP DL,0AH JC D2 ADD DL,07H
74 | P a g e

D2: ADD DL,30H MOV AH,06H INT 21H INC SI BSPCE ' ' DEC BH JNZ LOP DEC DH JZ D3 BSPCE 0AH BSPCE 0DH JMP D4 D3: RET DISP ENDP CODE ENDS END START

OUTPUT :

ENTER THE ORDER OF THE MATRIX : 2 3 ENTER THE ELEMENTS OF THE MATRIX: 11 55 99 22 74 51 TRANSPOSE MATRIX : 11 22 55 74 99 51

75 | P a g e

24.GENERATION OF PRIME NUMBERS(HEXADECIMAL) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'PRIME NUMBERS UPTO LIMIT :''$' MESS3 DB 0AH,0DH,'NO OF ELEMENTS IN PRIME SERIES= ''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H XOR SI,SI MOV DH,00H L1: INC DH JZ L3 CMP DH,CH JA L3 CALL SQRT MOV BH,01H L2:MOV AL,DH MOV AH,00H INC BH CMP BH,DL JA L4 DIV BH CMP AH,00H JNZ L2 JMP L1 L4:MOV BL,DH CALL DISP MOV DL,',' MOV AH,06H INT 21H INC SI JMP L1 L3:LEA DX,MESS3 MOV AH,09H
76 | P a g e

INT 21H MOV BX,SI CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2: OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC N1 ADD DL,07H N1: ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC N2 ADD BL,07H N2:ADD BL,30H MOV DL,BL
77 | P a g e

MOV AH,06H INT 21H RET DISP ENDP SQRT PROC NEAR PUBLIC DISP MOV DL,00H T1:INC DL MOV AL,DH MOV AH,00H DIV DL CMP DL,AL JC T1 JZ T2 DEC DL T2:RET SQRT ENDP CODE ENDS END START

OUTPUT:

ENTER LIMIT : 0F PRIME NUMBERS UPTO LIMIT : 01,02,03,05,07,0B,0D NO. OF ELEMENTS IN PRIME SERIES : 07

78 | P a g e

25. GENERATION OF PRIME NUMBERS (BCD)
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'PRIME NUMBERS UPTO LIMIT :''$' MESS3 DB 0AH,0DH,'NO OF ELEMENTS IN PRIME SERIES= ''$' NUM DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H MOV DH,00H MOV SI,0000H L1:MOV AL,DH ADD AL,01H DAA JC L3 MOV DH,AL CMP DH,CH JA L3 CALL SQRT MOV BH,01H L2:MOV AL,BH ADD AL,01H DAA MOV BH,AL CMP BH,DL JA L4 MOV AH,00H MOV NUM,DH L5:MOV AL,NUM SUB AL,BH DAS MOV NUM,AL MOV AL,AH
79 | P a g e

ADD AL,01H DAA MOV AH,AL CMP NUM,BH JAE L5 CMP NUM,00H JZ L1 JMP L2 L4: MOV BL,DH CALL DISP MOV DL,'.' MOV AH,06H INT 21H MOV AX,SI ADD AL,01H DAA MOV SI,AX JMP L1 L3:LEA DX,MESS3 MOV AH,09H INT 21H MOV BX,SI CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H SHL DL,CL MOV AH,01H INT 21H SUB AL,30H OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL
80 | P a g e

SHR DL,CL ADD DL,30H MOV AH,06H INT 21H AND BL,0FH ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP SQRT PROC NEAR PUBLIC DISP MOV DL,00H T1:INC DL MOV BL,00H MOV CL,DH T2:MOV AL,CL SUB AL,DL DAS MOV CL,AL INC BL CMP CL,DL JAE T2 CMP DL,BL JC T1 JE T3 DEC DL T3:RET

SQRT ENDP CODE ENDS END START

OUTPUT: ENTER LIMIT : 09 PRIME NUMBERS UPTO LIMIT : 01,02,03,05,07 NO. OF ELEMENTS IN PRIME SERIES : 05

81 | P a g e

26.GENERATION OF PERFECT DIVIDING NUMBERS(HEXADECIMAL) DATA SEGMENT MESS1 DB 'ENTER THE LIMIT :','$' MESS2 DB 0AH,0DH,'PERFECT DIVISORS:','$' MESS3 DB 0AH,0DH,'NUMBER OF PERFECT DIVISORS UPTO THE LIMIT=','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H XOR SI,SI MOV DH,01H L1: INC DH JZ L3 CMP DH,CH JA L3 CALL SQRT MOV BL,01H MOV BH,01H L2: INC BH CMP BH,DL JA L4 MOV AH,00H MOV AL,DH DIV BH CMP AH,00H JNE L2 ADD AL,BH ADD BL,AL JMP L2 L4: CMP BL,DH JNE L1 CALL DISP MOV DL,' ' MOV AH,06H
82 | P a g e

INT 21H INC SI JMP L1 L3:LEA DX,MESS3 MOV AH,09H INT 21H MOV BX,SI CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC N1 ADD DL,07H N1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH
83 | P a g e

CMP BL,0AH JC N2 ADD BL,07H N2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP SQRT PROC NEAR PUBLIC SQRT MOV DL,00H T1:INC DL MOV AL,DH MOV AH,00H DIV DL CMP DL,AL JC T1 JZ T2 DEC DL T2:RET SQRT ENDP CODE ENDS END START

OUTPUT: ENTER LIMIT : FF PERFECT DIVISORS ARE: 06 1C NO. OF ELEMENTS : 02

84 | P a g e

27.GENERATION OF PERFECT DIVIDING NUMBERS(HEXADECIMAL) DATA SEGMENT MESS1 DB 'ENTER THE LIMIT :','$' MESS2 DB 0AH,0DH,'PERFECT DIVISORS :','$' MESS3 DB 0AH,0DH,'NUMBER OF PERFECT DIVISORS UPTO THE LIMIT=','$' LIM DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ LEA DX,MESS2 MOV AH,09H INT 21H XOR DI,DI CALL PERFECT LEA DX,MESS3 MOV AH,09H INT 21H MOV CX,DI MOV BL,CL CALL DISP MOV AH,4CH INT 21H

PERFECT PROC NEAR PUBLIC PERFECT MOV BL,01H P1:CMP BH,BL JA P3 RET P3: CALL SQRT MOV DL,01H MOV CH,CL MOV CL,02H P4: CMP CH,CL JC P5 MOV AH,BL
85 | P a g e

XOR DH,DH CALL DIVD CMP AH,00H JNZ P7 MOV AL,DL ADD AL,DH DAA ADD AL,CL DAA MOV DL,AL P7: MOV AL,CL ADD AL,01H DAA MOV CL,AL JMP P4 P5: CMP DL,01H JE P6 CMP BL,DL JNE P6 CALL DISP MOV AX,DI ADD AL,01H DAA MOV DI,AX P6: MOV AL,BL ADD AL,01H DAA MOV BL,AL JMP P1 PERFECT ENDP

SQRT PROC NEAR PUBLIC SQRT MOV CL,01H B3: XOR DH,DH MOV AH,BL MOV AL,CL ADD AL,01H DAA MOV CL,AL CALL DIVD CMP DH,CL JAE B3 MOV AL,CL SUB AL,01H
86 | P a g e

DAS MOV CL,AL RET SQRT ENDP DIVD PROC NEAR PUBLIC DIVD B1: CMP AH,CL JB B2 MOV AL,AH SUB AL,CL DAS MOV AH,AL MOV AL,DH ADD AL,01H DAA MOV DH,AL JMP B1 B2:RET DIVD ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV BH,AL SUB BH,30H MOV CL,04H SHL BH,CL MOV AH,01H INT 21H SUB AL,30H OR BH,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV AH,BL MOV DL,AH MOV CL,04H SHR AH,CL ADD AH,30H MOV DL,AH MOV AH,06H INT 21H
87 | P a g e

MOV AH,BL AND AH,0FH ADD AH,30H MOV DL,AH MOV AH,06H INT 21H MOV DL,' ' MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START OUTPUT: ENTER LIMIT : 99 PERFECT DIVISORS ARE: 06 28 NO. OF ELEMENTS : 02

ENTER LIMIT : 20 PERFECT DIVISORS ARE: 06 NO. OF ELEMENTS : 01

88 | P a g e

27.GENERATION OF FIBONACCI SERIES (HEXADECIMAL) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE LIMIT:''$' MESS2 DB 0AH,0DH,'FIBONACCI SERIES UPTO THE LIMIT ','$' MESS3 DB 0AH,0DH,'THE NUMBER OF ELEMENTS IN FIBONACCI SERIES IS: ','$' MESS4 DB 'IS: ','$' TEMP DB 01H COUNT DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,CH CALL DISP LEA DX,MESS4 MOV AH,09H INT 21H XOR BX,BX AGAIN: INC COUNT CALL DISP ADD TEMP,BH JC NEXT MOV BL,TEMP MOV TEMP,BH MOV BH,BL CMP BL,CH JA NEXT JMP AGAIN NEXT:LEA DX,MESS3 MOV AH,09H INT 21H MOV AL,COUNT ADD AL,00H DAA
89 | P a g e

MOV BL,AL CALL DISP MOV AH,4CH INT 21H

READ PROC NEAR PUBLIC READ MOV CL,04H MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV DL,' ' MOV AH,06H INT 21H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH
90 | P a g e

JC L2 ADD BL,07H L2: ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT ENTER THE LIMIT: AA FIBONACCI SERIES UPTO THE LIMIT AA IS : 00 01 01 02 03 05 08 0D 15 22 37 59 90 NUMBERS OF ELEMENTS IN FIBONACCI SERIES : 13

91 | P a g e

28.GENERATION OF FIBONACCI SERIES (BCD) DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE LIMIT:''$' MESS2 DB 0AH,ODH'FIBONACCI SERIES UPTO THE LIMIT ','$' MESS3 DB 0AH,0DH,'THE NUMBER OF ELEMENTS IN FIBONACCI SERIES IS: ','$' MESS4 DB 'IS: ','$' TEMP DB 01H COUNT DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,CH CALL DISP LEA DX,MESS4 MOV AH,09H INT 21H XOR BX,BX AGAIN: INC COUNT CALL DISP ADD TEMP,BH JC NEXT MOV BL,TEMP MOV TEMP,BH MOV BH,BL CMP BL,CH JA NEXT JMP AGAIN NEXT:LEA DX,MESS3 MOV AH,09H INT 21H MOV AL,COUNT ADD AL,00H
92 | P a g e

DAA MOV BL,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CL,04H MOV AH,01H INT 21H MOV DL,AL MOV CL,04H SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV DL,' ' MOV AH,06H INT 21H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2
93 | P a g e

ADD BL,07H L2: ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER LIMIT : FF PERFECT DIVISORS ARE: 06 1C NO. OF ELEMENTS IN PRIME SERIES : 02

ENTER THE LIMIT: 08 THE FIBONACCI SERIES UPTO THE LIMIT 09 IS: 00,01,01,02,03,05,08 NUMBERS OF ELEMENTS IN THE FIBONACCI SERIES:07

94 | P a g e

29.GENERATION OF FIBONACCI SERIES (BCD)
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE LIMIT:''$' MESS2 DB 0AH,0DH,'FIBONACCI SERIES UPTO THE LIMIT ','$' MESS3 DB 0AH,0DH,'THE NUMBER OF ELEMENTS IN FIBONACCI SERIES IS: ','$' MESS4 DB 'IS: ','$' TEMP DB 01H COUNT DB 00H DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START:MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,CH CALL DISP LEA DX,MESS4 MOV AH, 09H INT 21H XOR BX,BX AGAIN: INC COUNT CALL DISP MOV AL,TEMP ADD AL,BH DAA JC NEXT MOV BL,AL MOV TEMP,BH MOV BH,BL CMP BL,CH JA NEXT JMP AGAIN NEXT:LEA DX,MESS3 MOV AH,09H INT 21H
95 | P a g e

MOV AL,COUNT ADD AL,00H DAA MOV BL,AL CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CL,04H MOV AH,01H INT 21H SHL AL,CL MOV DL,AL MOV AH,01H INT 21H AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV DL,' ' MOV AH,06H INT 21H MOV DL,BL SHR DL,CL ADD DL,30H MOV AH,06H INT 21H AND BL,0FH ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START OUTPUT
ENTER THE LIMIT: 99 FIBONACCI SERIES UPTO THE LIMIT 99 IS : 00 01 01 02 03 05 08 13 21 34 55 89 NUMBER OF ELEMENTS IN THE FIBONACCI SERIES :12 96 | P a g e

30.FACTORIAL OF A NUMBER USING RECURSION TECHNIQUE
DATA SEGMENT MESS1 DB 'ENTER THE NUMBER(0-8):''$' MESS2 DB 0AH,0DH, ' FACTORIAL OF THE GIVEN NUMBER=''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL MOV AX,0001H MOV BH,00H CALL FACT MOV BX,AX CALL DISP MOV AH,4CH INT 21H FACT PROC NEAR PUBLIC FACT CMP BX,0001H JBE NEXT MUL BX DEC BX CALL FACT NEXT:RET FACT ENDP READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV DL,AL SUB DL,30H RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS2 MOV AH,09H
97 | P a g e

INT 21H MOV CL,04H MOV CH,02H BACK:MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L3 MOV BH,BL JMP BACK L3:RET

DISP ENDP CODE ENDS END START

OUTPUT:
ENTER THE NO<0-8> : 7 FACTORIAL OF THE GIVEN NUMBER : 13B0 ENTER THE NO<0-8> : 5 FACTORIAL OF THE GIVEN NUMBER : 0078

98 | P a g e

31. CONVERSION FROM BINARY TO GRAY ( HEXADECIMAL )
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER BINARY CODE :''$' MESS2 DB 0AH,0DH,'EQUIVALENT GRAY CODE :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL SHR DL,01H XOR BL,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL
99 | P a g e

RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER BINARY CODE: 10 EQUIVALENT GRAY CODE: 18

ENTER BINARY CODE: 80 EQUIVALENT GRAY CODE: C0 ENTER BINARY CODE: F0 EQUIVALENT GRAY CODE: 88

100 | P a g e

32.CONVERSION FROM GRAY CODE TO BINARY CODE(HEXADECIMAL)
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER GRAY CODE :''$' MESS2 DB 0AH,0DH,'EQUIVALENT BINARY CODE :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,DL MOV CH,07H M1:SHR DL,01H XOR BL,DL DEC CH JNZ M1 LEA DX,MESS2 MOV AH,09H INT 21H CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H
101 | P a g e

CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP

DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER GRAY CODE: ‘21 EQUIVALENT BINARY CODE: ‘3E ENTER GRAY CODE: 80 EQUIVALENT BINARY CODE: FF

102 | P a g e

33.CONVERSION OF ARRAY OF BINARY CODE TO GRAY CODE (HEXADECIMAL)
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'BINARY CODE GRAY CODE :''$' NL DB 0AH,0DH,' ','$' BSP DB' ','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BH,DL LEA DX,MESS2 MOV AH,09H INT 21H M1:LEA DX,NL MOV AH,09H INT 21H CALL READ MOV BL,DL SHR DL,01H XOR BL,DL LEA DX,BSP MOV AH,09H INT 21H CALL DISP DEC BH JNZ M1 MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H
103 | P a g e

R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START OUTPUT: ENTER LIMIT : 05 BINARY CODE GRAY CODE 3E 21 21 31 16 1D 10 18 02 03

104 | P a g e

34. CONVERSION OF ARRAY OF GRAYCODE TO BINARY CODE (HEXADECIMAL)
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'GRAY CODE BINARY CODE :''$' NL DB 0AH,0DH,' ','$' BSP DB' ','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BH,DL LEA DX,MESS2 MOV AH,09H INT 21H M2:LEA DX,NL MOV AH,09H INT 21H CALL READ MOV BL,DL MOV CH,07H M1: SHR DL,01H XOR BL,DL DEC CH JNZ M1 LEA DX,BSP MOV AH,09H INT 21H CALL DISP DEC BH JNZ M2 MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH
105 | P a g e

JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START OUTPUT: ENTER LIMIT : 05 GRAY BINARY 03 02 14 18 21 3E C2 83 A5 C6
106 | P a g e

35.GCD OF TWO 8-BIT HEXADECIMAL NUMBERS.
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER :''$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER :''$' MESS3 DB 0AH,0DH,'GCD OF TWO NUMBER IS :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,DL T1:MOV AL,BH MOV AH,00H DIV BL MOV BH,BL MOV BL,AH CMP AH,00H JNE T1 CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H
107 | P a g e

CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT:
ENTER FIRST NUMBER : 0A ENTER SECOND NUMBER : 05 GCD OF TWO NUMBER IS : 05 ENTER FIRST NUMBER : 0C ENTER SECOND NUMBER : 06 GCD OF TWO NUMBER IS : 06

108 | P a g e

36.GCD OF TWO 8-BIT NUMBERS(BCD).
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER FIRST NUMBER :''$' MESS2 DB 0AH,0DH,'ENTER SECOND NUMBER :''$' MESS3 DB 0AH,0DH,'GCD OF TWO NUMBER IS :''$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BH,DL LEA DX,MESS2 MOV AH,09H INT 21H CALL READ MOV BL,DL N1:CMP BH,BL JZ N3 JNB N2 MOV AL,BL SUB AL,BH DAS MOV BL,AL JMP N1 N2:MOV AL,BH SUB AL,BL DAS MOV BH,AL JMP N1 N3:CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H
109 | P a g e

CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H MOV CL,04H MOV DL,BH SHR DL,CL ADD DL,30H MOV AH,06H INT 21H AND BH,0FH ADD BH,30H MOV DL,BH MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT: ENTER FIRST NUMBER : ‘08 ENTER SECOND NUMBER : ‘12 GCD OF TWO NUMBER IS : ‘04 ENTER FIRST NUMBER : ‘09 ENTER SECOND NUMBER : ‘06 GCD OF TWO NUMBER IS : ‘03
110 | P a g e

37.REVERSE OF A BYTE
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE NUMBER :','$' MESS2 DB 0AH,0DH,'REVERSE OF A GIVEN BYTE :','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BL,00H MOV CH,08H N1: SHL DL,01H RCR BL,01H DEC CH JNZ N1 CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CL,04H MOV DL,' ' MOV AH,06H INT 21H MOV AH,01H INT 21H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH
111 | P a g e

OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS2 MOV AH,09H INT 21H MOV CL,04H MOV DL,BL SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BL,0FH CMP BL,0AH JC L2 ADD BL,07H L2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT:
ENTER THE NUMBER : 12 REVERSE OF GIVEN BYTE: 48 ENTER THE NUMBER:F8 REVERSE OF GIVEN BYTE:1F

112 | P a g e

38.REVERSAL OF WORD
DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER THE NUMBER :','$' MESS2 DB 0AH,0DH,'REVERSE OF A GIVEN NUMBER :','$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV BX,DX MOV BX,0000H MOV CH,10H N1: SHL DX,01H RCR BX,01H DEC CH JNZ N1 CALL DISP MOV AH,4CH INT 21H READ PROC NEAR PUBLIC READ MOV CH,02H R3:MOV AH,01H INT 21H MOV CL,04H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H R2: AND AL,0FH OR DL,AL DEC CH JZ R4
113 | P a g e

MOV DH,DL JMP R3 R4: RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS2 MOV AH,09H INT 21H MOV CH,02H L3:MOV CL,04H MOV DL,BH SHR DL,CL CMP DL,0AH JC L1 ADD DL,07H L1: ADD DL,30H MOV AH,06H INT 21H AND BH,0FH CMP BH,0AH JC L2 ADD BH,07H L2:ADD BH,30H MOV DL,BH MOV AH,06H INT 21H DEC CH JZ L4 MOV BH,BL JMP L3 L4:RET DISP ENDP CODE ENDS END START OUTPUT: ENTER THE NUMBER: F4C9 REVERSE OF THE GIVEN WORD:932F ENTER THE NUMBER: B27A REVERSE OF THE GIVEN WORD:5E4D

114 | P a g e

39.REVERSAL OF AN ARRAY DATA SEGMENT MESS1 DB 0AH,0DH,'ENTER LIMIT :''$' MESS2 DB 0AH,0DH,'ENTER THE ARRAY ELEMENTS :''$' MESS3 DB 0AH,0DH,'REVERSE OF THE STRING :''$' NUM DB 10 DUP (0) RNUM DB 10 DUP (0) DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H CALL READ MOV CH,DL LEA DX,MESS2 MOV AH,09H INT 21H MOV DH,CH LEA BX,NUM L1:CALL READ MOV [BX],DL INC BX DEC DH JNZ L1 LEA SI,RNUM LEA BX,NUM MOV DL,CH MOV DH,00H ADD BX,DX MOV DH,CH L2:DEC BX MOV DL,[BX] MOV [SI],DL DEC DH JZ NEXT INC SI JMP L2 NEXT:CALL DISP MOV AH,4CH INT 21H

115 | P a g e

READ PROC NEAR PUBLIC READ MOV CL,04H MOV DL,',' MOV AH,06H INT 21H MOV AH,01H INT 21H MOV DL,AL SUB DL,30H CMP DL,0AH JC R1 SUB DL,07H R1:SHL DL,CL MOV AH,01H INT 21H SUB AL,30H CMP AL,0AH JC R2 SUB AL,07H AND AL,0FH R2: OR DL,AL RET READ ENDP DISP PROC NEAR PUBLIC DISP LEA DX,MESS3 MOV AH,09H INT 21H LEA SI,RNUM MOV CL,04H M3:MOV DL,',' MOV AH,06H INT 21H MOV bL,[SI] MOV DL,BL SHR DL,CL CMP DL,0AH JC M1 ADD DL,07H M1:ADD DL,30H MOV AH,06H INT 21H AND BL,0FH
116 | P a g e

CMP BL,0AH JC M2 ADD BL,07H M2:ADD BL,30H MOV DL,BL MOV AH,06H INT 21H DEC CH JZ M4 INC SI JMP M3 M4: RET DISP ENDP CODE ENDS END START

OUTPUT ENTER THE LIMIT OF AN ARRAY:05 ENTER THE ARRAY ELEMENTS:12,4C,DB,D5 REVERSE OF THE GIVEN ARRAY:D5,DB,4C,12

117 | P a g e

40.TO DISPLAY CURRENT TIME.
DATA SEGMENT MESS1 DB 0AH,0DH,'TIME IS:'0AH,0DH,'$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H L1:MOV AH,2CH INT 21H MOV AL,CH CALL CONV CALL DISP MOV DL,':' MOV AH,06H INT 21H MOV AL,CL CALL CONV CALL DISP MOV DL,':' MOV AH,06H INT 21H MOV DL,0DH MOV AH,06H INT 21H JMP L1 MOV AH,4CH INT 21H DISP PROC NEAR PUBLIC DISP MOV BL,AH MOV DL,AL ADD DL,30H MOV AH,06H INT 21H MOV DL,BL ADD DL,30H MOV AH,06H
118 | P a g e

INT 21H RET DISP ENDP CONV PROC NEAR PUBLIC CONV MOV AH,00H MOV BH,0AH DIV BH RET CONV ENDP CODE ENDS END START

OUTPUT: THE CURRENT TIME IS: 23:37:23.85

119 | P a g e

41.TO DISPLAY CURRENT DATE.
DATA SEGMENT MESS1 DB 0AH,0DH,'THE CURRENT DATE IS:'$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,MESS1 MOV AH,09H INT 21H MOV AH,2AH INT 21H MOV SI,CX MOV BL,DH MOV BH,DL CALL DISP MOV DL,'-' MOV AH,06H INT 21H MOV BL,BH CALL DISP MOV DL,'-' MOV AH,06H INT 21H XOR DX,DX MOV AX,SI MOV CX,0064H DIV CX MOV DH,DL MOV BL,AL CALL DISP MOV BL,DH MOV AH,4CH INT 21H CONV PROC NEAR PUBLIC CONV MOV CL,04H XOR AH,AH
120 | P a g e

MOV AL,BL MOV BL,0AH DIV BL SHL AL,CL ADD AL,AH DAA MOV BL,AL RET CONV ENDP DISP PROC NEAR PUBLIC DISP MOV CL,04H CALL CONV MOV DL,BL SHR DL,CL ADD DL,30H MOV AH,06H INT 21H AND BL,0FH ADD BL,30H MOV DL,BL MOV AH,06H INT 21H RET DISP ENDP CODE ENDS END START

OUTPUT:
THE CURRENT DATE IS: MON 07/11/2011

121 | P a g e

Sign up to vote on this title
UsefulNot useful