Course Name Microprocessor Architecture B Sc Information Technology

Course Name: Microprocessor Architecture B. Sc. (Information Technology) Semester – II

MICROPROCESSOR 8085 • Reference Book: Ramesh S. Goankar, “Microprocessor Architecture, Programming and Applications with 8085”, 5 th. Edition, Prentice Hall. • Computer System Architecture- M. Morris Mano • Structured Computer Organization- Andrew C. Tanenbaum

Unit-I • Microprocessor, microcomputers, and Assembly Language: • Microprocessor, Microprocessor Instruction Set and Computer Languages, From Large Computers to Single-Chip Microcontrollers, Applications. • Microprocessor Architecture and Microcomputer System: • Microprocessor Architecture and its operation’s, Memory, I/O Devices, Microcomputer System, Logic Devices and Interfacing, Microprocessor-Based System Application. • 8085 Microprocessor Architecture and Memory Interface: • Introduction, 8085 Microprocessor unit, 8085 -Based Microcomputer, Memory Interfacing, Interfacing the 8155 Memory Segment, Illustrative Example: Designing Memory for the MCTS Project, Testing and Troubleshooting Memory Interfacing Circuit, 8085 -Based Single-Board microcomputer.

Details. . of Unit-I • Basic Concepts of Microprocessors. • Differences among I. Microcomputer II. Microprocessor III. Microcontroller • What about micro • Definition of the Microprocessor

Definition. . • The earliest microprocessor (the Intel 8088 and Motorola’s 6800) recognized 8 -bit words. • Later microprocessors (8086 and 68000) were designed with 16 -bit words. • Today, all processors manipulate at least 32 bits at a time and there exists microprocessors that can process 64, 80, 128 bits

A Microprocessor-based system • Internally, the microprocessor is made up of 3 main units. • The Arithmetic/Logic Unit (ALU) • The Control Unit. • An array of registers for holding data while it is being manipulated.

Architecture of Intel 8085 Microprocessor

Memory • Memory Map and Addresses. • The three cycle instruction execution model. To execute a program, the microprocessor “reads” each instruction from memory, “interprets” it, then “executes” it. (Fetches/Decode/Execute) • Machine Language. • The 8085 Machine Language • Assembly Language Defines a symbolic code for the instructions. “mnemonics”.

8085 Microprocessor Architecture • • • 8 -bit general purpose μp Capable of addressing 64 k of memory Has 40 pins Requires +5 v power supply Can operate with 3 MHz clock 8085 upward compatible

8085 Microprocessor. Architecture. . System Bus –wires connecting memory & I/O to microprocessor – Address Bus Unidirectional Identifying peripheral or memory location – Data Bus Bidirectional Transferring data – Control Bus Synchronization signals Timing signals Control signal

Intel 8085 Microprocessor. . Microprocessor consists of: • • • Control unit: Control microprocessor operations. ALU: performs data processing function. Registers: provide storage internal to CPU. Interrupts Internal data bus

The Internal Architecture • The Program Counter (PC): -Control the sequencing of the execution of instructions. • The Stack pointer: -The stack pointer is also a 16 -bit register that is used to point into memory. -LIFO

Unit-II Introduction to 8085 Assembly Language Programming: – The 8085 Programming Model – Instruction Classification – Instruction – Data and Storage – Writing assembling and Execution of a simple program – Overview of 8085 Instruction Set – Writing and Assembling Program

Instruction and Data Formats Each instruction has two parts. – The first part is the task or operation to be performed. This part is called the “opcode” (operation code). – The second part is the data to be operated on Called the “operand”.

The 8085 Instructions • Data Transfer Operations (MOV, MVI, LDA, and STA) • Arithmetic Operations (ADD, ADI, SUB, SUI) Arithmetic Operations Related to Memory • Logic Operations: (ANA, ANI, ORA, ORI, XRA and XRI, Complement, Rotate, Compare)

The 8085 Instructions… • MOV M B: Copy the data from register B into a memory location. • LDAX Rp (Loa. D Accumulator e. Xtended) • LXI Rp, <16 -bit address>(Load e. Xtended Immediate) • The instruction LXI B 4000 Hwill place the 16 -bit number 4000 into the register pair B, C.

The 8085 Instructions… Operation: Load an 8 -bit number into the accumulator. MVI A, 32 -Operation: MVI A – Operand: The number 32 – Binary Code: • 0011 11103 E 1 st byte. • 0011 001032 2 nd byte.

The 8085 Instructions. . • Branch Operations: – Two types: Unconditional branch. Go to a new location no matter what. (JMP, CALL, RET) – Conditional branch. Go to a new location if the condition is true. (JZ, JNZ, JC, JNC, JP, JM)

The 8085 Instructions. . • Machine Control Operations HLT--Stop executing the program. NOP--No operation

Unit - III • Programming Techniques With Additional Instructions: – Programming Techniques: • Looping, Counting and Indexing – Additional Data Transfer and 16 -Bit Arithmetic Instructions – Arithmetic Instruction Related to Memory – Logic Operations: • Rotate • Compare • Dynamic Debugging

Unit - III • Counters and Time Delays: – Counters and Time Delays – Generating Pulse Waveforms – Debugging Counter and Time-Delay Programs

Counters & Time Delays • A loop counter is set up by loading a register with a certain value. • using the DCR (to decrement) and INR (to increment) the contents of the register are updated. • Sample ALP for implementing a loop using INR or DCR • Sample program Using a Register Pair as a Loop Counter

Delays • Sample program can use a loop to produce a certain amount of time delay in a program. • Nested loops can be easily setup in Assembly language by using two registers for the two loop counters. • Nested Loops for Delay. • Delay Calculation of Nested Loops – inner loop, outer loop – Increasing the delay

Timing Diagram Following Buses and Control Signals must be shown in a Timing Diagram: • Higher Order Address Bus. • Lower Address/Data bus • ALE • RD • WR • IO/M

Timing Diagram. . continued • Op-Code Fetch Cycle • Memory Read Cycle • Memory Write Cycle

Stack and Subroutines • 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. • The programmer defines the bottom of the stack and the stack grows up into reducing address range.

Stack and Subroutines. . • In the 8085, the stack is defined by setting the SP (Stack Pointer) register. LXI SP, FFFFH • Saving Information on the Stack • The 8085 provides two instructions: PUSH and POP for storing information on the stack and retrieving it back. • Operation of the Stack

Stack and Subroutines. . • During pushing, the stack operates in a “decrement then store” style. • During poping, the stack operates in a “use then increment” style. • The SP pointer always points to “the top of the stack”. • The PSW Register Pair

Subroutines • A subroutine is a group of instructions that will be used repeatedly indifferent locations of the program. • The 8085 has two instructions for dealing with subroutines. • The CALL instruction is used to redirect program execution to the subroutine. • The RTE insutruction is used to return the execution to the calling routine.

Subroutines. . • Passing Data to a Subroutine. • Call by Reference and Call by Value. • Conditional CALL and RTE Instructions. CC, call subroutine if Carry flag is set. CNC, call subroutine if Carry flag is not set RC, return from subroutine if Carry flag is set RNC, return from subroutine if Carry flag is not set

Interrupts • Interrupt is a process where an external device can get the attention of the microprocessor. -The process starts from the I/O device –The process is asynchronous. • Interrupts can be classified into two types: Maskable(can be delayed) Non-Maskable(can not be delayed)

Interrupts. . • The 8085 has 5 interrupt inputs. • Interrupt name Maskable Vectored INTR Yes No RST 5. 5 Yes RST 6. 5 Yes RST 7. 5 Yes TRAP No Yes • Interrupt Vectors and the Vector Table

Interrupts. . The Priority Encoder Multiple Interrupts & Priorities The 8085 Maskable/Vectored Interrupts. The 8085 Maskable/Vectored Interrupt Process. • Manipulating the Masks • •

Practicals. . • • • 1. Perform the following Operations related to memory locations. a. Store the data byte 32 H into memory location 4000 H. b. Exchange the contents of memory locations 2000 H and 4000 H 2. Simple assembly language programs. a. Subtract the contents of memory location 4001 H from the memory location 2000 H and place the result in memory location 4002 H. b. Subtract two 8 -bit numbers. c. Add the 16 -bit number in memory locations 4000 H and 4001 H to the 16 -bit number in memory locations 4002 H and 4003 H. The most significant eight bits of the two numbers to be added are in memory locations 4001 H and 4003 H. Store the result in memory locations 4004 H and 4005 H with the most significant byte in memory location 4005 H. d. Add the contents of memory locations 40001 H and 4001 H and place the result in the memory locations 4002 Hand 4003 H. e. Subtract the 16 -bit number in memory locations 4002 H and 4003 H from the 16 -bit number in memory locations 4000 H and 4001 H. The most significant eight bits of the two numbers are in memory locations 4001 H and 4003 H. Store the result in memory locations 4004 H and 4005 H with the most significant byte in memory location 4005 H. f. Find the l's complement of the number stored at memory location 4400 H and store the complemented number at memory location 4300 H.

Practicals. . • 3. Packing and unpacking operations. • a. Pack the two unpacked BCD numbers stored in memory locations 4200 H and 4201 H and store result in memory location 4300 H. Assume the least significant digit is stored at 4200 H. • b. Two digit BCD number is stored in memory location 4200 H. Unpack the BCD number and store the two digits in memory locations 4300 H and 4301 H such that memory location 4300 H will have lower BCD digit.

Practicals. . • 4. Register Operations. • a. Write a program to shift an eight bit data four bits right. Assume that data is in register C. • b. Program to shift a 16 -bit data 1 bit left. Assume data is in the HL register pair • c. Write a set of instructions to alter the contents of flag register in 8085. • d. Write a program to count number of l's in the contents of D register and store the count in the B register.

Practicals. . • 5. Multiple memory locations. • a. Calculate the sum of series of numbers. The length of the series is in memory location 4200 H and the series begins from memory location 4201 H. a. Consider the sum to be 8 bit number. So, ignore carries. Store the sum at memory location 4300 H. b. Consider the sum to be 16 bit number. Store the sum at memory locations 4300 H and 4301 H • b. Multiply two 8 -bit numbers stored in memory locations 2200 H and 2201 H by repetitive addition and store the result in memory locations 2300 H and 2301 H. • c. Divide 16 bit number stored in memory locations 2200 H and 2201 H by the 8 bit number stored at memory location 2202 H. Store the quotient in memory locations 2300 H and 2301 H and remainder in memory locations 2302 H and 2303 H.

Practicals. . • d. Find the number of negative elements (most significant bit 1) in a block of data. The length of the block is in memory location 2200 H and the block itself begins in memory location 2201 H. Store the number of negative elements in memory location 2300 H • e. Find the largest number in a block of data. The length of the block is in memory location 2200 H and the block itself starts from memory location 2201 H. Store the maximum number in memory location 2300 H. Assume that the numbers in the block are all 8 bit unsigned binary numbers.

Practicals. . • 6. Calculations with respect to memory locations. • a. Write a program to sort given 10 numbers from memory location 2200 H in the ascending order. • b. Calculate the sum of series of even numbers from the list of numbers. The length of the list is in memory location 2200 H and the series itself begins from memory location 2201 H. Assume the sum to be 8 bit number so you can ignore carries and store the sum at memory location 2 Sample problem: • c. Calculate the sum of series of odd numbers from the list of numbers. The length of the list is in memory location 2200 H and the series itself begins from memory location 2201 H. Assume the sum to be 16 -bit. Store the sum at memory locations 2300 H and 2301 H.

Practicals. . d. Find the square of the given numbers from memory location 6100 H and store the result from memory location 7000 H • e. Search the given byte in the list of 50 numbers stored in the consecutive memory locations and store the address of memory location in the memory locations 2200 H and 2201 H. Assume byte is in the C register and starting address of the list is 2000 H. If byte is not found store 00 at 2200 H and 2201 H • f. Two decimal numbers six digits each, are stored in BCD package form. Each number occupies a sequence of byte in the memory. The starting address of first number is 6000 H Write an assembly language program that adds these two numbers and stores the sum in the same format starting from memory location 6200 H • g. Add 2 arrays having ten 8 -bit numbers each and generate a third array of result. It is necessary to add the first element of array 1 with the first element of array-2 and so on. The starting addresses of array l, array 2 and array 3 are 2200 H, 2300 H and 2400 H, respectively

Practicals. . 7. Assembly programs on memory locations. a. Write an assembly language program to separate even numbers from the given list of 50 numbers and store them in the another list starting from 2300 H. Assume starting address of 50 number list is 2200 H. b. A list of 50 numbers is stored in memory, starting at 6000 H. Find number of negative, zero and positive numbers from this list and store these results in memory locations 7000 H, 7001 H, and 7002 H respectively b. Program to calculate the factorial of a number between 0 to 8.

Practicals. . 8. String operations in assembly programs. • Multiply the 8 -bit unsigned number in memory location 2200 H by the 8 -bit unsigned number in memory location 2201 H. Store the 8 least significant bits of the result in memory location 2300 H and the 8 most significant bits in memory location 2301 H. • Divide the 16 -bit unsigned number in memory locations 2200 H and 2201 H (most significant bits in 2201 H) by the B-bit unsigned number in memory location 2300 H store the quotient in memory location 2400 H and remainder in 2401 H • • DAA instruction is not present. Write a sub routine which will perform the same task as DAA. •

Practicals. . • Calculations on memory locations. • Arrange an array of 8 bit unsigned no in descending order • Transfer ten bytes of data from one memory to another memory block. Source memory block starts from memory location 2200 H where as destination memory block starts from memory location 2300 H • Write a simple program to Split a HEX data into two nibbles and store it in memory

Practicals. . • 10. Operations on BCD numbers. • a. Add two 4 digit BCD numbers in HL and DE register pairs and store result in memory locations, 2300 H and 2301 H. Ignore carry after 16 bit. • b. Subtract the BCD number stored in E register from the number stored in the D register • c. Write an assembly language program to multiply 2 BCD numbers

Thank you
- Slides: 45