lect 3-4 - copy
TRANSCRIPT
-
8/3/2019 Lect 3-4 - Copy
1/26
Objectives
To look at the stored program concept employed
in modern computer system
To learn the difference between program,
address and data
To study the software model of Intel
8088/8086 MPU
To look at the data format in 8088/8086
To study the memory organization in 8088/8086
-
8/3/2019 Lect 3-4 - Copy
2/26
Stored Program Concept
A microprocessor is capable of performing numerousoperations (normally over 100 different operations)
However, it will only carry out what it has been told to do
The operations which the microprocessor can be told to
perform are called instructions A group of instructions arranged in a logical order is known
as a program
A computer is often compared to a calculator, which is toldwhat to do by the operator via the keypad
By pressing the right keys, we can instruct a calculator toadd, subtract, multiply, divide etc (instructions).
We must also key in the numbers to be added, subtractedetc (data).
-
8/3/2019 Lect 3-4 - Copy
3/26
Stored Program Concept-Cont.
With a calculator, we can add a list of numbers as quicklyas we can enter the numbers and instructions
Therefore, the operation is limited by the speed andaccuracy of the operator
Computer designers recognized that it was the humanoperator that slowed down the computation process
To overcome this, the stored program concept wasintroduced
Using this approach, the instructions (program) and data
are stored in the computer memory For e.g., we have 20 numbers to be manipulated by a
program with 100 instructions and 10 answers will beproduced in the process
-
8/3/2019 Lect 3-4 - Copy
4/26
Stored Program Concept-Cont.
Before any computation begins, the 100-instructionprogram plus the 20 numbers are loaded into thecomputer memory
Furthermore, 10 memory locations are reserved for 10answers
Only then the computer is allowed to execute theprogram
The actual computation time depends on the speed ofthe computer (normally less than 1ms)
This automatic operation is one of the features thatdistinguishes the computer from the calculator
-
8/3/2019 Lect 3-4 - Copy
5/26
Program, Address, Data
Microprocessor performs operations on dataheld in the memory where program is alsolocated.
Thus, program and data used by computerare located in the same memory, but indifferent region
A computer that keeps instructions and datain the same memory is called a von Neumannmachine
-
8/3/2019 Lect 3-4 - Copy
6/26
Program, Address, Data-Cont.
*Named after the mathematician, John von Neumann
-
8/3/2019 Lect 3-4 - Copy
7/26
Program, Address, Data-Cont.
Memory is normally regarded as array of
storage locations (drawers)
Each drawer contains some data Each drawercan be identified with a unique number known
as address
-
8/3/2019 Lect 3-4 - Copy
8/26
Example Figure below demonstrates how a program (instructions) and
data coexists in the same memory:
-
8/3/2019 Lect 3-4 - Copy
9/26
Example-Cont.
In this example, the memory has only seven locations, withaddress from 0 to 6
The program occupies memory locations at address 0 to 3,and the data at address 4 to 6
The first instruction Get [4] means get the contents ofmemory location at address 4 from memory
Square brackets is used to denote the contents of theaddress they enclose, so [4] = 2
Second instruction Add it to [5], means add the number
brought by the previous instruction to the contents ofaddress 5
Therefore, the microprocessor adds 2 to 7 to get 9
-
8/3/2019 Lect 3-4 - Copy
10/26
Example-Cont.
Third instruction Put result in [6], tells the
computer to put the result in memory at
address 6
The 1 that was in address 6 before the
instruction is replaced by 9
Finally, the last instruction in address 3 tells
the computer to stop
-
8/3/2019 Lect 3-4 - Copy
11/26
Software Model of 8088/8086
Microprocessor
The software model helps the programmer inunderstanding the operation of a microprocessorfrom a software point of view
To program a microprocessor, there is no needto know all its hardware architectural features
A programmer should know the variousregisters and understand their purpose,functions, operating capabilities and limitations
The programmer should also know howinformation is arranged in registers, memory,input/output, and how memory and I/O areaddressed to obtained instructions and data
-
8/3/2019 Lect 3-4 - Copy
12/26
The software model above illustrates the software architecture of the 8088/086 microprocessor
-
8/3/2019 Lect 3-4 - Copy
13/26
Software Model of 8088/8086
Microprocessor- Cont.
The model includes 13 16-bit registers:i. Instruction pointers
ii. Four data registers (AX, BX, CX and DX)
iii. Two pointer registers (BP and SP)
iv. Two index registers (SI and DI)
v. Four segment registers (CS, DS, SS and ES)
In addition, there is another register called Status Register(SR), with nine of its bits implemented as status and controlflags
The 8088/8086 architecture implements independentmemory and input/output address spaces
The memory address space is 1,048,576 bytes (1Mbytes) insize and the I/O address space is 65,536 bytes (64Kbytes) insize
-
8/3/2019 Lect 3-4 - Copy
14/26
Memory Address Space & Data
Organization
The 8088/8086 supports 1Mbyte of externalmemory
The memory space is organized as individual
bytes of data stored at consecutive addressesover the address range 0000016 to FFFFF16 (or00000H to FFFFFH)
Two consecutive bytes can be accessed as oneword (16 bits) of data
The lower-addressed byte is the least significantbyte of the word, and the higher-addressed byteis its most significant byte (little endian format)
-
8/3/2019 Lect 3-4 - Copy
15/26
Example
-
8/3/2019 Lect 3-4 - Copy
16/26
Example-Cont.
-
8/3/2019 Lect 3-4 - Copy
17/26
Example-Cont.
-
8/3/2019 Lect 3-4 - Copy
18/26
Example
-
8/3/2019 Lect 3-4 - Copy
19/26
Solution
-
8/3/2019 Lect 3-4 - Copy
20/26
Example
-
8/3/2019 Lect 3-4 - Copy
21/26
Example
-
8/3/2019 Lect 3-4 - Copy
22/26
-
8/3/2019 Lect 3-4 - Copy
23/26
Example
-
8/3/2019 Lect 3-4 - Copy
24/26
Solution
-
8/3/2019 Lect 3-4 - Copy
25/26
Data TypesThe 8088/8086 can store data in 3 formats: byte (8 bits), word (16 bits) and doubleword (32 bits)
Data types that can be stored as byte:
i. Unsigned integer (010 to 25510)
ii. Signed integer (-12810 to 12710)
iii. ASCII characteriv. Unpacked BCD (one digit)
v. Packed BCD (two digits)
Data types that can be stored as word:
i. Unsigned integer (010 to 6553510)
ii.S
igned integer (-3276810 to 3276710)iii. Instruction code
Data types that can be stored as double word:
i. Pointer (segment:offset)
ii. IEEE single-precision floating point number
-
8/3/2019 Lect 3-4 - Copy
26/26
Extra Example
1. How would -204710 be stored in an 8086
based computer in memory starting at
address 0A000H?
2. How would the unpacked BCD 29 be stored
in memory starting at address 0B000H?
(assume that the least significant digit is
stored at the lower address).