This document provides an overview of the x86 microprocessor architecture. It discusses the history of x86 processors from the 8086 to modern Pentium and Intel 64-bit processors. It then describes the internal structure of the 8088/8086, including the bus interface unit, execution unit, registers, and flag register. It introduces assembly language programming and common instructions like MOV and ADD. It explains the code, data, stack, and extra segments and how logical addresses map to physical addresses. Memory allocation in IBM PCs is also summarized.
8085 Microprocessor, Features/Characteristics of 8085, Communication between Microprocessor & Memory, 8085 Programming Model, 8085 Registers, Flag Register, General Purpose Register, Special Purpose Register, Stack Pointer, Program Counter, Interrupts, Control Unit, Architecture/Block Diagram of 8085 & its explanation, Pin diagram of 8085
Memory reference instructions used in computer architecture is well demonstrated with examples. It will probably help you understand each referencing instructions.
8085 Microprocessor, Features/Characteristics of 8085, Communication between Microprocessor & Memory, 8085 Programming Model, 8085 Registers, Flag Register, General Purpose Register, Special Purpose Register, Stack Pointer, Program Counter, Interrupts, Control Unit, Architecture/Block Diagram of 8085 & its explanation, Pin diagram of 8085
Memory reference instructions used in computer architecture is well demonstrated with examples. It will probably help you understand each referencing instructions.
MPMC UNIT-1. Microprocessor 8085 pdf Microprocessor and MicrocontrollerRAHUL RANJAN
Diploma in Electrical Engineering MICROPROCESSOR AND MICROCONTROLLER UNIT-1 Full Notes 📝 Microprocessor 8085 State Board Of Technical Education [SBTE] BIHAR
To understand the basic concepts of 8085 microprocessor, microcontroller. The students will also learn about the programming methods and integration of peripherals to the micro-controller.
A 32-Bit Parameterized Leon-3 Processor with Custom Peripheral IntegrationTalal Khaliq
A new descriptive method to use ARM AHB and APB Bus architecture to add new IP Cores and enhance functionality of 32 bit Processor (Leon3). AHB and APB addressing and GUI enhancement is also discussed.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
Presented at NUS: Fuzzing and Software Security Summer School 2024
This keynote talks about the democratization of fuzzing at scale, highlighting the collaboration between open source communities, academia, and industry to advance the field of fuzzing. It delves into the history of fuzzing, the development of scalable fuzzing platforms, and the empowerment of community-driven research. The talk will further discuss recent advancements leveraging AI/ML and offer insights into the future evolution of the fuzzing landscape.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
15CS44 MP & MC Module 1
1. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 1
Module-1
The x86 Microprocessor
Topics:
1.1 Brief History of the x86 family
1.2 Inside 8088/86
1.3 Introduction to Assembly Programming
1.4 Introduction to Program segments
1.5 The Stack
1.6 Flag register
1.7 x86 Addressing Modes
1.8 Assembler Directives & a sample Program
1.9 Assemble Link and Run a Program
1.10 Control Transfer Instructions
1.11 Data types & Data Definition
1.12 Full segment Definition
1.13 Flowcharts & Pseudo Code
2. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 2
1.1 Brief History of the x86 Family:
In 1978 16-bit microprocessor called 8086 was introduced.
This processor was a major improvement over previous generation 8080/8085 ( 8-bit
microprocessors, 64K bytes of memory)
8086 was pipelined processor
Evolution from 8086 to 8088:
8088 is identical to 8086 but it has 8-bit data bus instead of 16-bit data bus.
Success of 8088:
In 1981, IBM picked up 8088 as their microprocessor of choice in designing the IBM PC
Other microprocessors: 80286, 80386, 80486
In 1982 Intel introduced 80286, it has 16-data lines, 24 address lines and 16 Megabytes of
memory.
80286 operates two modes i) real mode ii) protected mode
In 1985, Intel introduced 80386 (32-bit microprocessor) with 32-bit data bus, 32-bit address lines,
its memory size 4 gigabytes.
Intel introduced math co-processors 8087,80287 and 80387’
In 1989, intel introduced enhanced version of 80386 with co-processor on single chip plus
additional features such as cache memory.
Pentium and Pentium pro:
In 1992, pentium was introduced
It has separate 8K cache memory for code and data
It has 64-bit data bus, its registers are 32-bit
4-giga bytes of memory
In 1995, pro was intriduced it has 5.5 million transistors
Pentium II
It has 7.5 million transistors and MMX featured ( multimedia exstension) technology for fast
graphics and audio processing
In 1998 xeon procesor was released
Pentium III:
Pentium III was released on 1999
It has 9.5 million transistors
It has 70 new instructions called SIMD that enhance video and audio performance in areas like 3-
D imaging
Pentium III xeon was released in same year 1Ghz
Pentium IV:
Speed of Pentium IV is 1.4 to 1.5 Ghz
The new 32-bit architecture called NetBurst is designed for heavy multimedia processing such as
video, music and grpahics
Intel 64-bit architecture:
3. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 3
Intel selected Itanium as the new name for first product in its 64-bit architecture formerly called
Merced
Itanium can execute many instructions simultaneously plus extremely large memory capabilities.
1.2 Inside the 8088/86 or Architecture of 8086 (Very very important)
Internal structure of microprocessor is divided into two sections
1. Bus Interface unit (BIU)
2. Execution Unit (EU)
Bus interface unit: it accesses memory and peripherals.
Execution unit: It executes the instructions previously fetched.
Instruction Queue:
It contains pre-fetched instructions.
4. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 4
Instruction queue in 8088 in 4 bytes long
Instruction queue in 8086 is 6 bytes long.
Fetching next Instruction while current instruction is being executed is called Pipelining.
Registers:
In CPU, registers are used to store data temporarily.
There are six types of registers in 8088/ 8086 as shown in below table.
Registers of 8088/ 8086 by category
Category Bits Register Names
General 16
8
AX, BX, CX, DX
AH, AL, BH, BL, CH, CL, DH, DL
Pointer 16 SP (stack pointer), BP (Base Pointer)
Index 16 SI (source Index), DI (destination Index)
Segment 16 CS(code segment), DS (data segment)
SS (stack segment),ES (extra segment)
Instruction 16 IP (instruction pointer)
Flag 16 FR (flag register)
General purpose registers:
General purpose registers can be used as either 16-bit or 8-bit registers as shown below
There are four general purpose registers AX, BX, CX, DX
AH-AL AX register
BH-BL BX register
CH-CL CX register
DH-DL DX register
AX (Accumulator):
AX is used to store the results of the arithmetic and logic operations.
BX (Base Index register):
BX register is used to hold the OFFSET address of DATA segment.
BX is addressable as BH and BL
AX
16-bit register
AH
8-bit register
AL
8-bit register
5. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 5
CX (counter):
CX is used to hold the count for various instructions.
DX (data register):
DX holds the part of the result from multiplication
It holds the dividend for division
Segment Registers:
Four segment registers in BIU are used to hold the upper 16 bits of the starting addresses of a
Segment.
CS, DS, ES, SS Segment Registers.
The segment will always start at an address with zero’s in the lowest 4 bits.
The part of the segment starting address stored in a segment register is often called Segment
Base.
Instruction Pointer:
The Instruction Pointer points to the next instruction
Pointer and Index registers:
SP, BP, SI, DI are the different Pointer and Index Registers.
These registers can be used for temporary storage of data just as the general purpose registers
described above.
However, their main use is to hold the 16-bit offset of a data word in one of these segments.
Flag register:
A 16-bit flag register indicates some condition produced by the execution of an instruction or
controls certain operations of the EU.
It is a 16-bit register.
It contains 9 active flags.
1.3 Introduction to Assembly Programming:
A program that consists of 0s and 1s is called machine language, it is difficult to write programs
in machine language, to make programming easier assembly language was developed.
Assembly language:
Assembly language provides mnemonic for the machine codes.
6. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 6
Assembly language programs must be translated into machine language by a program called
Assembler.
Assembly language is low-level language.
To write programs in assembly language, programmer must know the number of registers and
their size and other details of the CPU.
FORMAT of Assembly language instruction:
LABEL: Mnemonic Destination, source; comments
Label and comments are optional
MOV instruction:
It copies data from one location to another
Format: MOV Destination, Source ; copy source operand to destination
The above instructions moves source operand to destination, MOV is Mnemonic for Move
operation.
e..g MOV AX, BX; it moves BX value to AX
MOV CL, 55H; it moves 55H to CL
MOV CH, BH ; it moves BH value to CH
MOV AX, 1234H; it moves 1234H to AX
MOV BL, 1234H; it is illegal, since 1234H (16-bit data) cannot be transferred to BL (8-bit)
Data cannot be moved directly into segment registers
e.g. MOV CS, 1234H ; it is illegal
Important points:
1. Values cannot be moved directly to any segment register (CS, DS, SS, ES)
2. 8-bit value can be moved to 16-bit register, the remaining 8-bits will be zero.
e.g. MOV AX, 12H; AX= 0012H
3. Moving 16-bit data to 8-bit register is illegal
e.g. MOV CL, 1234H ; illegal
ADD Instruction:
This instruction adds the source and destination operands and puts the result in destination.
Format: ADD Destination, Source
Operation: Destination = source + destination
E.g. write instructions to add 25H and 34H, move numbers to any registers and then add together
MOV AL, 25H; AL = 25H
MOV BL, 34H; BL=34H
ADD AL, BL; AL = 59H (25H + 34H)
7. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 7
e.g 2 : MOV CL, 12H; CL=12H
ADD CL, 13H; CL=25H (12H+13H)
In the above example, ADD CL, 13H, CL register has one value, and another value is specified
directly in the instruction, this second value (13H) is called as immediate operand.
Important points:
Largest number that 8-bit register can hold is FFH
To use numbers larger than FFH, 16- bit registers (AX, BX, CX, and DX) are used.
e.g. MOV AX, 34EH; AX=34EH
MOV DX, 6A5H; DX=6A5H
ADD DX, AX; DX=9F3H (34EH+6A5H)
1.4 Introduction to Program Segments:
An assembly language program has four segments
1. CODE Segment
2. DATA segment
3. STACK Segment
4. EXTRA segment
Code segment contains assembly language instructions
Data segment is used to store information (data)
Stack segment is used by CPU to store the data temporarily
Segments:
In 8086, memory is divided into 16 segments.
Each segment size is 64Kbytes.
Starting of each segment ends with 0H e.g. 12340H
Segment registers are used to hold upper 16-bits of the starting address of segment.
e.g. if code segment starting address is 123F0H, CS holds 123FH
Physical Address:
It is 20-bit address, it is an actual address of physical location in 1Mbyte memory.
The range of physical address is 00000H-FFFFFH.
e.g. 12AC3H is 20-bit physical address
Offset Address:
It is 16-bit address, it an address of location within 64-Kbyte segment.
The range of Offset address is 0000H-FFFFH
e.g. 12FFH is 16-bit offset address.
8. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 8
Logical address:
It consists of segment value and an Offset address.
e.g. 1234H:0001H 1234H is segment value 0001H is offset address
Logical and physical address in Code segment:
To execute an instruction, processor has to fetch an instruction from code segment.
Logical address of an instruction always consists of a CS (code segment) and IP (instruction
pointer) shown in CS: IP format.
IP contains Offset address
Steps to generate physical address:
Shift CS left one hex digit
Add IP to shifted CS
The resulting 20-bit address is physical address.
To find the lowest address add 0000H to shifted CS value.
To find highest address add FFFFH to shifted CS value.
Example:
Logical address is given CS:IP = 2500H : 95F3H
Physical address is calculated as follows
Lowest memory location 25000+0000H = 25000H
Highest memory location 25000H + FFFFH= 34FFFH
9. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 9
Problem: If CS=24F6H and IP=634AH, find a) Logical address b) offset address c) physical address
d) Lower address e) higher address of the code segment
a) logical address 24F6H : 634AH
b) Offset address 634AH
c) physical address 2B2AAH ( 24F60H + 634AH)
d) lower address 24F60H (24F60H + 0000H)
e) higher address 34F5FH (24F60H + FFFFH)
Data Segment:
In 8086 microprocessor, memory set aside for data is called Data segment.
Data segment uses DS register and BX, SI, DI as Offset registers.
Logical address of Data segment is shown as DS : OFFSET register
Steps to calculate Physical address of data segment:
Shift DS value left by one hex digit
Add shifted DS value to Offset
Example 1: Assume that DS is 5000 and the offset is 1950, calculate the physical address
Sol) DS : OFFSET = 5000:1950
1. Start with DS
2. Shift DS left by one hex digit
3. Add the offset to Shifted DS
5 0 0 0 0 + 1 9 5 0 = 51950
Example 2: If DS=7FA2H and the OFFSET is 438EH, calculate a) physical address b) Lower
range c) Upper range d) Logical address
a) Physical address = 83DAEH (7FA20H + 438EH)
b) Lower range = 7FA20H ( 7FA20H + 0000H)
c) Upper range = 8FA1FH ( 7FA20H + FFFFH)
d) Logical address = 7FA2H : 438EH
Problem : Assume that DS register is 578CH, to access a given byte of data at physical memory
location 67F66H, does data segment cover the range where the data resides? If not what
changes need to be made.
5 0 0 0
5 0 0 0 0
10. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 10
Sol) NO, this byte cannot be accessed because
Lower address = 578C0H (578C0H + 0000H)
Upper address=678BFH (578C0H + FFFFH)
Range is 578C0H – 678BFH
Since 67F66H is not in the range, to access byte, DS must be changed so that its range will include
that byte.
Problem: Assume memory locations with following contents DS:6826 = 48 and DS : 6827 = 22,
Show the contents of register BX in instruction “MOV BX, [6826]”
Sol) given that memory locations DS:6826 contain 48 and DS:6827 contain 22
DS:6827
DS:6826
The instruction MOV BX, [6826] moves 48 to BL 22 to BH BH BL
Memory Map of IBM PC:
8086 Microprocessor has 1 Mbyte of memory with address range 00000H – FFFFH
1 Mbyte of memory is allocated for different sections, this memory allocation is called
memory map.
The memory map of IBM PC is shown in above figure.
22
48
22 48
11. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 11
640 Kbytes from addresses 00000H – 9FFFFH are allocated for RAM.
128 Kbytes from A0000H – BFFFFH are allocated for video memory.
256 Kbytes from C0000H – FFFFFH are allocated for ROM.
RAM (Random access memory):
This memory is also called as Main memory.
Any Program must be loaded into Ram foe execution.
ROM (read only memory):
C0000H – FFFFFH locations are used for ROM.
64K bytes of Rom space from F0000H-FFFFFH are used fro BIOS ROM.
ROM contains initialization programs.
Functions of BIOS (Basic input-output system)ROM:
BIOS ROM is permanent memory.
It holds the programs which tell CPU what to do when power is turned on.
It also contains programs that allow windows to communicate with peripheral devices such as
keyboard, mouse.
BIOS tests all devices connected to PC when power is turned on and report errors.
After testing all devices BIOS will load windows operating system from hard disk to RAM
and hand over control of PC to windows.
Stack:
It is section of RAM used by CPU to store information temporarily.
CPU needs Stack since there are limited numbers of registers.
Disadvantage of Stack: it takes more time to access data from stack.
How stacks are accessed:
Two registers are used to access stack, SS(stack segment) register and SP (stack pointer)
Storing any register data into stack is called PUSH.
Loading contents of stack into any register is called POP
SP always points to top of the stack.
SP is decremented when data is inserted into stack.
SP is incremented when data is removed from the stack.
12. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 12
Example for Push operation:
As shown in the figure below, after every push operation the contents of register are saved on to
the stack and SP is decremented by 2. When 2 bytes are pushed onto stack, lower byte is always
stored in memory location with lower address, higher byte is stored in memory location with
higher address.
Example for POP operation:
As shown in the figure below, pop operation removes two bytes from stack, and increments the
stack pointer by 2
13. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 13
Logical address and physical address of stack segment:
Logical address of stack segment is shown as SS:SP
To calculate the physical address of stack segment
1. Shift SS left by one hex digit
2. ADD shifted SS with SP
Problem: IF SS=3500H and SP = FFFEH, find i) Physical address ii) Lower range iii) upper
range iv) show Logical address
Sol) i) physical address = 44FFEH (35000H + FFFEH)
ii) Lower range = 35000H (35000H + 0000H)
iii) Upper range = 44FFFH (35000H + FFFFH)
iv) Logical address = SS : SP = 3500H : FFFEH
Flag Register:
Flag register indicates some conditions produced by the execution of an instruction and controls
the operation of microprocessor.
8086 flag register:
8086 MP has 16-bit flag register.
It has six conditional flags and three control flags
Conditional flags:
The six conditional flags are
1. Carry flag (CF)
2. Parity flag (PF)
3. Auxiliary carry flag (AF)
4. Zero flag (ZF)
14. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 14
5. Sign flag (SF)
6. Overflow flag (OF)
Carry flag:
Carry flag holds the carry after addition or the borrow after subtraction.
It also indicates the error conditions.
Parity flag:
Parity is the number of ones in a binary number expressed as even or odd.
Parity flag is 0 for odd parity and logic 1 for even parity.
Auxiliary carry flag:
Auxiliary carry flag holds the half carry after addition or the borrow after subtraction.
Zero flag:
The Zero flag shows that the result of an arithmetic or logic operation is zero.
If Z=1, the result is zero, if Z=0 the result is not zero.
Sign flag:
The sign flag holds the sign of the result
If S=1 the sign is negative, if S=0 the sign is positive.
Overflow flag:
Overflow flag indicates that the result of arithmetic operation has exceeded the capacity of the
machine.
Control flags:
The three control flags are
1. Trap flag (TF)
2. Interrupt flag (IF)
3. Direction flag (DF)
Trap flag:
Trap flag enables debugging feature.
If T=1 debugging is enabled, if T =0 debugging is disabled.
Interrupt flag:
15. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 15
Interrupt flag controls the operation of interrupt request.
If I =1, interrupt request is enabled, if T=0 interrupt request is disabled.
Direction flag:
Direction flag selects either the increment or decrement mode for the DI and SI registers during
string instructions.
If D=1, the registers are automatically decremented, if D=0 the registers are automatically
incremented.
Flags affected by ADD instruction:
ADD instruction affects ZF, SF, PF, CF, AF
Problem: Show how flag register is affected by addition 38H and 2FH
Sol) MOV BH, 38H
ADD BH, 2FH
38H = 0 0 1 1 1 0 0 0
2FH = 0 0 1 0 1 1 1 1
67H = 0 1 1 0 0 1 1 1
CF =0 since there is carry out from MSB bit
AF=1 since there a carry from lower nibble to higher nibble
PF = 0 since there is an odd number of 1s in result
ZF=0 since result is not zero
SF =0 since MSB bit of the result is zero
16. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 16
X86 Addressing Modes: (very very Important)
Addressing modes:
The different ways in which the location of an operand is specified in an instruction are referred to
as addressing modes.
There are 7 addressing Modes
1. Register Addressing Mode
2. Immediate Addressing Mode
3. Direct Addressing Mode
4. Register Indirect Addressing Mode
5. Based Relative Addressing Mode
6. Indexed Relative Addressing Mode
7. Based Indexed relative Addressing Mode
17. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 17
Register addressing mode:
Register addressing mode uses registers to hold data.
e.g. MOV CX, DX ; contents of DX are moved to CX
Immediate Addressing Mode:
In immediate addressing mode source operand is constant.
e.g. MOV AX, 2550H; moves 2550H to AX
Direct Addressing Mode:
In direct addressing mode, data is in some memory location, address of memory location is
specified in instruction.
e.g. MOV DL, [2400H]; the data from memory location DS: 2400H is moved to DL
Problem on direct addressing mode:
Find the physical address of memory location and its contents after the execution of following
assuming that DS = 1512H
MOV AL, 99H
MOV [3518H], AL
Sol)
First 99H is moved to AL, then the contents of AL is moved to memory location with logical
address 1512H : 3518H
Physical address of the memory location = 18638H ( 15120H + 3518H)
Register Indirect Addressing Mode:
In this addressing mode, register holds address of memory location where data resides.
The registers used for holding address are SI, DI, and BX
SI, DI and BX holds offset address, to generate physical address, offset address must be
combined with DS.
e.g. MOV AL, [BX] ; it moves data from memory location pointing by DS: BX to AL
Problem on Register Indirect addressing mode:
Assume that DS= 1120H, SI = 2498H and AX = 17FEH, show the contents of memory locations after
execution of “MOV [SI], AX”
Sol) the contents of memory location AX are moved to memory location with logical address
DS:SI
Hence physical address = 13698H ( 11200H + 2498H)
Since two bytes are moved, lower byte (FE)is moved to memory location 13698H and higher byte
17 is move to memory location 13699H
18. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 18
Based relative Addressing Mode:
In this addressing mode, base registers BX, BP as well as displacement value are used to
calculate effective address.
The default segments used for calculation of physical address are DS for BX and SS for BP
e.g. MOV CX, [BX] + 10 ; it moves data from memory location with address DS:BX+10 to CX
the above instruction can also be written as MOV CX, [BX+10] or MOV CX, 10[BX]
in the above example
Effective address = BX+10 , physical address = DS(shifted left) + Effective address
Indexed Relative addressing mode:
In this addressing mode, index registers SI and DI as well as displacement value are used to
calculate effective address.
e.g. MOV DX, [SI] +5 ; Effective address = SI+5
Physical address = DS (shifted left) +effective address
This instruction moves data from memory location with address =DS(shifted left) + SI +5 to DX
Problem on Based relative addressing mode and Indexed relative addressing mode
Assume that DS =4500H, SS=2000H, BX=2100H, SI=1486H, DI = 8500H, BP = 7814H and
AX=2512H, show the exact physical memory location where AX is stored in each of the following
a) MOV [BX] +20, AX
b) MOV [SI] +10, AX
c) MOV [DI] +4, AX
d) MOV [BP] +12, AX
sol)
in each instruction
physical address = segment register(shifted left) + offset register + displacement
a) physical address = DS (shifted left) + BX+20 = 45000H + 2100H + 20H = 47120H
AX = 2512H, hence 12 will be moved to location 47120H and 25 will be moved to 47121H
b) physical address = DS (shifted left) + SI+10 = 45000H + 1486H + 10H = 46496H
AX = 2512H, hence 12 will be moved to location 46496H and 25 will be moved to 46497H
C) physical address = DS (shifted left) + DI+4 = 45000H + 8500H + 4H = 4D504H
AX = 2512H, hence 12 will be moved to location 4D504H and 25 will be moved to 4D505H
D) physical address = SS (shifted left) + BP+12 = 20000H + 7814H + 12H = 27826H
AX = 2512H, hence 12 will be moved to location 27826H and 25 will be move to 27827H
19. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 19
Based Indexed Addressing Mode:
In this addressing mode, base register and index register as well as displacement value are used to
calculate effective address.
e.g. MOV CL, [BX] [DI] +8 ; effective address = BX+DI +8
physical address = DS (shifted left) + effective address
In the above instruction data will be move from location with physical address = DS (shifted left)
+ effective address to CL
The above instruction can also be written as MOV CL, [BX+DI+8]
MOV AX, [SI][DI]+8 this instruction is illegal since both registers are index registers
Segment Override Prefix:
• Segment override prefix may be added to any instruction in any memory addressing mode.
• It allows the programmer to deviate from the default segment.
E.g. MOV AX, [DI] this instruction access the data within the data segment
by default.
MOV AX, ES:[DI]
In the above instruction override prefix ES is added, hence this instruction accesses the
data in extra segment.
Instruction Segment Accessed Default segment
MOV AX, DS: [BP] DATA STACK
MOV AX, ES: [BP] EXTRA STACK
MOV AX,CS: LIST CODE DATA
MOV AX, ES: [SI] EXTRA DATA
20. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 20
Assembly language instruction Format:
[LABEL] : Mnemonic [Operands] [;Comment]
Label filed:
label is symbolic name of the instruction.
It is optional
symbol : is used to separate the label and mnemonic
Mnemonic and operands:
Mnemonic and operand field together performs the operation.
Comment:
Comment field begins with symbol ;
Comments are optional
Model Definition:
.Model is directive used to select the size of the memory.
SMALL, MEDIUM, COMPACT, LARGE are the memory models.
e.g. .MODEL SMALL ; this directive defines memory model as SMALL
.MODEL MEDIUM ; in this memory model, data should fit in 64Kbytes , Code can exceed 64Kbytes
.MODEL COMPACT; data can exceed 64Kbytes, Code cannot exceed 64Kbytes
.MODEL SMALL; 64 Kbytes for Data , 64Kbytes for Code
.MODEL LARGE; both data and code can exceed 64Kbytes
.MODEL TINY; both data and code must fit in 64Kbytes
Segment Definition
8086 has four segment registers CS, DS, SS, ES
Segment definition uses three directive .CODE, .DATA, .STACK.
.CODE indicates beginning of code segment
.DATA indicates beginning of data segment
.STACK indicates beginning of stack segment
e..g .STACK 64 ; this directive reserves 64K bytes of memory for stack segment
21. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 21
Data Segment:
In data segment, data items are declared
Using directives DB, DW data items can be declared
DB (Define Byte) declares data item of size byte
DW(Define Word) declares data item of size word
Code segment:
It is last segment in the program
Instructions are written after .CODE directive
Sample program using model definition method
.MODEL SMALL
.DATA
MSG DB “RLJIT$”
.CODE
MOV AX, @DATA
MOV DS, AX
LEA DX, MSG
MOV AH,09H
INT 21H
END
Assemble Link and Run a program:
Three steps to create an executable assemble language program
1. Edit the Program
2. Assemble the program
3. Link the program
22. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 22
After editing the program, it must be assembled
Assembling the program:
Translating assembly program to machine program is called assembling
Assemble is the tool used for translation
Assembler generates three files
1. .ASM file
2. .OBJ file
3. .LST file
4. .CRF file
.ASM file:
it is a file created with editor
.OBJ file:
MASM assembler converts .asm file ( assembly language instructions) into .obj file ( machine
language instructions)
.LST file:
This file is optional
It lists all the opcodes and OFFSET addresses of instructions
To get LIST file TYPE FILENAME.lst | more
Note: MASM assumes that list file is not wanted (NUL.LST indicates no list file)
CRF file (cross reference file):
This file contains list of all symbols and labels used in the program as well as program line
numbers in which they are specified.
PAGE directive: this directive tells the printer how the list file should be printed
Format: PAGE [LINES], [COLUMNS]
E.g. PAGE 60,132 ( default : 66 , 80)
TITLE Directive: this directive is used to assign the name to program
Format : TITLE name of the program
e.g. TITLE display a message
Linking the program: Linker is a program which produces executable file (.exe)
.OBJ file is the input to LINK
linker links mulitple .obj files to create .exe file ( executable file)
linker produces .MAP file
23. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 23
.MAP file:
It is optional file, It contains the following
1. name of each segment
2. start of segment
3. end of segment
4. size of segment
CONTROL Transfer Instructions:
There are three control transfer instructions
1. Conditional Jump
2. Unconditional Jump
3. Call
Conditional jump instructions:
• Conditional jump instructions transfers program control to the target location if some specified
condition is satisfied.
Following are the conditional Jump instructions
24. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 24
Unconditional jump:
There are three types of unconditional jumps.
1. Short jump
2. Near jump
3. Far jump
Short jump:
• JMP is the opcode for the short jump.
• Short jump is 2-byte instruction.
• The short jump displacement is a distance represented by a 1-byte signed number whose value
ranges between -128 and -+27.
• Jump to a memory location in same segment is called intrasegment jump, short jump is
intrasegment
Near jump:
• JMP is the opcode for the near jump.
• Near jump is 3-byte instruction, that contains an opcode followed by a signed 16-bit
displacement.
• Near jump transfers control to an instruction in the current code segment located within ± 32
Kbytes from the near jump instruction.
• Signed displacement is added to instruction pointer to generate the target address.
Far jump:
• JMP is the opcode for the FAR jump.
• FAR jump is 5-byte instruction, bytes 2 and 3 contains new offset address and bytes 4 and 5
contain the new segment address.
• Jump from one segment to another segment is called intersegment jump, Far Jump is
intersegment.
CALL:
Call instruction transfers control to the procedure.
There are two types of call.
1. Near call
2. Far call
Near call:
• Near call instruction is 3 bytes long.
• First byte contains the opcode, and the second and third bytes contain the displacement.
• Near call instruction pushes the offset address of the next instruction onto the stack.
• After saving return address in stack it adds the displacement to IP to transfer control to the
procedure.
Far call:
• Far call is 5-byte instruction.
25. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 25
• First byte contains opcode.
• Second and third bytes contain the new contents of IP.
• Bytes 4 and 5 contain new contents for CS.
• The far call instruction places the contents of both IP and CS on stack before jumping to the
procedure.
Rules for names in Assembly Language:
Each label name must be unique
The first character of the name must be an alphabetic character or special character but not digit.
Data types and Data definition:
Data types of 8086 processor are
1. 8-bit (byte)
2. 16-bit (word)
3. 32-bit (double word)
4. 64-bits (Quad word)
Assembler Data directives:
To define data, following assembler directives are used
1. DB (define Byte)
2. DW ( Define Word)
3. DD ( Define Double Word)
4. DQ (define Quad Word)
5. DT (define Ten Bytes)
DB (define byte):
It defines the variable of type BYTE.
It reserves one or more byte locations in memory.
Format: variable-name DB Initialization values
E.g. NUM DB 10H; this statement reserves one byte location for a variable name NUM
and initialize the value 10.
NUM
NUM DB ? ; this statement reserves one byte location for variable NUM and not initialized.
10
26. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 26
DW (define word):
It defines a variable of type word.
Word ( two bytes).
It reserves one or more word locations in memory.
Format: variable-name DW initialization values
E.g. DATA DW 1234H; this statement reserves one word location and initializes the
the value 1234H.
DATA
DD (define double word):
• It defines a variable of type double word.
• Double word (4 bytes)
• It reserves one or more double word locations in memory .
Format: variable-name DD initialization values
e.g. DATA DD 12345678H; it reserves double word location and initializes with
12345678H.
DATA
DT (define ten bytes):
• This directive defines a variable of type ten bytes.
Format : variable-name DT initialization values
e.g. TOTAL DT 0; this statement reserves ten bytes and initializes with 0.
DQ (define quad word):
• It defines a variable of type quad word.
• Quad Word ( 8 bytes).
• It reserves one or more quad word locations in memory.
Format : variable-name DQ initialization values
12
34
34
12
34
56
78
27. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 27
e.g. TOTAL DQ 0
TOTAL
DUP:
• It creates an array of size n.
e.g. LIST DB 10 DUP (?) reserves 10 byte locations
DATA DW 100 DUP (0) reserve 100 word locations and
initializes with 0
EQU:
• This directive equates the constant value to the label.
• Each time the assembler finds the label in the program, it will replace the name with the value
equated to that label.
e.g. TEN EQU 10
NINE EQU 9
MOV AL, TEN; AL =10
MOV BL, NINE; AL=9
ORG (origin):
• This directive assigns the starting OFFSET address.
Format: ORG OFFSET address.
e.g. ORG 100H; this statement assigns 100 as starting offset address.
00
00
00
00
00
00
00
00
28. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 28
Full Segment Definition:
This is another method to define the segments in the program.
Segment definition
To define the segment, directives SEGMENT and ENDS are used.
Segment Directive
• This directive is used to indicate the beginning of a logical segment.
• This directive follows the name of the segment.
Format: Segment-name SEGMENT
e.g. MYDATA SEGMENT; MYDATA is the segment name.
ENDS:
ENDS:
• This directive indicates the end of the segment.
• This directive follows the name of the segment.
Format: Segment-name ENDS
e.g. MYDATA ENDS
Example: defining the data segment using full segment definition method
MYDATA SEGMENT
LIST DB 10H
STRING DB “Welcome to MP lab$”
MYDATA ENDS
Example: defining the code segment using full segment definition method
MYCODE SEGMENT
MOV AX,@DATA
MOV DS, AX
MYCODE ENDS
29. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 29
Flow Charts and Pseudocode:
Flowchart:
Flowchart uses graphical symbols to represent different types of program operations.
Symbols are connected together into flow chart to show the flow of program.
The figure below shows most commonly used symbols
Limitations of flowchart:
We cannot write much information in little boxes
Flowchart is bigger for big programs
Commonly used flow chart symbols are
30. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 30
Control Structures:
Structured programming uses three types of program structures
1. Sequence programming structure
2. Control programming structure
3. Iteration programming structure
Control programming structure:
Two types
i) IF – THEN
ii) IF – THEN - ELSE
31. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 31
Flow chart and pseudo code for IF- THEN:
Flow chart and pseudo-code for IF-THEN-ELSE
32. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 32
Iteration programming structure:
Two types
1) REPEAT – UNTIL
2) WHILE-DO
REPEAT -UNTIL
WHILE-DO:
33. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 33
Draw flow chart and write pseudocode to add 5 bytes
Program to add 5 bytes of data
34. 15CS44 Microcontrollers & Microprocessors
Kishore Kumar R RLJIT Page 34
Important Questions
1. Explain the evolution (history) of Intel processor
2. Draw and explain internal block diagram of 8086/ 8088 CPU
3. Explain the flag register of 8086
4. distinguish between Logical address, Physical address and OFFSET address
Logical address is shown as Segment register value : Offset address
Physical address is the address of the physical location, it is calculated by shifted segment register value
left by one hex digit and adding offset value to shifted segment value
Offset address : it is distance of particular location from the base of the segment
5. what is segment override prefix, explain
6. what are assembler directives? Explain the following assembler directives i) .MODEL ii) .STACK
iii) .DATA
Assembler directives (pseudo instructions):
Assembler directives are the instructions to the assembler.
Assembler directives are not translated into the machine language.
Directives control the generation of machine code and organisation of the program.
7. with flow chart and pseudocode write an ALP to add 5 bytes of data
8. What is stack? Exaplain pushing and popping data from stack
9. if SS= 3500H and SP = FFFEH, find physical address, lower range, upper range, Logical address
10. Explain pipelining
11. IF CS=24F6H and IP=634AH, find logical address, offset address, physical address, Lower range and
upper range of code segment
12. Explain short, near and Far unconditional jump instructions with examples.