Upload
ashesh-b-vignesh
View
225
Download
0
Embed Size (px)
Citation preview
8/10/2019 Basics of Electrical Measurement
1/98
Formative Assessment
Ashesh B Vignesh
110110013
I.C.E. Department
20102014 Batch
Microprocessors andMicrocontrollers
Unit 1
8/10/2019 Basics of Electrical Measurement
2/98
Introduction
Definition: A microprocessor is a multipurpose,programmable, clockdriven, registerbased
electronic device that reads binary instructions
from a storage device called memory, accepts
binary data as input and process data
according to those instructions and provides
results as output
8/10/2019 Basics of Electrical Measurement
3/98
Introduction
Basically, very similar to human brain
Physical Components are calledhardware
Set of instructions written for microprocessor
called a programA group of programsis called software
8085 is an 8 bitmicroprocessor
8086 is a 16 bit microprocessor
8/10/2019 Basics of Electrical Measurement
4/98
Microprocessor as a CPU (MPU)
Traditionally the computer is represented by a) infigure
Diagram shows that has four components:
memory, input, output and the CPU, which
consists of the ALU
CPU contains various registers to store data, the
ALU to perform arithmetic and logical operations
etc.
It communicates with I/O devices either to accept
or send data
These devices are also known as peripherals
CPU is the primary and central player in
8/10/2019 Basics of Electrical Measurement
5/98
Microprocessor as a CPU (MPU)
It became possible to build the CPU on a singlechip: this came to be known as a microprocessor
The new block diagram is shown b)
A computer with a microprocessor as its CPU is amicrocomputer
c) shows the microcontroller chip also includes
additional devices such as an A/D convertor,
serial I/O etc.
8/10/2019 Basics of Electrical Measurement
6/98
Microprocessor as a CPU (MPU)
8/10/2019 Basics of Electrical Measurement
7/98
Memory
Memory stores such binary informations asinstructions and data
Provides that information to microprocessor when
necessary
To execute programs, microprocessor reads
instructions and data from memory
There are two type of memory
ReadOnly Memory (ROM) Read/Write Memory (R/WM) also known as (RAM)
8/10/2019 Basics of Electrical Measurement
8/98
ROM
ROM is used to store programs that do not needalterations
Monitor program of a singleboard
microcomputer is stored in ROM
Programs stored in ROM can be only read, not
altered
8/10/2019 Basics of Electrical Measurement
9/98
RAM
RAM is also known as user memory
It is used to store user programs and data
In singleboard microcomputers, the monitor
program monitors the HEX keys, and storesthose instructions and data in RAM
The information stored in this memory can be
easily read and altered
8/10/2019 Basics of Electrical Measurement
10/98
MPU initiated operations and BUS
organization
MPU performs primarily performs 4 operations Memory Read
Reads data or instructions from memory
Memory Write
Writes data or instructions into memory
I/O Read
Accepts data from input devices
I/O Write
Sends data to output devices
8/10/2019 Basics of Electrical Measurement
11/98
MPU initiated operations and BUS
organization
Operations are part of communication process
between the MPU and peripheral devices
To communicate with peripheral, MPU needs to
perform following steps: Step 1: Identify the peripheral or the memory location
Step 2: Transfer binary information
Step 3: Provide timing or synchronization signals
Provides functions using 3 sets of communicationlines:
Address bus, Data bus and Control bus
8/10/2019 Basics of Electrical Measurement
12/98
8085 Bus Structure
8/10/2019 Basics of Electrical Measurement
13/98
Address Bus
Address bus is group of 16 lines generallyidentified asto
Address bits are unidirectionalfrom MPU to
peripheral devices
The MPU uses the address bus to perform the
first step
Each memory location is identified by a binary
number called addressAddress bus is used to carry a 16bit address
8/10/2019 Basics of Electrical Measurement
14/98
8/10/2019 Basics of Electrical Measurement
15/98
Control Bus
Comprised of various single lines that carrysynchronization signals
Uses such lines to perform step 3
These lines provide a pulse to indicate an MPU
operation
MPU generates specific control signals for every
operation it performs
These signals are used to identify a device typewith which the MPU intends to communicate
8/10/2019 Basics of Electrical Measurement
16/98
8/10/2019 Basics of Electrical Measurement
17/98
8085 Logic Pinout and Signals
8/10/2019 Basics of Electrical Measurement
18/98
Signals of 8085
There are 6 groups of control and status signalsAddress Bus
Data Bus
Control and Status signals
Power supply and frequency signals
Externally initiated signals
Serial I/O Ports
8/10/2019 Basics of Electrical Measurement
19/98
Address Bus
8085 has 16 pins used as address bus Split into two segments: A15A8and AD7AD0
A15A8are unidirectional
Used for most significant bits called highorder
address
AD7AD0are used for a dual purpose
8/10/2019 Basics of Electrical Measurement
20/98
Multiplexed Address/Data Bus
AD7AD0are bidirectional and serve dualpurpose
Used as loworder address bus and data bus
When executing instruction:
Earlier part of cycle: loworder address bus
Later part of cycle used as data bus
Known as multiplexing the bus
Loworder bus can be separated by using alatch
8/10/2019 Basics of Electrical Measurement
21/98
Control and Status signals
There are 6 main signals
Two control signals
and
Three status signals
/, and
Identify the nature of the operation
One special signal
Indicate beginning of operation
8/10/2019 Basics of Electrical Measurement
22/98
Control Signal
ReadA Read control signal (active low)
Indicates selected /or memory device is to be
read
Indicates data available on the data bus
Write
Write control signal (active low)
Indicates the data on data bus are to be written into
selected memory or /location
8/10/2019 Basics of Electrical Measurement
23/98
Status Signals
/- Input/Output or Memory Signal used to differential between I/O and memory
operation
When High, it indicates I/O operation
When Low, it indicates memory operation
Combined with and to generate I/O and
Memory control signals
and
Similar to
Can identify various operations but rarely used in
small systems
8/10/2019 Basics of Electrical Measurement
24/98
Machine Cycle Status and Control
Signal
8/10/2019 Basics of Electrical Measurement
25/98
Power Supply and Clock
Frequency
+5 V Power Supply
Ground Reference
, 2
A crystal (or RC, LC) network is connected at these
two pins
To operate at 3 MHz, crystal should have afrequency of 6 MHz
()
Clock output: This signal can be used as the system
clock for other devices
8/10/2019 Basics of Electrical Measurement
26/98
Externally Initiated Signals, Including
Interrupts
8085 has 5 interrupt signals Used to interrupt program execution
Microprocessor acknowledges an interrupt
request by (Interrupt Acknowledge) signal
Three pins - , and
Accept externally initiated signals as input
8/10/2019 Basics of Electrical Measurement
27/98
Interrupts
To respond to Request, there is a signalcalled (HOLD Acknowledge)
:
: When signal in this pin goes low,
program counter set to zero Buses are tristated and MPU is reset
: Indicates that MPU is being reset
Cen be used to reset other devices
The other interrupts are shown in the table
8/10/2019 Basics of Electrical Measurement
28/98
Interrupt signals
8/10/2019 Basics of Electrical Measurement
29/98
Serial I/O Ports
There are two signals to implement serialtransmission
(Serial Input Data)
(Serial Output Data)
During serial transmission, data bits are sent over
a single line, one bit at a time, such as the
transmission over telephone lines
8/10/2019 Basics of Electrical Measurement
30/98
Detailed look at 8085 architecture
The 8085 consists of the following:ALU (Arithmetic/Logic Unit)
Timing and Control Unit
Instruction Register and Decoder
Register Array
Interrupt Control
Serial I/O Control
8/10/2019 Basics of Electrical Measurement
31/98
Block Diagram of 8085 Architecture
8/10/2019 Basics of Electrical Measurement
32/98
The ALU
Performs computing functions Includes:
The accumulator
Temporary register
The arithmetic and logic circuits
Five Flags
The temporary register holds date during an
arithmetic/logic operation Result stored in accumulator
Flags are set or reset according to the result of
the operation
8/10/2019 Basics of Electrical Measurement
33/98
ALUFlags
S
SignflagAfter an arithmetic or logic operation, if bit 7of the
result (usually in accumulator) is 1, the Sign flag is
set
In a given byte, if 7is 1, number is negative,otherwise if 0, it is positive
In arithmetic operations with signed numbers, bit 7
is reserved for indicting sign
Remain 7 bits are for magnitude of number For unsigned numbers, value of bit 7is irrelevant
to the sign of number (positive or negative)
8/10/2019 Basics of Electrical Measurement
34/98
ALUFlags
Z
Zero Flag Zero flag is set if ALU operation results in 0
Flag is reset if result is not 0
Flag is modified by results in accumulator as well as
other registers AC Auxiliary Carry Flag
In arithmetic operation, when carry is generated bybit 3and passed to 4, AC flag is set
Used only internally for Binary Coded Decimal(BCD) operations
Not available for programmer to change sequenceof program with jump instruction
8/10/2019 Basics of Electrical Measurement
35/98
ALU - Flags
P
Parity Flag If result of operation has an even number of 1s, flag
is set (e.g. 0000 0011)
If there is odd number of 1s, flag is reset (e.g. 0000
0111) CYCarry Flag
If operation results in carry, the Carry flag is set
Otherwise, reset
Also serves as the borrow flag for subtraction
8/10/2019 Basics of Electrical Measurement
36/98
ALU - Flags
The bit positions reserved for these flags in theflag register are as follows
AC Flag is used internally for BCD arithmetic
Instruction set does not include any conditional
jump instructions based on the AC flag
Z and CY flags are most commonly used
8/10/2019 Basics of Electrical Measurement
37/98
Timing and Control Unit
This unit synchronizes all operations with clock Generates control signals necessary for
communication between processor and
peripherals
Similar to a sync pulse in an oscilloscope
The and signals are sync pulses
Indicating availability of data on data bus
8/10/2019 Basics of Electrical Measurement
38/98
Instruction register and Decoder
Instruction register and Decoder are part of ALU When instruction is fetched from memory. It is
loaded in the instruction register
Decoder decodes instruction and establishes
sequence of events to follow
Instruction register is nonprogrammable and
not accessible through instructions
8/10/2019 Basics of Electrical Measurement
39/98
8086 microprocessor
Inter iAPX 8086 is a 16bit microprocessor Housed in 40pin package
Capable of addressing 1 MB of memory
Various versions can operate with clockfrequencies from 5 MHz to 10 MHz
8/10/2019 Basics of Electrical Measurement
40/98
8086 Architecture
The 8086 has a 16bit external data bus Signals of the 8086 are classified in seven
categories
1) Address bus
2) Data Bus
3) Control and status signals
4) External requests
5) Response to external requests
6) Power and clock
7) Signals for micro processing environment
The first six categories are the same as the 8085
8/10/2019 Basics of Electrical Measurement
41/98
8086 Architecture Figure
8/10/2019 Basics of Electrical Measurement
42/98
8086 Architecture
The 7thcategory, Signals for multiprocessorenvironment, is a new
It includes 2 signals
/(minimum or maximum mode)
Test
The data bus and status signals are multiplexed
with the address bus
16 data lines,15 0are multiplexed
8/10/2019 Basics of Electrical Measurement
43/98
Signals different from 8085
/- Minimum/Maximum mode Represents two operation modes; minimum and
maximum
When signal is high (connected to +5 V): Minimum
When signal is low (grounded): Maximum Minimum mode used for single processor
environment
Maximum mode used for multiprocessor
environment In Maximum mode, 8 pins assigned different
functions as compared to maximum mode
Bus controller is necessary to generate control signals
Mi i /M i d t l
8/10/2019 Basics of Electrical Measurement
44/98
Minimum/Maximum mode control
signals
8/10/2019 Basics of Electrical Measurement
45/98
Signals different from 8085
Test Used to synchronize operations of multiple
processors in a system
When WAIT instruction is being executed,
processor checks this signal If high, processor interrupts execution of program
If low, it continues execution
- Data Enable
Active low output signal
Generally connected to bidirectional buffer to isolate
MPU from system bus
8/10/2019 Basics of Electrical Measurement
46/98
Signals different from 8085
/- Data Transmit/Receive Connected to a bidirectional buffer to enable data
flow
/- Memory and I/O
Indicates whether processor cycle is I/O operationor memory operation
- Bus High Enable
Active low signal used to enable the highorder
byte of 16bit data
8/10/2019 Basics of Electrical Measurement
47/98
Stack
Stack can be described as a set of memorylocations in R/W memory
Beginning of the stack is defined in the program
by using instruction LXI SP
Loads a 16bit memory address in the stackpointer register of the micro processor
Once stack location defined, storing of data bytes
startsat the memory address that is 1 less that
the address in the stack pointer register
8/10/2019 Basics of Electrical Measurement
48/98
Stack
As a general practice, the stack is initalized at thehighest avaible memory location
To prevent the program from being destroyed by the
stack information
Size of stack is limited only by
Data bytes in register pairs of the microprocessor
can be stored on the stack
Stored (two at a time) in reverse order (decreasing
memory address)
By using instruction PUSH
8/10/2019 Basics of Electrical Measurement
49/98
Stack
Data byte can be transferred from stack torespective registers by using instruction POP
Stack pointer register tracks the storage and
retrieval of the information
Because two bytes are stored at a time
16bit memory address in stack pointer register is
decremented by two
When retrieved, address is incremented by two
8/10/2019 Basics of Electrical Measurement
50/98
Stack
8/10/2019 Basics of Electrical Measurement
51/98
Stack
8/10/2019 Basics of Electrical Measurement
52/98
Subroutine
Group of instructions written separately from mainprogram to perform a function that occurs
repeatedly in the main program
There are two instructions to implement
subroutine CALL (Call a subroutine)
RET (Return to main program)
8/10/2019 Basics of Electrical Measurement
53/98
Subroutine
When subroutine is called, the contents of theprogram counter is stored on the stack
Program execution is transferred to subroutine
address
When RET is executed, memory address stored
on the stack is retrieved and sequence of
execution is resumed to main program
8/10/2019 Basics of Electrical Measurement
54/98
Subroutine
8/10/2019 Basics of Electrical Measurement
55/98
Registers
The operations with the microprocessor performsare:
Store 8bit data
Perform arithmetic and logical operations
Test for conditions Sequence for execution of instructions
Store data temporarily during the execution in the
defined R/W memory locations called stack
8/10/2019 Basics of Electrical Measurement
56/98
Registers
To perform operations, the microprocessorrequires registers, ALU, and BUS
Registers store data or instructions
There are a total of 9 registers which is of
importance
6 General Purpose registers
2 Special Registers
1 Main Register
8/10/2019 Basics of Electrical Measurement
57/98
Registers
8/10/2019 Basics of Electrical Measurement
58/98
Registers
The 6 general purpose registers are: B, C, D, E,H and L
Each register is 8 bits long
Can be combined to give register pairs
B-C, D-E, H-L
Each register pair will then be 16 bits long
8/10/2019 Basics of Electrical Measurement
59/98
Registers
The accumulator is an 8 bit register that is part ofthe ALU
This register is used to store 8 bit data and to
perform arithmetic and logical operations
Used as a register for storing on data when twoare arithmetically operated
The result of the operation is stored also in the
accumulator which is identified as A.
When only one data is to be logically operated, A
is used for storing data and for storing result after
operation
8/10/2019 Basics of Electrical Measurement
60/98
Special Registers
The program counter (PC) is a 16 bit specialfunction register in the 8085 microprocessor.
Sequences execution of instruction
Keeps track of memory address of next
instruction once current is executed In other words, holds address of memory of next
instruction when current instruction is completed
When user enters a memory address and
presses execute key, it is pushed into PC Once processor begins execution, it places the
memory address user entered into address bus
8/10/2019 Basics of Electrical Measurement
61/98
Program Counter
The address in PC is incremented for nextoperation
Once execution is done, the next address in
placed on address bus, and PC is incremented
again It basically points next location of memory where
data can be stored
8/10/2019 Basics of Electrical Measurement
62/98
Stack
Stack can be defined as:A set of memory locations in the R/W memory,
specified by a programmer in a main program
These memory locations are used to store binary
information (bytes) temporarily during executionof a program
The location of the stack is defined by the stack
pointer
The stack pointer is a 16bit register
Used as a memory pointer to identify the stack
Used when interrupt is generated by
microprocessor
8/10/2019 Basics of Electrical Measurement
63/98
Stack
The beginning of the stack is defined in theprogram by using the instruction LXI SP (e.g. LXI
SP, 2099H)
This instruction loads a 16bit memory address
in the stack pointer Once stack location defined, storing of data bytes
begins at memory address that is one less than
address in SP
For example, if SP is loaded with address 2099H,
the storing of data bytes begins at 2098H
The rest of the data is stored in reverse order
(2097H, 2096H...)
8/10/2019 Basics of Electrical Measurement
64/98
Stack
We call this as the stack growing backwards Hence, stack is initialized at highest available
memory location to prevent program from being
destroyed
The size of the stack is limited only by theavailable memory
The 8085 provides two instructions: PUSH and
POP for storing information on the stack and
retrieving it back
Information is saved on the stack by PUSHing it
on
It is retrieved from the stack by POPing it off.
8/10/2019 Basics of Electrical Measurement
65/98
PUSH
PUSH is a 1 byte instruction Example: PUSH B (B has value 12 and C has
value F3)
The process of how PUSH works:
First, decrease SP by one
Then copy contents of register B to memory
location pointed now by SP after decrement
Decease SP by one again
Copy contents of register C to location pointed by
SP
8/10/2019 Basics of Electrical Measurement
66/98
POP
POP is a 1 byte instruction For example POP D (used after PUSH B from last
slide)
Process of how POP works:
Copy contents of memory location pointed by SP to
register E
Increase the SP by 1
Copy contents of memory location pointed by SP to
register D after increment
Increase SP
8/10/2019 Basics of Electrical Measurement
67/98
Stack
Note: operands B, D and H represent registerpairs BC, DE and HL respectively
During pushing, the stack operates in adecrement then store style.
The stack pointer is decremented first, then theinformation is placed on the stack.
During popping, the stack operates in a use thenincrement style. The information is retrieved from the top of the
stack and then the pointer is incremented.
The SP pointer always points to the top of thestack.
8/10/2019 Basics of Electrical Measurement
68/98
LIFO
LIFO is an acronym When expanded, it becomes Last In First Out
This is how the stack operations work, where the lastbyte to be stored will be retrieved first
To retrieve information back into original location, onemust make order of PUSH and POP opposite to eachother
Example:
PUSH B
PUSH D POP D
POP B
If the POP instructions are reversed, there will be an
exchange of contents of BC and DE register pairs
8/10/2019 Basics of Electrical Measurement
69/98
8 Bit Addition
Start program by loading the first data intoaccumulator
Load the second data into other register
Add the contents of the two registers
Check for carry
Store the value of sum and carry in memory
location
Terminate the program
8/10/2019 Basics of Electrical Measurement
70/98
Program
Loop Memory Instruction Op Code Comment4100 MVI C, 00H OE
Initialise C to 00H4101 OO
4102 LDA, 4200H 3A
Load the 1st data in A4103 OO
4104 42
4105 MOV B,A 47 Move Content of A to B
4106 LDA, 4201H 3A
Load the 2nd data4107 O14108 42
4109 ADD B 80 Add B to A
410A JNC 410EH O2
Jump on no carry410B 0E
410C 41
410D INR C OC Increment content of S
LOOP 410E STA, 4400H 32
Store the content of A to 4400H410F OO
4110 44
4111 MOV A, C 79 Move the content of C to A
4112 STA, 4401H 32
Store the content of A to 4401H4113 O1
4114 44
4115 HLT 76 Terminate the Program
8/10/2019 Basics of Electrical Measurement
71/98
16 Bit addition
Algorithm Start the program by loading HL register pair with
address of 1stnumber.
Copy the data to DE register pair.
Load the second number to HL pair.
Add the two register pair contents.
Check for carry.
Store the value of sum and carry in memorylocations.
Terminate the program.
8/10/2019 Basics of Electrical Measurement
72/98
ProgramLoop Memory Instructions Opcode Comment
4200 MVI C, OO OE Initialize C a 04201 OO
4202 LHLD 4500 2A
Load address of 1st number to HL pair4203 OO
4204 45
4205 XCHG EB Copt 1st number to DE pair
4206 LHLD 4502 2A
Load address of 2nd number to HL pair4207 O24208 45
4209 DAD A 19 Add HL pair with DE pair
420A JNC LOOP D2
JUMP on no carry to the label LOOP420B OE
420C 42
420D INR C OC Increment C by 1
LOOP 420E SHLD 4100 22
Store HL pair content to 4100420F OO
4210 41
4211 MOV A, C 79 Contents of C copied to A
4212 STA 4102 32
Store accumulator content to 41024213 O2
4214 41
4215 HLT 76 Program Ends
8/10/2019 Basics of Electrical Measurement
73/98
8 Bit subtraction
Start the program by loading the first data intoaccumulator
Load the second data into other register
Subtract the second register data from the
accumulator
Check for positive
Store the result in some memory location
Terminate the program
8/10/2019 Basics of Electrical Measurement
74/98
ProgramLoop Memory Instruction Op Code Comment
4100 MVI C, 00H OEInitialise C to 00H
4101 OO
4102 LDA, 4200H 3A
Load the first Data4103 OO
4104 42
4105 MOV B,A 47 Move contents of A to B
4106 LDA, 4201H 3A
Load the 2nd data4107 O14108 42
4109 SUB B 90 Subtract B from A
410A JP LOOP F2
Jump if Positive410B 0E
410C 41
410D DCR C OD Decrement C
LOOP 410E STA, 4300H 32
Store value in A410F OO
4110 43
4111 MOV A, C 79 Move contents to C
4112 STA, 4301H 32
Store value in A4113 O1
4114 43
4115 HLT 76 Terminate Program
8/10/2019 Basics of Electrical Measurement
75/98
16 Bit Subtraction Start the program by loading HL register pair with address of
1stnumber.
Copy the data to DE register pair.
Load the second number to HL pair.
Copy data in register E to Accumulator.
Copy date in register L to register B.
Subtract data in register B from Accumulator.
Check for carry.
If carry is present take 2s complement of Accumulator.
Store the difference value in the memory location.
Copy data in register D to Accumulator.
Subtract data in register H from Accumulator along with borrow. Check for carry.
If carry is present take 2s complement of Accumulator.
Store the difference value and borrow in the memory location.
Terminate the program.
8/10/2019 Basics of Electrical Measurement
76/98
ProgramLoop Memory Instructions Opcode Comment
4400 LHLD 4600 2A
Load 1st number's address to HL pair4401 OO
4402 46
4403 XCHG EB Exchange between HL and DE pair
4404 LHLD 4602 2A
Load address of 2nd number to HL pair4405 O2
4406 46
4407 MVI C, 00 OEInitialize C as 0
4408 OO
4409 MOV A, E 7B Copy contents of E to accumulator
440A MOV B, L 45 Copy content of register L to B
440B SUB B 90 Subtract B from Accumulator440C JNC LOOP D2
Jump on no carry to label LOOP440D 11
440E 44
440F CMA 2F Compliment accumulator content
4410 INR A 3C Increment accumulator content by 1
8/10/2019 Basics of Electrical Measurement
77/98
Program
LOOP 4411 STA 4300 32Store accumulator content to 43004412 OO
4413 43
4414 MOV A,D 7A Copy content of D to accumulator
4415 SBB H 9C Subtract content of H from accumulator with borrow
4416 JNC LABEL D2
Jump on no carry to label LABEL4417 1C
4418 444419 INR C OC Increment C by 1
441A CMA 2F Compliment accumulator content
441B INR A 3C Increment accumulator content by 1
LABEL 441C STA 4301 32
Store accumulator content to 4301441D O1
441E 43
441F MOV A, C 79 Copy carry to accumulator
4420 STA 4302 32
Store the accumulator content to 43024421 O2
4422 43
4423 HLT 76 Program ends
8/10/2019 Basics of Electrical Measurement
78/98
8085 Instruction Set
We shall now see the 8085 instruction set
8/10/2019 Basics of Electrical Measurement
79/98
MOV
Copy from source to destination
MOV Rd, Rs
M, Rs
Rd, M
This instruction copies the contents of the sourceregister into the destination register
The contents of the source register are notaltered
If one of the operands is a memory location, itslocation is specified by contents of the HL
registers.
8/10/2019 Basics of Electrical Measurement
80/98
MVI
Move immediate 8-bit
MVI Rd, data
M, data
The 8-bit data is stored in the destination register
or
M, data memory If the operand is a memory location, its location is
specified by the contents of the HL registers
Example: MVI B, 57H or MVI M, 57H
8/10/2019 Basics of Electrical Measurement
81/98
LDA
Load accumulator
LDA 16-bit address
Contents of a memory location, specified by a 16-
bit address in the operand, are copied to the
accumulator
The contents of the source are not altered Example: LDA 2034H
8/10/2019 Basics of Electrical Measurement
82/98
LDAX
Load accumulator indirect
LDAX B/D Reg. pair
The contents of the designated register pair point
to a memory location
This instruction copies the contents of that
memory
location into the accumulator The contents of either the register pair or the
memory location are not altered
Example: LDAX B
8/10/2019 Basics of Electrical Measurement
83/98
LXI
Load register pair immediate
LXI Reg. pair, 16-bit data
The instruction loads 16-bit data in the register
pair designated in the operand
Example: LXI H, 2034H or LXI H, XYZ
8/10/2019 Basics of Electrical Measurement
84/98
LHLD
Load H and L registers direct
LHLD 16-bit address
The instruction copies the contents of thememory location pointed out by the 16-bit
address into register L
It copies the contents of the next memory location
into register H
The contents of source memory locations are not
altered
Example: LHLD 2040H
8/10/2019 Basics of Electrical Measurement
85/98
STA
Store accumulator direct
STA 16-bit address
The contents of the accumulator are copied into
the memory location specified by the operand
This is a 3-byte instruction
The second byte specifies the low-order addressand the third byte specifies the high-order
address
Example: STA 4350H
8/10/2019 Basics of Electrical Measurement
86/98
STAX
Store accumulator indirect
STAX Reg. pair
Contents of accumulator are copied into memory
location specified by contents of operand
The contents of the accumulator are not altered
Example: STAX B
8/10/2019 Basics of Electrical Measurement
87/98
SHLD
Store H and L registers direct
SHLD 16-bit address
The contents of register L are stored into thememory location specified by the 16-bit address
in the operand
The contents of H register are stored into the next
memory location by incrementing the operand
The contents of registers HL are not altered
The second byte specifies the low-order address
and the third byte specifies the high-order
8/10/2019 Basics of Electrical Measurement
88/98
PUSH Push register pair onto stack
PUSH Reg. pair
The contents of the register pair designated in theoperand are copied onto the stack in the following
sequence
The stack pointer register is decremented and the
contents of the high order register are copied into thatlocation
Stack pointer register is decremented again
The contents of the low-order register are copied to
that location
8/10/2019 Basics of Electrical Measurement
89/98
POP
Pop off stack to register pair
POP Reg. pair
Contents of the memory location pointed out by
the stack pointer are copied to the low-order of
operand
Stack pointer is incremented by 1 The contents of that memory location are copied
to the high-order register of the operand
The stack pointer register is again incremented
by 1
8/10/2019 Basics of Electrical Measurement
90/98
OUT
Output data from accumulator to a port with 8-bitaddress
OUT 8-bit port address
The contents of the accumulator are copied into
the I/O port specified by the operand
Example: OUT F8H
8/10/2019 Basics of Electrical Measurement
91/98
IN
Input data to accumulator from a port with 8-bitaddress
IN 8-bit port address
The contents of the input port designated in the
operand are read and loaded into the
accumulator
Example: IN 8CH
8/10/2019 Basics of Electrical Measurement
92/98
ADD Add register or memory to accumulator
ADD R
M
The contents of the operand are M added to the
contents of the accumulator
The result is stored in the accumulator. If the operand
is a memory location Its location is specified by the contents of the HL
registers
All flags are modified to reflect the result of the
addition
8/10/2019 Basics of Electrical Measurement
93/98
ADC
Add register to accumulator with carry
ADC R
M
The contents of the operand and M the Carry flag are
added to the contents of the accumulator
The result is stored in the accumulator
If the operand is a memory location, its location is
specified by the contents of the HL registers
All flags are modified to reflect the result of the
addition.
8/10/2019 Basics of Electrical Measurement
94/98
SUB
Subtract register or memory from accumulator
SUB R
V
The contents of the operand (register or memory) are subtracted from the contents of theaccumulator
The result is stored in the accumulator
If the operand is a memory location, its location isspecified by the contents of the HL registers
All flags are modified to reflect the result of thesubtraction.
Example: SUB B or SUB M
8/10/2019 Basics of Electrical Measurement
95/98
SBB Subtract source and borrow from accumulator
SBB R
M
The contents of the operand the Borrow flag aresubtracted from the contents of the accumulator
The result is placed in the accumulator
If the operand is a memory location, its location isspecified by
the contents of the HL registers
All flags are modified to reflect the result of thesubtraction
Example: SBB B or SBB M
8/10/2019 Basics of Electrical Measurement
96/98
INR
Increment register or memory by 1
INR R
M
The contents of the designated register or
memory are incremented by 1
The result is stored in the same place If the operand is a memory location, its location is
specified by the contents of the HL registers
Example: INR B or INR M
8/10/2019 Basics of Electrical Measurement
97/98
INX
Increment register pair by 1
INX R
The contents of the designated register pair are
incremented by 1
The result is stored in the same place
Example: INX H
8/10/2019 Basics of Electrical Measurement
98/98
DCR
Decrement register or memory by 1
DCR R
M
The contents of the designated register or
memory are decremented by 1
The result is stored in the same place If the operand is a memory location, its location is
specified by the contents of the HL registers