8085 Architecture & Its Assembly language programming

Slides:



Advertisements
Similar presentations
Intel 8086.
Advertisements

8085 Architecture & Its Assembly language programming
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Introduction to 8086 Microprocessor
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Lecture 6 Machine Code: How the CPU is programmed.
TK 2633 Microprocessor & Interfacing
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Room: Timbalan Pengarah Pusat Komputer Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 4: Introduction.
TK 2633 Microprocessor & Interfacing
8051 ASSEMBLY LANGUAGE PROGRAMMING
The 8086 Microprocessor The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation 8086 is 16-bit MPU. Externally.
Floyd Digital Fundamentals, 9/e Copyright ©2006 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. Slide 1 Digital Fundamentals.
An Introduction to 8086 Microprocessor.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Types of Registers (8086 Microprocessor Based)
Strings, Procedures and Macros
Computer Architecture Lecture 13 – part 1 by Engineer A. Lecturer Aymen Hasan AlAwady 31/3/2014 University of Kufa - Information Technology Research and.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Microprocessor Microprocessor (cont..) It is a 16 bit μp has a 20 bit address bus can access upto 220 memory locations ( 1 MB). It can support.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
Block diagram of 8086.
Intel 8086 (8088) Microprocessor Structure
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Internal Programming Architecture or Model
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Seminar On 8085 microprocessor
Gursharan Singh Tatla INSTRUCTION SET OF 8085 Gursharan Singh Tatla Gursharan Singh Tatla
PROGRAMMING OF 8085 PROCESSOR
Instruction set Architecture
Format of Assembly language
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
UNIT Architecture M.Brindha AP/EIE
Detailed Review of the 8085 Instruction Set.
Introduction to 8086 Microprocessor
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Intel 8088 (8086) Microprocessor Structure
Symbolic Instruction and Addressing
EMT 245: lecture 4: assembly language
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
Detailed Review of the 8085 Instruction Set.
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Symbolic Instruction and Addressing
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
Lecture 06 Programming language.
Computer Architecture CST 250
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
CSC 497/583 Advanced Topics in Computer Security
Intel 8086.
Chapter 8: Instruction Set 8086 CPU Architecture
Computer Operation 6/22/2019.
Assignment 1) Explain how lower address bus is multiplexed with data bus? 2) Explain the function of all the control signals in the 8085 Control Logic.
8086 microprocessior PIN OUT DIAGRAM OF  Power supply and frequency signals  It uses 5V DC supply at V CC pin 40, and uses ground at V SS pin.
Presentation transcript:

8085 Architecture & Its Assembly language programming Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati

Outline 8085 Sample program of 8085 Counter & Time Delay 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

8085 Microprocessor 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 R ACC Timing and Control ALU Add Buff Data/Add Buff Flag INTR INTA RST5.5 ReSeT6.5 RST7.5 TRAP SID SOD 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 F R F F R R F F R S R R W W 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 R F F F R R F R R

Traffic Light Control: Counter & Delay Turn Signal to Red LOOP: MVI A 01H OUT 01H LD B DELAY_RED CALL DELAY Load DelayRed Time Delay Turn Signal to Yellow MVI A 02H OUT 01H LD B DELAY_YELLOW CALL DELAY Load DelayYellow Time Delay MVI A 03H OUT 01H LD B DELAY_GREEN CALL DELAY Turn Signal to Green Load DelayGreen Time 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 The Stack grows backwards into memory Bottom of the Stack

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 SP FFFF FFFE FFFD FFFC FFFB 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.

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 SP FFFF FFFE FFFD FFFC FFFB 2 0 0 3 03 20 2000 CALL 5000 2003

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 Sequencer Bus Interface Unit Execution Unit C BUS SUM Q6 Q5 Q4 Q3 Q2 Q1 CS (Code Seg Reg) DS (Data Seg Reg ) ES (Extra Seg Reg ) SS (Stack Seg Reg) IP (Intr Ptr) Operand InDirect Sequencer Execution Unit A BUS AH AL BH BL CH CL DH DL SI (Source Idx ) DI (Dest. Idx) BP (Base Ptr ) SP (Stack Ptr) Temp A Temp B Temp C ALU Z (Flag Reg)

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) Z (Flag Reg) CS (Code Seg Reg) DS (Data Seg Reg ) ES (Extra Seg Reg ) SS (Stack Seg Reg) IP (Intr Ptr)

8086 Architecture Execution Unit : Bus Interface 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