Ass. Prof. Dr Masri Ayob Lecture 5: Arithmetic and Logic Instructions TK 2633: Microprocessor & Interfacing.

Slides:



Advertisements
Similar presentations
Microprocessors and Interfacing
Advertisements

8085 Architecture & Its Assembly language programming
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
MOV Instruction MOV destination, source ; copy source to dest. MOV A,#55H ;load value 55H into reg. A MOV R0,A ;copy contents of A into R0 ;(now A=R0=55H)
8085 processor. Bus system in microprocessor.
The 8085 Microprocessor Architecture. Contents The 8085 and its Buses. The address and data bus ALU Flag Register Machine cycle Memory Interfacing The.
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
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.
TK2633: MICROPROCESSOR & INTERFACING
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 5: Arithmetic and Logic Instructions.
TK I/O Peripherals Interface DR MASRI AYOB.
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
INSTRUCTION SET OF MICROPROCESSOR 8085
UNDERSTANDING ASSEMBLY LANGUAGE.
The 8051 Microcontroller and Embedded Systems
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
TK2633 : MICROPROCESSOR & INTERFACING Lecture 10: Fixed Point Arithmetic Lecturer: Ass. Prof. Dr. Masri Ayob.
ASSEMBLY LANGUAGE.  Upon completing this topic, you should be able to: Classify the 8085A microprocessor instructions Explain the basic function of common.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 8.
Ass Prof Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 6: Control Instructions.
Arithmetic and Logic Instructions
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
III] Logical Group 1)ANA r : LOGICAL AND REGISTER WITH ACCUMULATOR Format : [A] [A] Λ [r] Addressing : Register addressing Group : Logical group Bytes.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
Microprocessor & Assembly Language Arithmetic and logical Instructions.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Microprocessor & Assembly Language
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني 8085 Instruction Set logic group. Branch group. Stack memory and machine control. Addressing modes.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني 8085 Instruction Set Instruction types. data transfer group. Arithmetic group.
8085 Microprocessor Architecture
Gursharan Singh Tatla INSTRUCTION SET OF 8085 Gursharan Singh Tatla Gursharan Singh Tatla
Unit 1 Instruction set M.Brindha AP/EIE
The 8085 Microprocessor Architecture
Classification of Instruction Set of 8051
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Detailed Review of the 8085 Instruction Set.
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Introduction to 8085 Instructions
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 2
Presented by: Chi Yan Hung
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 1
More on logical instruction and
Microcomputer Programming
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Additional data transfer and 16 bit arithmetic instruction Lecture 1
EMT 245: lecture 4: assembly language
Detailed Review of the 8085 Instruction Set.
Chapter 1 Introduction.
INSTRUCTION SET OF 8085.
TK2633: MICROPROCESSOR & INTERFACING
Unit – Microcontroller Tutorial Class - 2 ANITS College
The 8085 Microprocessor Architecture
Chapter 5 Arithmetic and Logic Instructions
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
Computer Operation 6/22/2019.
Presentation transcript:

Ass. Prof. Dr Masri Ayob Lecture 5: Arithmetic and Logic Instructions TK 2633: Microprocessor & Interfacing

OBJECTIVES Prepared by: Dr Masri Ayob - TK Explain the operation of the 8085 arithmetic and logic instructions and describe their effect on the flag bits. Explain the operation of the 8085 arithmetic and logic instructions and describe their effect on the flag bits. Describe how DAA adjusts the result of a BCD addition. Describe how DAA adjusts the result of a BCD addition. Write short programs using the arithmetic and logic operations. Write short programs using the arithmetic and logic operations. Use the logic instructions to clear, set, and complement bus. Use the logic instructions to clear, set, and complement bus. Test the accumulator, using the ANA A or ORA A instruction. Test the accumulator, using the ANA A or ORA A instruction. Explain the operation of the shift and rotate instructions and their effect on the flag bits. Explain the operation of the shift and rotate instructions and their effect on the flag bits.

ARITHMETIC OPERATIONS Prepared by: Dr Masri Ayob - TK Addition, subtraction, increment, and decrement.

ARITHMETIC OPERATIONS Prepared by: Dr Masri Ayob - TK2123 4

ARITHMETIC OPERATIONS Prepared by: Dr Masri Ayob - TK2123 5

ARITHMETIC OPERATIONS Prepared by: Dr Masri Ayob - TK2123 6

ARITHMETIC OPERATIONS Prepared by: Dr Masri Ayob - TK2123 7

ADDITION Prepared by: Dr Masri Ayob - TK Addition takes several forms in the 8085 microprocessor: Addition takes several forms in the 8085 microprocessor: 8-bit binary, 8-bit binary, 16-bit binary, 16-bit binary, and two-digit binary-coded-decimal (BCE)) addition. and two-digit binary-coded-decimal (BCE)) addition. Binary addition functions with either signed or unsigned numbers; Binary addition functions with either signed or unsigned numbers; BCD addition uses only unsigned numbers. BCD addition uses only unsigned numbers. The instruction set supports additions using register addressing, register indirect addressing, and immediate addressing, but not direct addressing. The instruction set supports additions using register addressing, register indirect addressing, and immediate addressing, but not direct addressing.

ADDITION Prepared by: Dr Masri Ayob - TK2123 9

ADDITION Prepared by: Dr Masri Ayob - TK

ADDITION Prepared by: Dr Masri Ayob - TK

Addition with Carry Prepared by: Dr Masri Ayob - TK Whenever large numbers (numbers wider than 8 bits, or multiple-byte numbers) are added, the carry must be propagated from one 8-bit segment to the next. Whenever large numbers (numbers wider than 8 bits, or multiple-byte numbers) are added, the carry must be propagated from one 8-bit segment to the next.

Addition with Carry Prepared by: Dr Masri Ayob - TK

Example Prepared by: Dr Masri Ayob - TK Suppose that the DE register pair contains a 16-bit number that we must add to the number in the BC register pair. To accomplish this multiple-byte addition, add F and C together and then add D and B together with the carry. The add-with-carry instruction uses the carry from the addition of E and C to generate the correct answer when D and B are added. Suppose that the DE register pair contains a 16-bit number that we must add to the number in the BC register pair. To accomplish this multiple-byte addition, add F and C together and then add D and B together with the carry. The add-with-carry instruction uses the carry from the addition of E and C to generate the correct answer when D and B are added.

Example Prepared by: Dr Masri Ayob - TK

Sixteen-Bit Addition Prepared by: Dr Masri Ayob - TK The 8085 instruction set does contain special instructions (DAD) that do 16-bit addition.

BCD Addition Prepared by: Dr Masri Ayob - TK BCD addition is like binary addition except that the numbers range in value only from 0 through 9. BCD addition is like binary addition except that the numbers range in value only from 0 through 9. A special instruction allows BCD addition by using the standard binary addition (ADD) instructions. A special instruction allows BCD addition by using the standard binary addition (ADD) instructions. The DAA instruction appears after a BCD addition (with a binary add instruction) to correct the BCD result. The DAA instruction appears after a BCD addition (with a binary add instruction) to correct the BCD result. The DAA instruction does not convert a binary number to a BCD number. The DAA instruction does not convert a binary number to a BCD number.

Example Prepared by: Dr Masri Ayob - TK Example 5-6 illustrates the summation of the packed BCD numbers 11 and 19. Example 5-6 illustrates the summation of the packed BCD numbers 11 and 19. After this addition, the accumulator contains a 2AH, which is not a BCD number: After this addition, the accumulator contains a 2AH, which is not a BCD number: the answer should be a 30 BCD the answer should be a 30 BCD The DAA instruction corrects the answer after the addition and provides a 30 BCD after the DAA instruction executes. The DAA instruction corrects the answer after the addition and provides a 30 BCD after the DAA instruction executes.

BCD Addition Prepared by: Dr Masri Ayob - TK The DAA instruction changes the result through the two tests listed by adding a OOH, 06H, 60H, or 66H to the accumulator. The DAA instruction changes the result through the two tests listed by adding a OOH, 06H, 60H, or 66H to the accumulator. If the least significant half-byte is greater than 9 or if the AC flag = 1, the DAA instruction adds a 06H to the accumulator. If the least significant half-byte is greater than 9 or if the AC flag = 1, the DAA instruction adds a 06H to the accumulator. If the most significant half-byte is greater than 9 or if the C flag bit 1, the DAA instruction adds a 60H to the accumulator. If the most significant half-byte is greater than 9 or if the C flag bit 1, the DAA instruction adds a 60H to the accumulator.

Increment Prepared by: Dr Masri Ayob - TK The last form of addition is to increment or add 1. The last form of addition is to increment or add 1. The increment command is either an 8-bit (INR) increment or a 16-bit (INX) Increment instruction. The increment command is either an 8-bit (INR) increment or a 16-bit (INX) Increment instruction. The INR instructions affect all the flags except carry, and the INX instructions affect no flags. The INR instructions affect all the flags except carry, and the INX instructions affect no flags.

Prepared by: Dr Masri Ayob - TK

Subtraction Prepared by: Dr Masri Ayob - TK The 8085 supports 8-bit binary subtraction and decrement. The 8085 supports 8-bit binary subtraction and decrement. It also supports a subtraction instruction that allows a borrow to be propagated through additional bytes of a number. It also supports a subtraction instruction that allows a borrow to be propagated through additional bytes of a number. The subtract-with-borrow instruction aids in the subtraction of multiple-byte numbers.. The subtract-with-borrow instruction aids in the subtraction of multiple-byte numbers..

Subtraction Prepared by: Dr Masri Ayob - TK The 8085 performs subtraction by using the method of 2’s complement. The 8085 performs subtraction by using the method of 2’s complement. Subtraction can be performed by using either: Subtraction can be performed by using either: the instruction SUB to subtract contents of a source register or the instruction SUB to subtract contents of a source register or the instruction SUI to subtract an 8-bit number from contents of the accumulator. the instruction SUI to subtract an 8-bit number from contents of the accumulator. In either case, the accumulator contents are regarded as minuend (the number from which to subtract). In either case, the accumulator contents are regarded as minuend (the number from which to subtract).

Subtraction Prepared by: Dr Masri Ayob - TK Various subtraction instructions: register, register indirect, and immediate addressing. Various subtraction instructions: register, register indirect, and immediate addressing. Direct addressing is not allowed for a subtraction. Direct addressing is not allowed for a subtraction. Each of these instructions affects the flag bits, so they reflect various conditions about the difference after a subtraction. Each of these instructions affects the flag bits, so they reflect various conditions about the difference after a subtraction.

Subtraction Prepared by: Dr Masri Ayob - TK The 8085 performs the following steps internally to execute the instruction SUB (or SUI): The 8085 performs the following steps internally to execute the instruction SUB (or SUI): Converts subtrahend (the number to be subtracted) into its 1’s complement. Converts subtrahend (the number to be subtracted) into its 1’s complement. Adds 1I to 1’s complement to obtain 2’s complement of the subtrahend. Adds 1I to 1’s complement to obtain 2’s complement of the subtrahend. Add 2’s complement to the minuend (the contents of the accumulator). Add 2’s complement to the minuend (the contents of the accumulator). Complements the Carry flag. Complements the Carry flag.

Illustrative Program: Subtraction of Two Numbers Prepared by: Dr Masri Ayob - TK PROBLEM STATEMENT PROBLEM STATEMENT Write a program to do the following: Write a program to do the following: Load the number 3011 in register B and 3911 in register C. Load the number 3011 in register B and 3911 in register C. Subtract 39H from Subtract 39H from Display the answer at PORT I. Display the answer at PORT I.

Illustrative Program: Subtraction of Two Numbers Prepared by: Dr Masri Ayob - TK

Illustrative Program: Subtraction of Two Numbers Prepared by: Dr Masri Ayob - TK PROGRAM DESCRIPTION PROGRAM DESCRIPTION Registers B and C are loaded with 30H and 39H, respectively. Registers B and C are loaded with 30H and 39H, respectively. The instruction MOV A,B copies 30H into the accumulator (shown as register contents). The instruction MOV A,B copies 30H into the accumulator (shown as register contents).

Illustrative Program: Subtraction of Two Numbers Prepared by: Dr Masri Ayob - TK To execute the instruction SUB C the microprocessor performs the following steps internally: To execute the instruction SUB C the microprocessor performs the following steps internally:

Illustrative Program: Subtraction of Two Numbers Prepared by: Dr Masri Ayob - TK PROGRAM DESCRIPTION PROGRAM DESCRIPTION The number F7H is a 2’s complement of the magnitude (39H- 30H)=09H. The number F7H is a 2’s complement of the magnitude (39H- 30H)=09H. This ‘Cy’ flag is set, indicating the answer is in 2’s complement. This ‘Cy’ flag is set, indicating the answer is in 2’s complement. The instruction OUT displays F7 at PORT1. The instruction OUT displays F7 at PORT1.

Subtraction Prepared by: Dr Masri Ayob - TK P= 0 Odd parity

Subtract with Borrow Prepared by: Dr Masri Ayob - TK

Subtract with Borrow Prepared by: Dr Masri Ayob - TK

Example Prepared by: Dr Masri Ayob - TK Suppose that the number in the DE pair must be subtracted from the BC pair. The least significant is operated on first. Once the difference of C and E is found, the D register is subtracted from the B register with a borrow. The subtraction with borrow effectively propagates the borrow through the most significant byte of the result.

LOGIC INSTRUCTIONS Prepared by: Dr Masri Ayob - TK Four basic logic functions: Four basic logic functions: invert, AND, OR, and exclusive-OR. invert, AND, OR, and exclusive-OR. Why does a microprocessor instruction set contain logic instructions? Why does a microprocessor instruction set contain logic instructions? Logic instructions sometimes replace discrete logic gates. Logic instructions sometimes replace discrete logic gates. Today, program storage costs about of a cent per byte. Today, program storage costs about of a cent per byte. System control software usually requires bit manipulation — a logic operation. System control software usually requires bit manipulation — a logic operation.

Inversion (NOT) Prepared by: Dr Masri Ayob - TK The CMA instruction (2FH in machine language), one’s-complements or inverts the contents of the accumulator. The CMA instruction (2FH in machine language), one’s-complements or inverts the contents of the accumulator. This operation, which affects none of the flag bits, causes each bit of the accumulator to be inverted (changed from 1 to 0 or 0 to 1). This operation, which affects none of the flag bits, causes each bit of the accumulator to be inverted (changed from 1 to 0 or 0 to 1). The CMA instruction causes the accumulator to appear as eight inverters (or NOT). The CMA instruction causes the accumulator to appear as eight inverters (or NOT). This means that this one-byte instruction replaces eight discrete inverters if the speed required is not too great. The amount of circuitry replaced by the CMA instruction is 14 of a 7404 TTL hex inverter. This means that this one-byte instruction replaces eight discrete inverters if the speed required is not too great. The amount of circuitry replaced by the CMA instruction is 14 of a 7404 TTL hex inverter.

The AND Operation Prepared by: Dr Masri Ayob - TK The AND instruction, has two separate functions in a microprocessor- based system. The AND instruction, has two separate functions in a microprocessor- based system. The AND instruction selectively clears bits of the accumulator or replaces discrete AND gates. The AND instruction selectively clears bits of the accumulator or replaces discrete AND gates. The AND instruction, functions as eight independent two-input AND gates. This instruction replaces two 7408 quad two-input AND gates. The AND instruction, functions as eight independent two-input AND gates. This instruction replaces two 7408 quad two-input AND gates.

The AND Operation Prepared by: Dr Masri Ayob - TK

The AND Operation Prepared by: Dr Masri Ayob - TK

The OR Operation Prepared by: Dr Masri Ayob - TK Has two separate functions in a microprocessor-based system: Has two separate functions in a microprocessor-based system: It selectively sets bits of the accumulator or It selectively sets bits of the accumulator or Replaces discrete OR gates. Replaces discrete OR gates. The inclusive-OR instruction functions as eight independent two-input OR gates. The inclusive-OR instruction functions as eight independent two-input OR gates. This instruction replaces two 7432 quad two-input OR gates. This instruction replaces two 7432 quad two-input OR gates.

The OR Operation Prepared by: Dr Masri Ayob - TK

The OR Operation Prepared by: Dr Masri Ayob - TK

Prepared by: Dr Masri Ayob - TK

Illustrative Program: ORing Data from Two Input Ports Prepared by: Dr Masri Ayob - TK PROBLEM STATEMENT PROBLEM STATEMENT Two input port with eight switches (each port) at address 00H and OIH (Figure 6.9) is connected to the microcomputer to control the same appliances and lights from the bedroom as well as from the kitchen. Two input port with eight switches (each port) at address 00H and OIH (Figure 6.9) is connected to the microcomputer to control the same appliances and lights from the bedroom as well as from the kitchen. Write instructions to turn on the devices from any of the input ports. Write instructions to turn on the devices from any of the input ports.

Illustrative Program: ORing Data from Two Input Ports Prepared by: Dr Masri Ayob - TK

Illustrative Program: ORing Data from Two Input Ports Prepared by: Dr Masri Ayob - TK PROBLEM ANALYSIS PROBLEM ANALYSIS To turn on the appliances from any one of the input ports, the microprocessor needs to read the switches at both ports and logically OR the switch positions. To turn on the appliances from any one of the input ports, the microprocessor needs to read the switches at both ports and logically OR the switch positions. Assume that the switch positions in one input port (located in the bedroom) correspond to the data byte 9lH and the switch positions in the second port (located in the kitchen) correspond to the data byte A8H. Assume that the switch positions in one input port (located in the bedroom) correspond to the data byte 9lH and the switch positions in the second port (located in the kitchen) correspond to the data byte A8H. The person in the bedroom wants to turn on the air conditioner, the radio, and the bedroom light; and the person in the kitchen wants to turn on the air-conditioner, the coffeepot, and the kitchen light. The person in the bedroom wants to turn on the air conditioner, the radio, and the bedroom light; and the person in the kitchen wants to turn on the air-conditioner, the coffeepot, and the kitchen light. By ORing these two data bytes, the MPU can turn ON the necessary appliances. By ORing these two data bytes, the MPU can turn ON the necessary appliances.

Illustrative Program: ORing Data from Two Input Ports Prepared by: Dr Masri Ayob - TK

Exclusive OR (XOR) Prepared by: Dr Masri Ayob - TK

ROTATE INSTRUCTIONS Prepared by: Dr Masri Ayob - TK

SHIFT INSTRUCTIONS Prepared by: Dr Masri Ayob - TK

COMPARE INSTRUCTIONS Prepared by: Dr Masri Ayob - TK CMP R/M: Compare (Register or Memory) with Acc. CMP R/M: Compare (Register or Memory) with Acc. This is a 1-byte instruction. This is a 1-byte instruction. It compares the data byte in register or memory with the contents of the acc.. It compares the data byte in register or memory with the contents of the acc.. If (A) < (R/M), the CY flag is set and the Zero flag is reset. If (A) < (R/M), the CY flag is set and the Zero flag is reset. If (A) = (R/M), the Zero flag is set and the CY flag is reset. If (A) = (R/M), the Zero flag is set and the CY flag is reset. If (A) > (R/M), the CY and Zero flags are reset. If (A) > (R/M), the CY and Zero flags are reset. When memory is an operand, its address is specified by (HL). When memory is an operand, its address is specified by (HL). No contents are modified; however, all remaining flags (S, P, AC) are affected according to the result of the subtraction. No contents are modified; however, all remaining flags (S, P, AC) are affected according to the result of the subtraction. CPI 8-bit: Compare Immediate with Accumulator CPI 8-bit: Compare Immediate with Accumulator This is a 2-byte instruction, the second byte being 8-bit data. This is a 2-byte instruction, the second byte being 8-bit data. It compares the second byte with (A). It compares the second byte with (A). If (A) < 8-bit data, the CY flag is set and the Zero flag is reset. If (A) < 8-bit data, the CY flag is set and the Zero flag is reset. If (A) = 8-bit data, the Zero flag is set, and the CV flag is reset. If (A) = 8-bit data, the Zero flag is set, and the CV flag is reset. If (A)> 8-bit data, the CY and Zero flags are reset. If (A)> 8-bit data, the CY and Zero flags are reset. No contents are modified; however, all remaining flags (S, P, AC) are affected according to the result of the subtraction. No contents are modified; however, all remaining flags (S, P, AC) are affected according to the result of the subtraction.

EXAMPLE 1 Prepared by: Dr Masri Ayob - TK Write a program to load the accumulator with the data byte 64H, and verify whether the data byte in memory location 2050H is equal to the accumulator contents. If both data bytes are equal, jump to memory location BUFFER. Write a program to load the accumulator with the data byte 64H, and verify whether the data byte in memory location 2050H is equal to the accumulator contents. If both data bytes are equal, jump to memory location BUFFER. LXI H,2050H MVI A,64H CMP M JZ BUFFER

EXAMPLE 2 Prepared by: Dr Masri Ayob - TK Write a program to load the accumulator with the data byte 64H, and verify whether the data byte in memory location 2050H is greater than the accumulator contents. If yes, jump to memory location BUFFER1. Else jump to memory location BUFFER2. Write a program to load the accumulator with the data byte 64H, and verify whether the data byte in memory location 2050H is greater than the accumulator contents. If yes, jump to memory location BUFFER1. Else jump to memory location BUFFER2.

SUMMARY Prepared by: Dr Masri Ayob - TK Most arithmetic and logic instructions affect the flag bits, whereas the data transfer instructions did not affect the flags. Most arithmetic and logic instructions affect the flag bits, whereas the data transfer instructions did not affect the flags. Many arithmetic and logic instructions gate the result into the accumulator. Many arithmetic and logic instructions gate the result into the accumulator. The arithmetic and logic instructions use register, immediate, and register indirect addressing. The arithmetic and logic instructions use register, immediate, and register indirect addressing. Addition is available as add 1 to any register or register pair, 8- and 16-bit binary, 8-bit binary with carry, and binary-coded decimal (BCD). Addition is available as add 1 to any register or register pair, 8- and 16-bit binary, 8-bit binary with carry, and binary-coded decimal (BCD).

SUMMARY Prepared by: Dr Masri Ayob - TK Subtraction is available as subtract 1 from any register or register pair, 8-bit binary, 8-bit binary with borrow, and as a compare, which is a form of subtraction. Subtraction is available as subtract 1 from any register or register pair, 8-bit binary, 8-bit binary with borrow, and as a compare, which is a form of subtraction. The logic operations are AND, OR, exclusive-OR, and invert. The logic operations are AND, OR, exclusive-OR, and invert. The logic instructions are ideal for control because AND clears bits, OR sets bits, and exclusive-OR complements bits. This gives the programmer complete control over each bit of a number. The logic instructions are ideal for control because AND clears bits, OR sets bits, and exclusive-OR complements bits. This gives the programmer complete control over each bit of a number. Programmed logic replaces discrete logic circuits at a substantial cost advantage. Programmed logic replaces discrete logic circuits at a substantial cost advantage.

SUMMARY Prepared by: Dr Masri Ayob - TK Some 8085 instructions have hidden functions: ADD A shifts the accumulator left, and DAD H shifts HL left. Some 8085 instructions have hidden functions: ADD A shifts the accumulator left, and DAD H shifts HL left. Both ANA A and ORA A test the accumulator, and SUB A and XRA A clear the accumulator. Both ANA A and ORA A test the accumulator, and SUB A and XRA A clear the accumulator. The rotate commands create the shift-right functions: logical and arithmetic shift right. The rotate commands create the shift-right functions: logical and arithmetic shift right.

Thank you Q&A Prepared by: Dr Masri Ayob - TK