0% found this document useful (0 votes)
5 views

microprocessor

The document provides an overview of the 8086 microprocessor, detailing its features, modes of operation, and applications, including its role in early personal computers. It describes the architecture of the microprocessor, including its execution units and instruction set, as well as directives and keywords used in assembly programming. Additionally, it includes an algorithm and program code for reversing a string using the 8086 microprocessor, concluding with the author's learning outcomes from the project.

Uploaded by

masihasilveya
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)
5 views

microprocessor

The document provides an overview of the 8086 microprocessor, detailing its features, modes of operation, and applications, including its role in early personal computers. It describes the architecture of the microprocessor, including its execution units and instruction set, as well as directives and keywords used in assembly programming. Additionally, it includes an algorithm and program code for reversing a string using the 8086 microprocessor, concluding with the author's learning outcomes from the project.

Uploaded by

masihasilveya
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/ 7

INTRODUCTION TO 8086 MICROPROCESSOR

8086 Microprocessor is an enhanced version of 8085 Microprocessor that was


designed by Intel in 1976. It is a 16-bit Microprocessor having 20 address lines
and16 data lines that provides up to 1MB storage. It consists of powerful
instruction set, which provides operations like multiplication and division easily.
It supports two modes of operation, i.e. Maximum mode and Minimum mode.
Maximum mode is suitable for system having multiple processors and
Minimum mode is suitable for system having a single processor.
• When only one 8086 CPU is to be used in a microprocessor system, the
8086 is used in the Minimum mode of operation.
• In a multiprocessor system 8086 operates in the Maximum mode.
The 8086 microprocessor has two main execution units: the execution unit (EU)
and the bus interface unit (BIU). The BIU is responsible for fetching
instructions from memory and decoding them, while the EU executes the
instructions. The BIU also manages data transfer between the microprocessor
and memory or I/O devices.
FEATURES OF 8086
➢ It is a 16 bit Microprocessor .
➢ 8086 has 20 bit address bus can access upto 2²⁰ memory location i.e. 1mb.
➢ It comes in 40 pin dual inline package .
➢ Memory is byte addressable as every byte has separate address .
➢ Memory is divided into 16 partition called as segment.
➢ It has 16 bit flag register from that 7 flags are unused and 9 flags are used .
➢ It can prefeches upto 6 instructions bytes from memory and queues them in order to
speed up instruction execution .

APPLICATIONS
The 8086 microprocessor has been widely used in various applications,
including early personal computers (PCs), industrial control systems, embedded
systems, and instrumentation.
It played a significant role in the development of the IBM PC and the
subsequent success of the PC industry.

Resources required

Sr Resources Specification Quantity Remark


no.
1. Computer HP i5 RAM 8GB 1 -
resource
2. Software EMU 8086 1 -
3. Search engine GOOGLE 1 -
Directives and Keywords used in program
▪ .STACK: Specifies the amount of memory to allocate for the program’s stack, which
is used for managing subroutine calls and local variables.
▪ PROC: Begins the definition of a procedure or subroutine, allowing for modular and
reusable code organization
▪ FAR: Indicates a far procedure, enabling calls to procedures located in different code
segments .
▪ OFFSET: Retrieves the offset address of a variable or label, useful for accessing
memory locations.
▪ END: Marks the end of the program, signaling the termination of assembly code.
▪ CALL: Initiates a procedure call, transferring control to a subroutine and allowing for
modular programming.
▪ LEA: Loads the effective address of a memory operand into a register, primarily used
for address calculations.
▪ INT: Triggers a software interrupt, enabling interaction with the operating system or
BIOS functions.
▪ CMP: Compares two values, setting flags in the processor’s status register based on the
result.
▪ JE: Jumps to a specified location if the comparison result is equal, enabling conditional
branching.
▪ JMP: Unconditionally jumps to a specified location, facilitating unconditional
branching.
▪ LABEL: Marks a specific location in the code, serving as a reference point for
branching or data access.
▪ LOOP: Executes a loop a specified number of times based on the count in the CX
register, simplifying repetitive tasks.
▪ INC: Increases the value of a register or memory location by one, commonly used for
counting or incrementing.
▪ DEC: Decreases the value of a register or memory location by one, often used in loop
control or counting down operations.
▪ RET: Returns from a procedure, transferring control back to the calling code after
subroutine execution.
▪ XOR: Performs a bitwise XOR operation, commonly used for data encryption, data
comparison, or toggling bits.
▪ PUSH: Places data onto the top of the stack, facilitating parameter passing and
preserving register values during subroutine calls.
▪ POP: Removes data from the top of the stack, commonly used to retrieve values pushed
onto the stack during subroutine calls.
ALGORITHM
The algorithm for this assembly program:
Step 1. Define the memory model as small and allocate 256 bytes for the stack.

Step 2. Declare a string ‘This is a sample string’ in the data section, terminated with ‘$’.

Step 3. Start the main code section and set up the data segment register.

Step 4. Call the REVERSE subroutine.

Step 5. Load the address of the string into DX register.

Step 6. Output the string using DOS interrupt 21H function 09H.
Step 7. Use DOS interrupt 21H function 4CH to exit the program.

Step 8. In the REVERSE subroutine:


- Load the offset of the string into SI register.

- Initialize the character count to 0.

- Loop through the string:

- Compare each character to ‘$’ to find the end of the string.

- Push each character onto the stack and increment the pointer and count.

- Start another loop to reverse the string:

- Pop each character from the stack.


- Store the character in the reversed string.

- Increment SI and decrement the count.

- Repeat until the count is zero.

- Add ‘$ ‘ to the end of the reversed string.

- Return from the subroutine.


FLOWCHART

START

Main PROC

MOV AX,@DATA

MOV DS,AX

CALL
Reverse

LEA DX, STRING

MOV AH,09H

INT 21H

END MAIN

Push character on stack until $ is


LOOP 1
found

POP characters from stack in LOOP 2


END reverse order
PROGRAM CODE :
.MODEL SMALL
.STACK 100H

.DATA ; The string to be printed

STRING DB ‘This is a sample string’, ‘$’

.CODE

MAIN PROC FAR

MOV AX,@DATA
MOV DS,AX ; call reverse function

CALL REVERSE ; load address of the string

LEA DX,STRING

MOV AH, 09H

INT 21H ; interrupt to exit


MOV AH, 4CH

INT 21H

MAIN ENDP

REVERSE PROC

MOV SI, OFFSET STRING ; count of characters of the string

MOV CX, 0H

LOOP1:

MOV AX, [SI]


CMP AL, ‘$’

JE LABEL1 ; else push it in the stack

PUSH [SI] ; increment the pointer and count ;

INC SI

INC CX

JMP LOOP1

LABEL1: ; again load the starting;


MOV SI, OFFSET STRING
LOOP2:

;if count not equal to zero

CMP CX,0

JE EXIT

; pop the top of stack

POP DX

; make dh, 0

XOR DH, DH
; put the character of the reversed string;

MOV [SI], DX

; increment si and;

;decrement count

INC SI

DEC CX

JMP LOOP2

EXIT:

; add $ to the end of string

MOV [SI],’$ ‘

RET

REVERSE ENDP

END MAIN

CONCLUSION
Hence, from this microproject I learnt how a string is reversed using stack and I get know
some other more keywords and directives from this microproject. I have successfully done
this microproject.

You might also like