0% found this document useful (0 votes)
92 views10 pages

MPMC 1st Program

The document describes an Assembly Language Program (ALP) that performs various arithmetic and logical operations: 1. It includes sections to add, subtract, multiply and divide both 8-bit and 16-bit numbers, as well as convert between packed and unpacked BCD formats. 2. The program loads operands from memory, performs the operations using Assembly instructions like ADD, SUB, MUL, DIV and stores the results back in registers or memory. 3. The examples demonstrate performing basic math on different size operands, and converting between binary and BCD number representations.

Uploaded by

bala krishna N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views10 pages

MPMC 1st Program

The document describes an Assembly Language Program (ALP) that performs various arithmetic and logical operations: 1. It includes sections to add, subtract, multiply and divide both 8-bit and 16-bit numbers, as well as convert between packed and unpacked BCD formats. 2. The program loads operands from memory, performs the operations using Assembly instructions like ADD, SUB, MUL, DIV and stores the results back in registers or memory. 3. The examples demonstrate performing basic math on different size operands, and converting between binary and BCD number representations.

Uploaded by

bala krishna N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1.

AIM: To write an Assembly Language Program (ALP) on Arithmetic


and Logical Instructions.

APPARATUS: 1. Personal Computer

2. TASM Software

PROGRAM:

A). ADDITION OF 8 – BIT NUMBERS

DATA SEGMENT

N1 DB 54H

N2 DB 64H

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE, DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AL,N1

MOV BL,N2

ADD AL,BL

INT 21H

CODE ENDS

END START

RESULT: AL = B8H CY = 0
B). ADDITION OF 16 – BIT NUMBERS

DATA SEGMENT

N1 DW 4554H

N2 DW 6464H

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE, DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AX,N1

MOV BX,N2

ADD AX,BX

INT 21H

CODE ENDS

END START

RESULT: AX = A9B8H CY = 0
C). SUBSTRACTION OF 8 – BIT NUMBERS

DATA SEGMENT

N1 DB 56H

N2 DB 46H

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AL,N1

MOV BL,N2

SUB AL,BL

INT 21H

CODE ENDS

END START

RESULT: AL = 10H CY = 0
D). SUBSTRACTION OF 16 – BIT NUMBERS

DATA SEGMENT

N1 DW 0F9C6H

N2 DW 0F3D8H

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AX,N1

MOV BX,N2

SUB AX,BX

INT 21H

CODE ENDS

END START

RESULT: AX = 05EEH CY = 0
E). MULTIPLICATION OF 8 – BIT NUMBERS

DATA SEGMENT

N1 DB 10H

N2 DB 05H

DATA ENDS

CODE SEGMENT

ASSUME DS:DATA,CS:CODE

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AL,N1

MOV BL,N2

MUL BL

INT 21H

CODE ENDS

END START

RESULT: AX = 0050H
F). MULTIPLICATION OF 16 – BIT NUMBERS

DATA SEGMENT

N1 DW 1234H

N2 DW 4321H

DATA ENDS

CODE SEGMENT

ASSUME DS:DATA,CS:CODE

START: MOV AX,DATA

MOV DS,AX

MOV AX,N1

MOV BX,N2

MUL BX

INT 21H

CODE ENDS

END START

RESULT: AX = F4B4H DX = 04C5H


G). DIVISION OF 8 – BIT BY 8 – BIT NUMBER

DATA SEGMENT

N1 DB 64H

N2 DB 08H

Q DB,?

R DB,?

DATA ENDS

CODE SEGMENT

ASSUME DS:DATA,CS:CODE

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AL,N1

MOV BL,N2

DIV BL

MOV Q,AL

MOV R,AH

INT 21H

CODE ENDS

END START

RESULT: AX = 040CH Q = AL = 0CH R = AH = 04H


H). DIVISION OF 32 – BIT BY 16 – BIT NUMBER

DATA SEGMENT

N1 DW 4567H,2345H

N2 DW 4111H

Q DW,?

R DW,?

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

MOV AX,N1

MOV DX,N1+2

MOV BX,N2

DIV BX

MOV Q,AX

MOV R,DX

INT 21H

CODE ENDS

END START

RESULT: Q = AX = 8AC5H R = DX = 0952H


I). CONVERSION OF PACKED BCD INTO UNPACKED BCD NUMBER

DATA SEGMENT

N DB 45H

RES DW ?

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START: MOV AX,DATA

MOV DS,AX

XOR AX,AX

XOR CX,CX

MOV AL,N

MOV SI,OFFSET RES

MOV CL,AL

AND CL,0F0H

ROR CL,04H

MOV [SI],CL

AND AL,0FH

MOV [SI+1],AL

INT 21H

CODE ENDS

END START
RESULT: D 0000 0002

45 04 05

You might also like