SlideShare a Scribd company logo
8085 Architecture &
Its Assembly language programming
Dr A Sahu
Dept of Computer Science &
Engineering
IIT Guwahati
Outline
• 8085
– Block diagram (Data Path)
– Instruction Set of 8085
• Sample program of 8085
• Counter & Time Delay
• Stack and Sub Routine
• Assignment on 8085
• Introduction to 8086 and 30x86 architecture
W Z
B C
D E
H L
SP
PC
Inc/Dec. ter
Add latch
MUX
Bus 8 Bit
Interrupt Control Serial I/O Control
IR
I Decode
&
M/C
Encoding
tmp RACC
Timing and Control
ALU
Add Buff Data/Add Buff
Flag
INTR INTA RST5.5
ReSeT6.5
RST7.5 TRAP SID SOD
8085 Microprocessor Architecture
8085
MPU
A15
A0
D0
D7
Address Bus (16bit)
Memory I/P
Data Bus (8bit)
O/P
Control Bus (8bit)
Assumption
• RAM Memory is interfaced
• Instructions are stored in memory
• One I/O display port is interfaced to display
data of ACC
Simple Assembly Program
MVI A, 24H // load Reg ACC with 24H
MVI B , 56H // load Reg B with 56H
ADD B // ACC= ACC+B
OUT 01H // Display ACC contents on port 01H
HALT // End the program
Result: 7A (All are in Hex)
DAA operation for Decimal Adjust A+6=10H
Flowchart to multiply two number
Start
LDA 2000 // Load multiplicant to accumulator
MOV B,A // Move multiplicant from A(acc) to B register
LDA 2001 // Load multiplier to accumulator
MOV C,A // Move multiplier from A to C
MOV C,A // Move multiplier from A to C
MVI A,00 // Load immediate value 00 to ACC
ADD B // Add B(multiplier) with A
DCR C // Decrement C, it act as a counter
JNZ L // Jump to L if C!=0
STA 2010 // Store result in to memory
HLT // End
Code to multiply two number
LDA 2000 // Load multiplicant to accumulator
MOV B,A // Move multiplicant from A(acc) to B register
LDA 2001 // Load multiplier to accumulator
MOV C,A // Move multiplier from A to C
MVI A,00 // Load immediate value 00 to a
L: ADD B // Add B(multiplier) with A
DCR C // Decrement C, it act as a counter
JNZ L // Jump to L if C reaches 0
STA 2010 // Store result in to memory
HLT // End
Delay of Instructions
• Performance/delay of each instruction
MVI C, FFH 7 T-State
LOOP: DCR C 4 T-State
JNZ LOOP 7/10 T-State
• Performance of other INS
ADD R 4 T-State
ADD M 7 T-State
CALL addr 18 T-State
• F=Fetch with 4 State, S=Fetch with 6 State,
R=Memory Read, W=Memory Write
F R
F
F R R
F
F R
S R R W W
Time Delay Loop
• Performance/delay of each instruction
MVI C, FFH 7 T-State
LOOP: DCR C 4 T-State
JNZ LOOP 7/10 T-State
• Time delay in loop
TL= T x Loop T-States x N10
where T=System clock period
N10= Equiv. decimal value of count loaded to C
TL= 0.5x10-6 x (14 x 255)=1.8ms (ignore 10 T-State)
F R
F
F R R
Time Delay: Nested Loop
• Performance/delay of each instruction
MVI C, FFH 7 T-State
MVI D, FFH 7 T-State
LOOP1: DCR C 4 T-State
LOOP2: DCR D 4 T-State
JNZ LOOP2 7/10 T-State
JNZ LOOP1 7/10 T-State
• Time delay in Nested loop
TNL= N110 x T x ( L1_TStates+ L2_TStates x N210 )
F R
F
F R R
F R
F R R
F
Traffic Light Control: Counter & Delay
LOOP: MVI A 01H
OUT 01H
LD B DELAY_RED
CALL DELAY
Load DelayRed
Time Delay
Turn Signal to Red
Load DelayYellow
Time Delay
Turn Signal to Yellow
Load DelayGreen
Time Delay
Turn Signal to Green
MVI A 02H
OUT 01H
LD B DELAY_YELLOW
CALL DELAY
MVI A 03H
OUT 01H
LD B DELAY_GREEN
CALL DELAY
JMP LOOP
Stack Pointer (SP) & Stack Memory
• The stack is an area of memory identified by
the programmer for temporary storage of
information.
• The stack is a LIFO structure.
• The stack normally grows backwards into
memory.
– Programmer can defines the
bottom of the stack (SP)
and the stack grows up into
reducing address range.
Memory
Bottom
of the
Stack
The Stack
grows
backwards
into memory
Stack Memory
• Grows backwards into memory
• Better to place the bottom of the stack at the
end of memory
• To keep it as far away from user programs as
possible.
• Stack is defined by setting the SP (Stack
Pointer) register.
LXI SP, FFFFH
• This sets SP to location FFFFH (end of memory
for 8085).
Saving Information on the Stack
• Save information by PUSHing onto STACK
• Retrieved from STACK by POPing it off.
• PUSH and POP work with register pairs only.
• Example “PUSH B”
– Decrement SP, Copy B to 0(SP)
– Decrement SP, Copy C tp 0(SP)
• Example “POP B”
– Copy 0(SP) to C, Increment SP
– Copy 0(SP) to B, Increment SP
B C
SPFFFF
FFFE
FFFD
FFFC
FFFB
F312
F3
12
Stack/LIFO use in CALL/RET
• Retrieve information back into its original
location
– The order of PUSHs and POPs must be opposite
• 8085 recognizes one additional register pair
– PSW (Prog Status word) = ACC and Flag
Before any routine CALL do this
PUSH B
PUSH D
PUSH PSW
After RETURN from call do this
POP PSW
POP D
POP B
Subroutines
• A subroutine is a group of instructions
– That is used repeatedly in different places of the
program.
– Rather than repeat the same instructions several
times
– It can be grouped into a subroutine and call from the
different locations.
• Instructions for dealing with subroutines.
– The CALL instruction is used to redirect program
execution to the subroutine.
– The RET instruction is used to return the execution to
the calling routine.
17
CALL/RET Instruction
• You must set the SP correctly before using CALL
• CALL 5000H
– Push the PC value onto the stack
– Load PC with 16-bit address supplied CALL ins.
• RET : Load PC with stack top; POP PC
PC
SPFFFF
FFFE
FFFD
FFFC
FFFB
2 0 0 3
03
20
2000 CALL 5000
2003
18
Call by References
• If SR performs operations on the contents of
the registers
• These modifications will be transferred back
to the calling program upon returning from a
subroutine.
• If this is not desired, the SR should PUSH
registers and POP on return.
Stack/LIFO use in CALL/RET
• Retrieve information back into its original
location
– The order of PUSHs and POPs must be opposite
• 8085 recognizes one additional register pair
– PSW (Prog Status word) = ACC and Flag
Before any routine CALL do this
PUSH B
PUSH D
PUSH PSW
After RETURN from call do this
POP PWD
POP D
POP B
Factorial of a number
LXI SP, 27FFH // Initialize stack pointer
LDA 2200H // Get the number
CPI 02H // Check if number is greater than 1
JC LAST
MVI D, 00H // Load number as a result
MOV E, A
DCR A
MOV C,A // Load counter one less than number
CALL FACTO // Call subroutine FACTO
XCHG // Get the result in HL // HL with DE
SHLD 2201H // Store result // store HL at 0(16bit)
JMP END
LAST: LXI H, 000lH // Store result = 01
END: SHLD 2201H
HLT
Sub Routine for FACTORIAL
FACTO:LXI H, 0000H
MOV B, C // Load counter
BACK: DAD D // double add ; HL=HL+DE
DCR B
JNZ BACK //Multiply by successive addition
XCHG // Store result in DE // HL with DE
DCR C // Decrement counter
CNZ FACTO // Call subroutine FACTO
RET // Return to main program
Assignment I
• Write and execute 8085 assembly language
program to find value of Nth Fibonacci number
(Recursive version: using recursive subroutine
call)
• 16 bit can support up to 65356 > F24
• Deadline: 12th Aug 2010, 11.55Mid night
• After deadline grading: Max 5 out of 10
• Send TXT version of program with file name
RollNo.txt to asahu@iitg.ernet.in with
Assignment one as subject of email
• Don’t submit copied one: will get Negative marks
Introduction to
8086 & i386 processor
• 16 bit Microprocessor
• All internal registers as well as internal and
external data buses were 16 bits wide
• 4 Main Register, 4 Index Register, 4 Segment
Register, Status Reg, Instr Ptr.
• Not compatible with 8085, but with successors
• Two Unit works in parallel:
– Bus Interface Unit (BIU)
– Execution Unit (EI)
8086 Architecture
AH AL
BH BL
CH CL
DH DL
SI (Source Idx )
DI (Dest. Idx)
BP (Base Ptr )
SP (Stack Ptr)
Z (Flag Reg)
CS (Code Seg Reg)
DS (Data Seg Reg )
ES (Extra Seg Reg )
SS (Stack Seg Reg)
IP (Intr Ptr)
Operand
InDirect
Temp A
Temp B
Temp C
Q6
Q5
Q4
Q3
Q2
Q1
Sequencer
Bus Interface
Unit
Execution
Unit
SUM
C BUS
A BUS
ALU
8086 Registers
• AX - the accumulator register (divided into AH / AL)
• BX - the base address register (divided into BH / BL)
• CX - the count register (divided into CH / CL)
• DX - the data register (divided into DH / DL)
• SI - source index register.
• DI - destination index register.
• BP - base pointer.
• SP - stack pointer.
AH AL
BH BL
CH CL
DH DL
SI (Source Idx )
DI (Dest. Idx)
BP (Base Ptr )
SP (Stack Ptr)
CS (Code Seg Reg)
DS (Data Seg Reg )
ES (Extra Seg Reg )
SS (Stack Seg Reg)
IP (Intr Ptr)
Z (Flag Reg)
8086 Architecture
• Execution Unit :
– ALU may be loaded from three temp registers (TMPA, TMPB,
TMPC)
– Execute operations on bytes or 16-bit words.
– The result stored into temp reg or registers connected to the
internal data bus.
• Bus Interface Unit
– BIU is intended to compute the addresses.
– Two temporary registers
– indirect addressing
– four segment registers (DS, CS, SS and ES),
– Program counter (IP - Instruction Pointer),
– A 6-byte Queue Buffer to store the pre-fetched opcodes and data.
– This Prefetch Queue optimize the bus usage.
– To execute a jump instruction the queue has to be flushed since the
pre-fetched instructions do not have to be executed.
Next Class Agenda
• Detail of 8086 Architecture
• Advanced 32 bit architecture (i386, Pentium, p4)
– I know a little bit of this
– My expertise area of work
• Programming model for x86 architecture
• 8086 Assembly language programming
• MASM / TASM /NASM (x86 assembler)
• If you miss the next class, will miss a lot
Thanks

More Related Content

What's hot

8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
Ravi Anand
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor labkpaulraj
 
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp011347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01bvenkanna
 
8085 instruction set
8085 instruction set8085 instruction set
Assembly language i
Assembly language iAssembly language i
Assembly language i
Vivek Kumar
 
Microprocessorlabmanual ee0310
Microprocessorlabmanual ee0310Microprocessorlabmanual ee0310
Microprocessorlabmanual ee0310
DHEERAJ DHAKAR
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delay
Hemant Chetwani
 
8085 alp programs
8085 alp programs8085 alp programs
Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)
Manoj Shahu
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
Poojith Chowdhary
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
cmkandemir
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly languagehemant meena
 
Programming with 8085
Programming with 8085Programming with 8085
Programming with 8085
Shehrevar Davierwala
 
Logical instruction of 8085
Logical instruction of 8085Logical instruction of 8085
Logical instruction of 8085
vishalgohel12195
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!
PRABHAHARAN429
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085saleForce
 
The 8051 microcontroller
The 8051  microcontroller The 8051  microcontroller
The 8051 microcontroller
Avinash Mishra
 

What's hot (18)

8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor lab
 
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp011347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Assembly language i
Assembly language iAssembly language i
Assembly language i
 
Microprocessorlabmanual ee0310
Microprocessorlabmanual ee0310Microprocessorlabmanual ee0310
Microprocessorlabmanual ee0310
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delay
 
8086 assembly
8086 assembly8086 assembly
8086 assembly
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)
 
8085 micro processor
8085 micro processor8085 micro processor
8085 micro processor
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
 
The 8051 assembly language
The 8051 assembly languageThe 8051 assembly language
The 8051 assembly language
 
Programming with 8085
Programming with 8085Programming with 8085
Programming with 8085
 
Logical instruction of 8085
Logical instruction of 8085Logical instruction of 8085
Logical instruction of 8085
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085
 
The 8051 microcontroller
The 8051  microcontroller The 8051  microcontroller
The 8051 microcontroller
 

Similar to Lec04

Lec03
Lec03Lec03
8085 microprocessor(1)
8085 microprocessor(1)8085 microprocessor(1)
8085 microprocessor(1)Reevu Pal
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture II
Dr.YNM
 
Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02Swati Watve-Phadke
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
Prof. Dr. K. Adisesha
 
Malp edusat
Malp edusatMalp edusat
Malp edusat
karthikrelax
 
8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf
Koteswari Kasireddy
 
8085 Architecture
8085 Architecture8085 Architecture
8085 Architecture
Kumar Anand Singh
 
Introduction to 8085 by adi ppt
Introduction to 8085 by adi pptIntroduction to 8085 by adi ppt
Introduction to 8085 by adi ppt
Prof. Dr. K. Adisesha
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085 vijaydeepakg
 
UNIT II MICROPROCESSOR AND MICROCONTROLLER
UNIT II MICROPROCESSOR AND MICROCONTROLLER UNIT II MICROPROCESSOR AND MICROCONTROLLER
UNIT II MICROPROCESSOR AND MICROCONTROLLER
ravis205084
 
MICROPROCESSORS AND MICROCONTROLLERS
MICROPROCESSORS AND MICROCONTROLLERSMICROPROCESSORS AND MICROCONTROLLERS
MICROPROCESSORS AND MICROCONTROLLERS
selvakumar948
 
8085-paper-presentation.ppt
8085-paper-presentation.ppt8085-paper-presentation.ppt
8085-paper-presentation.ppt
KalaiSelvan911913
 
8155 GPPI
8155 GPPI8155 GPPI
8155 GPPI
deval patel
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
HarshitParkar6677
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
HarshitParkar6677
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollers
gomathy S
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
Jathin Kanumuri
 

Similar to Lec04 (20)

Lec03
Lec03Lec03
Lec03
 
8085 microprocessor(1)
8085 microprocessor(1)8085 microprocessor(1)
8085 microprocessor(1)
 
Microprocessor architecture II
Microprocessor architecture   IIMicroprocessor architecture   II
Microprocessor architecture II
 
Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Topic 1
Topic 1Topic 1
Topic 1
 
Malp edusat
Malp edusatMalp edusat
Malp edusat
 
8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf
 
8085 Architecture
8085 Architecture8085 Architecture
8085 Architecture
 
Introduction to 8085 by adi ppt
Introduction to 8085 by adi pptIntroduction to 8085 by adi ppt
Introduction to 8085 by adi ppt
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
 
UNIT II MICROPROCESSOR AND MICROCONTROLLER
UNIT II MICROPROCESSOR AND MICROCONTROLLER UNIT II MICROPROCESSOR AND MICROCONTROLLER
UNIT II MICROPROCESSOR AND MICROCONTROLLER
 
MICROPROCESSORS AND MICROCONTROLLERS
MICROPROCESSORS AND MICROCONTROLLERSMICROPROCESSORS AND MICROCONTROLLERS
MICROPROCESSORS AND MICROCONTROLLERS
 
8085-paper-presentation.ppt
8085-paper-presentation.ppt8085-paper-presentation.ppt
8085-paper-presentation.ppt
 
8155 GPPI
8155 GPPI8155 GPPI
8155 GPPI
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollers
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 

More from siddu kadiwal

Chp10 sw constr
Chp10 sw constrChp10 sw constr
Chp10 sw constr
siddu kadiwal
 
Lec14
Lec14Lec14
Lec13
Lec13Lec13
Lec11
Lec11Lec11
Lec12
Lec12Lec12
Lec10
Lec10Lec10
Lec09
Lec09Lec09
Lec08
Lec08Lec08
Lec07
Lec07Lec07
Lec06
Lec06Lec06
Lec05
Lec05Lec05
Lec02
Lec02Lec02
Lec04
Lec04Lec04
Ece iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notesEce iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notes
siddu kadiwal
 

More from siddu kadiwal (14)

Chp10 sw constr
Chp10 sw constrChp10 sw constr
Chp10 sw constr
 
Lec14
Lec14Lec14
Lec14
 
Lec13
Lec13Lec13
Lec13
 
Lec11
Lec11Lec11
Lec11
 
Lec12
Lec12Lec12
Lec12
 
Lec10
Lec10Lec10
Lec10
 
Lec09
Lec09Lec09
Lec09
 
Lec08
Lec08Lec08
Lec08
 
Lec07
Lec07Lec07
Lec07
 
Lec06
Lec06Lec06
Lec06
 
Lec05
Lec05Lec05
Lec05
 
Lec02
Lec02Lec02
Lec02
 
Lec04
Lec04Lec04
Lec04
 
Ece iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notesEce iv-fundamentals of hdl [10 ec45]-notes
Ece iv-fundamentals of hdl [10 ec45]-notes
 

Recently uploaded

一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
nikitacareer3
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 

Recently uploaded (20)

一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 

Lec04

  • 1. 8085 Architecture & Its Assembly language programming Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati
  • 2. Outline • 8085 – Block diagram (Data Path) – Instruction Set of 8085 • Sample program of 8085 • Counter & Time Delay • Stack and Sub Routine • Assignment on 8085 • Introduction to 8086 and 30x86 architecture
  • 3. W Z B C D E H L SP PC Inc/Dec. ter Add latch MUX Bus 8 Bit Interrupt Control Serial I/O Control IR I Decode & M/C Encoding tmp RACC Timing and Control ALU Add Buff Data/Add Buff Flag INTR INTA RST5.5 ReSeT6.5 RST7.5 TRAP SID SOD 8085 Microprocessor Architecture 8085 MPU A15 A0 D0 D7 Address Bus (16bit) Memory I/P Data Bus (8bit) O/P Control Bus (8bit)
  • 4. Assumption • RAM Memory is interfaced • Instructions are stored in memory • One I/O display port is interfaced to display data of ACC
  • 5. Simple Assembly Program MVI A, 24H // load Reg ACC with 24H MVI B , 56H // load Reg B with 56H ADD B // ACC= ACC+B OUT 01H // Display ACC contents on port 01H HALT // End the program Result: 7A (All are in Hex) DAA operation for Decimal Adjust A+6=10H
  • 6. Flowchart to multiply two number Start LDA 2000 // Load multiplicant to accumulator MOV B,A // Move multiplicant from A(acc) to B register LDA 2001 // Load multiplier to accumulator MOV C,A // Move multiplier from A to C MOV C,A // Move multiplier from A to C MVI A,00 // Load immediate value 00 to ACC ADD B // Add B(multiplier) with A DCR C // Decrement C, it act as a counter JNZ L // Jump to L if C!=0 STA 2010 // Store result in to memory HLT // End
  • 7. Code to multiply two number LDA 2000 // Load multiplicant to accumulator MOV B,A // Move multiplicant from A(acc) to B register LDA 2001 // Load multiplier to accumulator MOV C,A // Move multiplier from A to C MVI A,00 // Load immediate value 00 to a L: ADD B // Add B(multiplier) with A DCR C // Decrement C, it act as a counter JNZ L // Jump to L if C reaches 0 STA 2010 // Store result in to memory HLT // End
  • 8. Delay of Instructions • Performance/delay of each instruction MVI C, FFH 7 T-State LOOP: DCR C 4 T-State JNZ LOOP 7/10 T-State • Performance of other INS ADD R 4 T-State ADD M 7 T-State CALL addr 18 T-State • F=Fetch with 4 State, S=Fetch with 6 State, R=Memory Read, W=Memory Write F R F F R R F F R S R R W W
  • 9. Time Delay Loop • Performance/delay of each instruction MVI C, FFH 7 T-State LOOP: DCR C 4 T-State JNZ LOOP 7/10 T-State • Time delay in loop TL= T x Loop T-States x N10 where T=System clock period N10= Equiv. decimal value of count loaded to C TL= 0.5x10-6 x (14 x 255)=1.8ms (ignore 10 T-State) F R F F R R
  • 10. Time Delay: Nested Loop • Performance/delay of each instruction MVI C, FFH 7 T-State MVI D, FFH 7 T-State LOOP1: DCR C 4 T-State LOOP2: DCR D 4 T-State JNZ LOOP2 7/10 T-State JNZ LOOP1 7/10 T-State • Time delay in Nested loop TNL= N110 x T x ( L1_TStates+ L2_TStates x N210 ) F R F F R R F R F R R F
  • 11. Traffic Light Control: Counter & Delay LOOP: MVI A 01H OUT 01H LD B DELAY_RED CALL DELAY Load DelayRed Time Delay Turn Signal to Red Load DelayYellow Time Delay Turn Signal to Yellow Load DelayGreen Time Delay Turn Signal to Green MVI A 02H OUT 01H LD B DELAY_YELLOW CALL DELAY MVI A 03H OUT 01H LD B DELAY_GREEN CALL DELAY JMP LOOP
  • 12. Stack Pointer (SP) & Stack Memory • The stack is an area of memory identified by the programmer for temporary storage of information. • The stack is a LIFO structure. • The stack normally grows backwards into memory. – Programmer can defines the bottom of the stack (SP) and the stack grows up into reducing address range. Memory Bottom of the Stack The Stack grows backwards into memory
  • 13. Stack Memory • Grows backwards into memory • Better to place the bottom of the stack at the end of memory • To keep it as far away from user programs as possible. • Stack is defined by setting the SP (Stack Pointer) register. LXI SP, FFFFH • This sets SP to location FFFFH (end of memory for 8085).
  • 14. Saving Information on the Stack • Save information by PUSHing onto STACK • Retrieved from STACK by POPing it off. • PUSH and POP work with register pairs only. • Example “PUSH B” – Decrement SP, Copy B to 0(SP) – Decrement SP, Copy C tp 0(SP) • Example “POP B” – Copy 0(SP) to C, Increment SP – Copy 0(SP) to B, Increment SP B C SPFFFF FFFE FFFD FFFC FFFB F312 F3 12
  • 15. Stack/LIFO use in CALL/RET • Retrieve information back into its original location – The order of PUSHs and POPs must be opposite • 8085 recognizes one additional register pair – PSW (Prog Status word) = ACC and Flag Before any routine CALL do this PUSH B PUSH D PUSH PSW After RETURN from call do this POP PSW POP D POP B
  • 16. Subroutines • A subroutine is a group of instructions – That is used repeatedly in different places of the program. – Rather than repeat the same instructions several times – It can be grouped into a subroutine and call from the different locations. • Instructions for dealing with subroutines. – The CALL instruction is used to redirect program execution to the subroutine. – The RET instruction is used to return the execution to the calling routine.
  • 17. 17 CALL/RET Instruction • You must set the SP correctly before using CALL • CALL 5000H – Push the PC value onto the stack – Load PC with 16-bit address supplied CALL ins. • RET : Load PC with stack top; POP PC PC SPFFFF FFFE FFFD FFFC FFFB 2 0 0 3 03 20 2000 CALL 5000 2003
  • 18. 18 Call by References • If SR performs operations on the contents of the registers • These modifications will be transferred back to the calling program upon returning from a subroutine. • If this is not desired, the SR should PUSH registers and POP on return.
  • 19. Stack/LIFO use in CALL/RET • Retrieve information back into its original location – The order of PUSHs and POPs must be opposite • 8085 recognizes one additional register pair – PSW (Prog Status word) = ACC and Flag Before any routine CALL do this PUSH B PUSH D PUSH PSW After RETURN from call do this POP PWD POP D POP B
  • 20. Factorial of a number LXI SP, 27FFH // Initialize stack pointer LDA 2200H // Get the number CPI 02H // Check if number is greater than 1 JC LAST MVI D, 00H // Load number as a result MOV E, A DCR A MOV C,A // Load counter one less than number CALL FACTO // Call subroutine FACTO XCHG // Get the result in HL // HL with DE SHLD 2201H // Store result // store HL at 0(16bit) JMP END LAST: LXI H, 000lH // Store result = 01 END: SHLD 2201H HLT
  • 21. Sub Routine for FACTORIAL FACTO:LXI H, 0000H MOV B, C // Load counter BACK: DAD D // double add ; HL=HL+DE DCR B JNZ BACK //Multiply by successive addition XCHG // Store result in DE // HL with DE DCR C // Decrement counter CNZ FACTO // Call subroutine FACTO RET // Return to main program
  • 22. Assignment I • Write and execute 8085 assembly language program to find value of Nth Fibonacci number (Recursive version: using recursive subroutine call) • 16 bit can support up to 65356 > F24 • Deadline: 12th Aug 2010, 11.55Mid night • After deadline grading: Max 5 out of 10 • Send TXT version of program with file name RollNo.txt to asahu@iitg.ernet.in with Assignment one as subject of email • Don’t submit copied one: will get Negative marks
  • 23. Introduction to 8086 & i386 processor • 16 bit Microprocessor • All internal registers as well as internal and external data buses were 16 bits wide • 4 Main Register, 4 Index Register, 4 Segment Register, Status Reg, Instr Ptr. • Not compatible with 8085, but with successors • Two Unit works in parallel: – Bus Interface Unit (BIU) – Execution Unit (EI)
  • 24. 8086 Architecture AH AL BH BL CH CL DH DL SI (Source Idx ) DI (Dest. Idx) BP (Base Ptr ) SP (Stack Ptr) Z (Flag Reg) CS (Code Seg Reg) DS (Data Seg Reg ) ES (Extra Seg Reg ) SS (Stack Seg Reg) IP (Intr Ptr) Operand InDirect Temp A Temp B Temp C Q6 Q5 Q4 Q3 Q2 Q1 Sequencer Bus Interface Unit Execution Unit SUM C BUS A BUS ALU
  • 25. 8086 Registers • AX - the accumulator register (divided into AH / AL) • BX - the base address register (divided into BH / BL) • CX - the count register (divided into CH / CL) • DX - the data register (divided into DH / DL) • SI - source index register. • DI - destination index register. • BP - base pointer. • SP - stack pointer. AH AL BH BL CH CL DH DL SI (Source Idx ) DI (Dest. Idx) BP (Base Ptr ) SP (Stack Ptr) CS (Code Seg Reg) DS (Data Seg Reg ) ES (Extra Seg Reg ) SS (Stack Seg Reg) IP (Intr Ptr) Z (Flag Reg)
  • 26. 8086 Architecture • Execution Unit : – ALU may be loaded from three temp registers (TMPA, TMPB, TMPC) – Execute operations on bytes or 16-bit words. – The result stored into temp reg or registers connected to the internal data bus. • Bus Interface Unit – BIU is intended to compute the addresses. – Two temporary registers – indirect addressing – four segment registers (DS, CS, SS and ES), – Program counter (IP - Instruction Pointer), – A 6-byte Queue Buffer to store the pre-fetched opcodes and data. – This Prefetch Queue optimize the bus usage. – To execute a jump instruction the queue has to be flushed since the pre-fetched instructions do not have to be executed.
  • 27. Next Class Agenda • Detail of 8086 Architecture • Advanced 32 bit architecture (i386, Pentium, p4) – I know a little bit of this – My expertise area of work • Programming model for x86 architecture • 8086 Assembly language programming • MASM / TASM /NASM (x86 assembler) • If you miss the next class, will miss a lot