Showing posts with label 8086. Show all posts
Showing posts with label 8086. Show all posts

Wednesday, March 19, 2014

MPP experiment 6

EXP6-part 1
Programme to transfer string from ds to es
.model small
.stack 10h
data segment
array db 02h, 04h , 06h, 07h , 10h
array_cpy db 10 dup (?)
data ends
code segment
assume cs:code,ds:data
start :
                                mov ax,data
                                mov ds,ax
                                mov es,ax
                                xor ax,ax
                                mov si,offset array
                                mov di,offset array_cpy
                                mov cx,04h
                       rep movsb
                                mov ax,4c00h
                                int 21h
code ends
        end start
EXP 6-B
Programme to swap a string
.model small
.stack 10h
data segment
        array db 01h, 02h, 03h, 04h, 05h
        array_rev db 5 dup (?)
data ends
code segment
        assume cs:code,ds:data
        start :
                                mov ax,data
                                mov ds,ax
                                mov es,ax
                                xor ax,ax
                                mov si,offset array
                                mov di, offset array + 04h
                                mov cx,02h
        repeat : mov al,[si]
                                xchg al,[di]
                                xchg al,[si]
                                inc si
                                dec di
                                loop repeat
                                mov ax,4c00h
                                int 21h
code ends
        end start
Exp6c
Programme to serch an element in a string
Algorithm: Linear Search
.model small
.stack 10h
data segment
        array db 01h, 02h, 03h, 04h, 05h
        msg1 db 13,10, "KEY NOT FOUND$"
        msg2 db 13,10, "KEY FOUND$"
data ends
code segment
        assume cs:code,ds:data
        start :
                                mov ax,data
                                mov ds,ax
                                mov es,ax
                                xor ax,ax
                                mov di,offset array
                                mov ax,0700h
                                int 21h ; dos int for accepting an i/p
                                sub al,30h
                                mov cx,05h
                                cld
                      repne scasb ; search a string
                                cmp cx,00h
                                je not_found
                                mov bx,offset array + 04h
                                sub bx,cx ; bx contains the addr of key
                                mov dx,offset msg2
        print : mov ax,0900h
                                int 21h ; dos int for displaying the o/p
                                mov ax,4c00h
                                int 21h
        not_found : mov dx,offset msg1
                                jmp print
code ends
        end start

Here is the link to download algorithms, flowcharts and answers:

Wednesday, March 5, 2014

Tuesday, March 4, 2014

MPP Experiment 4

The download contains both the algorithms and flowcharts along with the answer to Q3. Q1 can be found in techmax/technical and Q2 is fairly easy, so it has been skipped.

CLICK HERE TO DOWNLOAD!

Here are the codes:

SMALLest number:
.model small
.stack 100h
data segment
array db 50h,20h,99h,30h,40h,10h,60h,70h,80h,90h
max db 0ffh
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start

LARGEest number:

.model small
.stack 100h
data segment
array db 10h,20h,99h,30h,40h,50h,60h,70h,80h,90h
max db 0
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jnc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start

Saturday, February 8, 2014

MPP Experiment 3

16-BIT DIVISION IN 8086

.MODEL SMALL

.STACK 100H

DATA SEGMENT
NUM1 DW 4567H,2345H
NUM2 DW 4111H
QUO DW 2 DUP(0)
REM DW 1 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV DX,NUM1+2
DIV NUM2
MOV QUO,AX
MOV REM,DX
INT 21H
CODE ENDS
END START

INPUT:     Dividend - 23454567,
           Divisor - 4111,
OUTPUT:    AX – 8AC5H (quotient);
           DX – 0952H (reminder);

16-BIT MULTIPLICATION IN 8086

.MODEL SMALL

.STACK 100H

DATA SEGMENT

NUM1 DW 1234H

NUM2 DW 1234H

LSB DW 2 DUP(0)

MSB DW 1 DUP(0)

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START: MOV AX,DATA

MOV DS,AX

MOV AX,NUM1

MOV DX,NUM2

MUL DX

MOV LSB,AX

MOV MSB,DX

HLT

CODE ENDS

END START

INPUT:     NUM1- 1234,
                 NUM2- 1234,
OUTPUT:    AX – 5A90H (LSB);
           DX – 014BH (MSB);

8-BIT DIVISION IN 8086

.model small

.stack 100h

assume cs:code, ds:data

data segment

num1 dw 99h

num2 dw 33h

data ends             

code segment

START: mov ax,data

mov ds,ax

mov ax,num1

mov bx,num2

div bx

int 21h

code ends

end start

INPUT:  NUM1- 99,

              NUM2- 33,

OUTPUT: AX- 0003

8-BIT MULTIPLICATION IN 8086

.model small

.stack 100h

assume cs:code, ds:data

data segment

num1 dw 56h

num2 dw 78h

data ends             

code segment

START: mov ax,data

mov ds,ax

mov ax,num1

mov bx,num2

mul bx

int 21h

code ends

end start

INPUT:  NUM1- 56,
              NUM2- 78,
OUTPUT: AX- 2850

NOTE: The code for 16-bit division is 100% correct and tested. It is very likely that sir might question you about how the num1+2 instruction is executed, so be prepared!!

Here are the algorithms and flowcharts for 16-bit multiplication and 16-bit division codes:

CLICK HERE TO DOWNLOAD!

Tuesday, January 28, 2014

MPP Experiment 2

a) 32-bit addition for signed and unsigned numbers b) 32-bit subtraction for signed and unsigned numbers, now let me write programs to each one of them:: 

1) To write 8086 Assembly Language Program to add two 32-bit signed & unsigned number.




2) To write 8086 Assembly Language Program to Subtract two 32-bit signed & unsigned number:


2) List the differences between 8085 and 8086 microprocessors.