Mppracs
Mppracs
Numbers.
PROGRAM:
DATA SEGMENT
NI DW 1234H
N2 DW 2134H
RES DW
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START: MOV AX, DATA
MOV DS, AX
MOV AX, NI
MOV BX, N2
ADD AX, BX
MOV RES, AX
INT 21H
CODE ENDS
END START
Output:
AIM: To Implement Assembly Language Program For Subtraction or Two 16-Bit
Numbers.
PROGRAM:
DATA SEGMENT
NI DW 4444H
N2 DW 2121H
RES DW?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX.DATA
MOV DS AX
MOV AXNI
MOV BX N2
SUB AX,BX
MOV RES AX
INT 21H
CODE ENDS
END START
Output:
AIM: To write 8086 Assembly Language Program to multiply two signed number
PROGRAM:
data segment
a dw 1234h
b dw 5678h
cdd?
data ends
code segment
assume ds:data, es:code
start:
mov ax,data
mov ds, ax
mov ax, a
mov bx,b
mul bx
mov word ptr res, ax
mov word ptr res+2,dx
int 3
code ends
end start
Output:
AIM: To write 8086 Assembly Language Program to Division two signed number.
PROGRAM:
data segment
a dw 4444h
b dw 0002h
c dw?
data ends
code segment
assume ds:data, cs:code
start:
mov ax,data
mov ds, ax
mov ax,a
mov bx,b
div bx
mov c,ax
int 3
code ends
end start
output:
AIM: To implement Assembly Language Program to find GCD of two numbers
PROGRAM:
DATA SEGMENT
NUMI DW 000AH
NUM2 DW00041
GCD DW
DATA ENDS
CODE SEGMENT
ASSUME CS.CODE DS:DATA
START: MOV AX,DATA :Load the Data to AX
MOV DS AX Move the Data AX to DS
MOV AX,NUM :Move the first number to AX.
MOV BX,NUM2 Move the second number to BX.
UP: CMP AX,BX
Compare the two numbers.
JE EXIT
If equal, go to EXIT label
JB EXCG
If first number is below than second
go to EXCG label.
UPI: MOV DX,0H
Initialize the DX.
DIV BX
Divide the first number by second number.
CMP DX,0
Compare remainder is zero or not
JE EXIT
If zero, jump to EXIT label
MOV AX,DX If non-zero, move remainder to AX
JMP UP
Jump to UP label.
EXCG:XCHG AX,BX Exchange the remainder and quotient
JMP UP
Jump to UPI
EXIT MOV GCD,BX Store the result in GCD.
MOV AH,4CH
INT 21H
CODE ENDS
END START
Output
Aim: To implement Assembly Language Program to sort numbers in
ascending order
PROGRAM:
DATA SEGMENT
x DW 42H,34H.26H, 17H,09H
LEN EQU OS
ASCD DB 10 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV BX,LEN-1
MOV CX,BX
UPI: MOV BX,CX
LES SIX
UP: MOV AX,(SI
MOV DX,[SI+2]
CMP AX DX
JB DOWN/JA DOWN
MOV [SI],DX
MOV [SI+2] AX
DOWN: IN WI
INC SI
DEC BX
JNZ UP
DEC CX
JNZ UPI
MOV AH,4CH
INT 21H
CODE ENDS
END START
Output:
AIM: Assembly language program to Find maximum and minimum
number in a series using 8086
Program:
assume cs:code,ds data
data segment
org 2000h
series db 12h,1 09h,05h,23h99h86h
count dw 07h
max db 00h
min db 00h
data ends
code segment
start:mov ax,data
mov ds,ax
mov ex,count
lea.si,series
mov al,[si
mov bl.al
go:inc si
cmp [si],al
jl min_val
mov al.[si]
jmp nxtp
min_valcmp [sij
jg nxtp
mov bl.[si]
nxtp:loop go
mov max,al
mov min, bl
mov ah, 4ch
int 21h
code ends
end start
Output:
Aim: Program based on 32-bit Architecture (32bit multiplienten)
Program:
data segment
abe dd 12345678 H
def dd 12345678 H
ghi dq?
data ends
code segment
assume es:code, ds.data
start:
movax, data
mov ds, ax
mov ax, word ptr als
mul word ptr def
mov word ptr ghi, ux
mov cx, dx
mov ax, word ptr abc+2
mul word ptr def
add ex, ax
mov bx, dx
jnc move
add bx,0001H
move: mov ax, word ptr abe
mul word ptr def+2
add ex, ax
mov word ptr ghi+2, cx
mov cx dx
jne ma
add bx, 0001H
ma: mov ax, word ptr abo 2
mul word ptr def+2
add ex, ax
jnc mb
add dx, 0001H
mb: add ex, bx
mov word ptr ghi+4, cx
jnc mc
add dx, 00011
mc: mov word ptr ghi+6, dx
int 3
code ends
end start
output:
Aim: Program Using Procedure (Recursion)
Program:
DATA SEGMENT
A DB 5
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV AH,00
MOV AL,A
L1: DECA
MUL A
MOV CL,A
CMP CL,01
JNZ L1
MOV AH,4CH
INT 21H
CODE ENDS
END START
Aim: 8086/Masm Program To Transfer A Given Block Of Data From
Source Memory Block To Destination Memory Block With Out Overlap.
Program:
DATA SEGMENT
X DB 01H,02H,03H,04H,OSH
Y DB OS DUP (0)
DATA ENDS
CODE SEGMENT
ASSUME CS CODE, DS: DATA
START: MOV AX, DATA : Initialize DS to point to start of the
memory
MOV DS, AX set aside for storing of data
MOV CX, 05H
Load counter
LEA SI, X
SI pointer points to top of the memory block
LEA DI, Y
DI points to starting of destination block