Arithmetic Instructions
|
|
- Timothy Boyd
- 6 years ago
- Views:
Transcription
1 Segment 3C Arithmetic Instructions This topic covers the following instructions: Addition (ADD, INC, ADC) Subtraction (SUB, DEC, SBB,CMP) Multiplication (MUL, IMUL) Division (DIV, IDIV) BCD Arithmetic (DAA, DAS) Course Instructor Mohammed Abdul kader Assistant Professor, EEE, IIUC
2 Addition appears in many forms in the microprocessor. Register addition Immediate addition Memory to register addition Increment addition Addition-with-carry N.B: The only types of addition not allowed are memory-to-memory and segment register. Example: ADD CS, DS ; not allowed ADD [AX], [BX] ; Not allowed Register Addition Addition Instructions Register addition instructions are used to add the contents of registers. Example: ADD AL, BL ; AL=AL+BL ADD CX, DI ; CX=CX+DI 2
3 Addition Instructions (Continued) Immediate Addition Immediate addition is employed whenever constants or known data are added. Example: ADD CL, 44H ; CL=CL+44H ADD BX, 245FH ; BX=BX+245FH Memory to Register Addition Memory data can be added with register content. Example: ADD CL, [BP] ; The byte content of the stack segment memory location addressed by BP add to CL with the sum stored in CL. ADD [BX], AL ; AL adds to the byte contents of the data segment memory location addressed by BX with the sum stored in the same memory location. N.B. * Data Segment is used by default when BX, DI or SI is used to address memory. * If the BP register addresses memory, the stack segment is used by default. 3
4 Addition Instructions (Continued) Increment Addition Increment addition (INC) adds 1 to any register or memory location except a segment register. With indirect memory increments, the size of the data must be described by using the BYTE PTR, WORD PTR or, DWORD PTR assembler directives. Increment instructions affect the flag bits, as do most of the arithmetic and logic operations. The difference is that increment instructions do not affect the carry flag bit Example: INC BL ;BL= BL+1 INC SP ; SP=SP+1 INC BYTE PTR[BX] ; Add 1 to the byte contents of the data segment memory location addressed by BX. Addition with carry (ADC) An addition with carry (ADC) instruction adds the bit in the carry flag (C) to the operand data. Example: ADC AL, AH ; AL=AL+AH+carry ADC DH, [BX] ; The byte content of the data segment memory location addressed by BP add to DH with the sum stored in DH. 4
5 5 Addition Instructions (Continued) Changes of flag bits after addition: Changes bits by any Add instruction: Sign, Zero, Carry, Auxiliary carry, parity and overflow flag. Z = 0 (result not zero) Z=1(result zero) C=0 (no carry) C=1(carry exist) A=0 (no half carry) A= 1 (half carry exist) S=0 (result positive) S=1 (result negative) P=0 (Odd parity) P=1 (even parity) O=0 (no overflow) O= 1 (overflow occur) Problem: a) Develop a short sequence of instructions that adds two thirty two bit numbers (FE432211H and D1234EF1H) with the sum appearing in BX-AX b) What is wrong with the following instructions: ADD AL, AX ; ADC CS, DS ; INC [BX] ; ADD [AX], [BX]; INC SS c) Suppose, present content of flag register is 058F H. Find the content of AX and Flag register after executing the following instructions MOV AX, 1001H MOV DX, 20FFH ADD AX, DX d) Develop a short sequence of instructions that adds AL, BL, CL, DL and AH. Save the sum in the DH register.
6 Many forms of subtraction appear in the instruction set. Register Subtraction Immediate Subtraction Decrement Subtraction Subtraction with Borrow Comparison N.B: The only types of subtraction not allowed are memory-to-memory and segment register subtractions. Example: SUB CS, DS ; not allowed SUB [AX], [BX] ; Not allowed Register Subtraction Subtraction Instructions Register subtraction instructions are used to subtract the contents of registers. Example: SUB AL, BL ; AL=AL-BL SUB CX, DI ; CX=CX-DI 6
7 Subtraction Instructions (Continued) Immediate Subtraction Immediate subtraction is employed whenever constants or known data are subtracted. Example: SUB CL, 44H ; CL=CL-44H SUB BX, 245FH ; BX=BX-245FH Memory to Register Subtraction Memory data can be subtracted from register content. Example: SUB [DI], CH ; Subtract CH from the byte content of data segment memory addressed by DI and stores the result in same location. SUB CH, [BP] ; Subtract the byte contents of the stack segment memory location addressed by BP from CH and the result stored in CH. N.B. * Data Segment is used by default when BX, DI or SI is used to address memory. * If the BP register addresses memory, the stack segment is used by default. 7
8 Decrement Subtraction Decrement subtraction (DEC) subtract 1 from a register or memory location except a segment register. With indirect memory increments, the size of the data must be described by using the BYTE PTR, WORD PTR or, DWORD PTR assembler directives. Example: DEC BL ;BL= BL-1 DEC SP ; SP=SP-1 DEC BYTE PTR[BX] ; Subtracts 1 from the byte contents of the data segment memory location addressed by BX. DEC WORD PTR[BP] ; Subtracts 1 from the word content of the stack segment memory location addressed by BP. Subtraction with Borrow (SBB) A subtraction with borrow (SBB) instruction functions as a regular subtraction, except that the carry flag (C), which hold the borrow, also subtracts from the difference. The most common use for this instruction is for subtractions that are wider than 16-bits. Example: SBB AL, AH ; AL=AL-AH-carry SBB DH, [BX] ; The byte content of the data segment memory location addressed by BP subtracted from DH and result stored in DH. N.B. Immediate subtraction from a memory location requires BYTE PTR, WORD PTR directives. Example: SBB BYTE PTR[DI], 3 ; both 3 and carry subtract from data segment memory location addressed by DI 8 Subtraction Instructions (Continued)
9 Subtraction Instructions (Continued) Comparison The comparison instruction (CMP) is a subtraction that changes only the flag bits, the destination operand never changes. A comparison is useful for checking the entire contents of a register or a memory location against another value. A CMP is normally followed by a conditional jump instruction, which test condition of the flag bits. Example: CMP CL, BL ; CL-BL The result of comparison depends on CF, ZF and SF CF ZF SF Result Result of subtraction is zero (the values are equal) st value is greater than 2 nd value (No borrow) nd value is greater than 1 st value (Needs borrow) Conditional jump instructions that often followed by CMP instruction are JA (jump above) JB (jump below) JAE (jump above or equal) JBE (jump below or equal) Example: CMP AL, 10H; compare AL against 10H JAE EEE ; if AL is 10H or above program jump to EEE 9
10 Multiplication Instructions Multiplication In 8086 multiplication is performed on bytes (8-bit) and words (16-bit) and can be signed integer (IMUL) or unsigned integer (MUL). If two 8-bit numbers are multiplied, they generate 16-bit product; if two 16-bit numbers are multiplied they generate 32-bit product. Some flag bits,o (overflow) and C (carry) changes when multiply instruction executes and produce predictable outcomes. The other flag also change, but their results are unpredictable and therefore are unused. 8-bit multiplication (signed and unsigned) Multiplicand is always in AL register Multiplier can be any 8-bit register or any memory location. Product is placed in AX register. (For signed multiplication, the product is in binary form, if positive, and in 2 s complement form, if negative. For unsigned multiplication result is always in binary form). Immediate multiplication is not allowed. Unsigned multiplication uses MUL instruction and signed multiplication uses IMUL instruction. Example: MUL CL ; AL is multiplied by CL, the unsigned product is in AX IMUL DH ; AL is multiplied by DH, the signed product is in AX IMUL BYTE PTR[BX] ; AL is multiplied by byte contents of the data segment memory location addressed by BX, the signed product is in AX. 10
11 Multiplication Instructions (Continued) 16 bit multiplication Multiplicand stay in AX. Multiplier can stay any 16-bit register or memory location. 32-bit product appear in DX-AX. The DX register always contains the most significant 16 bits and AX contains the least significant bits of the product. Example: MUL CX ; AX is multiplied by CX, the unsigned product is in DX-AX IMUL DI ; AX is multiplied by DI, the signed product is in DX-AX. MUL WORD PTR[SI]; AX is multiplied by the word content of data segment memory location addressed by SI, the unsigned product is in DX-AX. Problems: a) Write a short sequence of instructions that multiply 4 with 10 and the result is stored in DX. 11
12 Division Division occurs on 8-bit or 16-bit numbers in the microprocessors, and on 32-bit numbers in the Pentium 4 microprocessor. Unsigned division use DIV instruction and signed division use IDIV instruction. The dividend is always a double-width dividend that is divided by the operand. This means that an 8-bit division divides a 16-bit number by an 8-bit number; a 16-bit division divides a 32-bit number by a 16-bit number. There is no immediate division instruction available to any microprocessor. None of the flag bits change predictably for a division. 8-bit Division Dividend (which is divided by a value) always stored in AX. The dividing content is stored in any 8-bit register or memory location. The quotient moves into AL division. Reminder stored in AH register. Example: Division Instructions DIV CL ; AX is divided by CL, the unsigned quotient is in AL and the unsigned reminder is in AH. IDIV BL ; AX is divided by BL, the signed quotient is in AL and the signed reminder is in AH DIV BYTE PTR[BP] ; AX is divided by the byte content of the stack segment memory location addressed by BP, the unsigned quotient is in AL and unsigned remainder is in AH 12
13 16-bit division Dividend (which is divided by a value) always stored in DX-AX. The dividing content is stored in any 16-bit register or memory location. The quotient appears in AX. Reminder appears in DX register. Example: DIV CX ; DX-AX is divided by CX, the unsigned quotient is in AX and the unsigned remainder is in DX. IDIV SI ; DX-AX is divided by SI, the signed quotient is in AX and the signed remainder is in DX CBW (Convert signed byte to signed word) This instruction copies the sign of a byte in AL to all the bits in AH. AH is then said to be sign extension of AL. The CBW operation must be done before a signed byte in AL can be divided by another signed byte with the IDIV instruction. CBW effects no flag. Example: Suppose we want to divide -38 by +3. AL= =-26H=-38 decimal CH= =+3H = +3 decimal MOV AL, -26H MOV CH, 03H CBW ; Extended sign of AL through AH. AX= IDIV CH; Divide AX by CH AL= = -OCH=-12 decimal; AH = = -2 decimal 13 Division Instructions (Continued)
14 Division Instructions (Continued) CWD (Convert signed Word to signed Double word) CWD copies the sign of a word in AX to all the bits of the DX register. In other words, it extends the sign of AX into all of DX The CWD operation must be done before a signed word in AX can be divided by another signed word with the IDIV instruction. CWD affects no flag. Example: divide decimal by +250 decimal. AX= = decimal CX = = +250 decimal DX = CWD ; DX= AX= IDIV CX Problems: a) Write a short sequence of instruction to divide 800 by 100. The result should be stored in CL register. b) Write a short sequence of instructions that divide the number in BL by the number in CL and then multiplies the result by 2. The final answer must be a 16-bit number stored in the DX register. c) [{130-(300/50)+6}*9] 14
15 15 BCD Arithmetic The addition or subtraction of two BCD numbers result a binary number. To adjust this number into BCD the following instructions are used: DAA (Decimal adjust AL after BCD addition) DAS (Decimal adjust AL after BCD subtraction) DAA This instruction is used to make sure the result of adding two packed BCD numbers is adjusted to be a legal BCD number. The result must be in AL for DAA to work correctly. If the lower nibble in AL after addition is greater than 9 or AF was set by the addition, then the DAA instruction will add 6 to the lower nibble in AL. If the result in the upper nibble of AL is now greater than 9 or if the carry flag was set by the addition or correction, then DAA instruction will add 60H to AL. Example: (a) Let, AL= = 59 BCD and BL= = 35 BCD ADD AL, BL ; AL= = 8EH DAA ; Add 0110 because 1110>9 ; AL= = 94 BCD (b) Let, AL= (88 BCD) and BL= (49 BCD) ADD AL,BL ; AL= , AF=1 DAA ; Add 0110 because AF=1 ; AL= (D7H) ; 1101>9 so add ; AL= (37 BCD), CF=1
16 DAS BCD Arithmetic (Continued) This instruction is used after subtracting two packed BCD numbers to make sure the result is correct packed BCD. The result of subtraction must be in AL for DAS to work correctly. If the lower nibble in AL after subtraction is greater than 9 or the AF was set by the subtraction then DAS instruction will subtract 6 from the lower nibble of AL. If the result in the upper nibble is now greater than 9 or if the carry flag was set, the DAS instruction will subtract 60 from AL. Example: Let, AL= (86 BCD) and BH= (57 BCD) SUB AL, BH ; AL= (2FH), CF=0 DAS ; Lower nibble of results is 1111>9, so DAS automatically subtracts ; AL= (29 BCD) Problem: (a) Write an instruction set to implement a decimal up counter using DAA instruction. (b) Write an instruction set to implement a decimal down counter using DAS instruction. 16
17 (a) Decimal up counter- BCD Arithmetic (Continued) Solution of problems MOV COUNT, 63H ; initialize count in memory location as 1. MOV AL, COUNT ; Bring COUNT into AL to work on. ADD AL, 01H ; increment the value by 1 DAA ; Decimal adjust the result MOV COUNT, AL ; Put decimal result back in memory. (b) Decimal down counter- MOV COUNT, 63H ; initialize count in memory location as 99 decimal (63H). MOV AL, COUNT ; Bring COUNT into AL to work on. SUB AL, 01H ; Decrement the value by 1. DAS ;Decimal adjust the result. MOV COUNT, AL ; Put new count back in memory. 17
EC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationSigned number Arithmetic. Negative number is represented as
Signed number Arithmetic Signed and Unsigned Numbers An 8 bit number system can be used to create 256 combinations (from 0 to 255), and the first 128 combinations (0 to 127) represent positive numbers
More information8086 INTERNAL ARCHITECTURE
8086 INTERNAL ARCHITECTURE Segment 2 Intel 8086 Microprocessor The 8086 CPU is divided into two independent functional parts: a) The Bus interface unit (BIU) b) Execution Unit (EU) Dividing the work between
More informationWeek /8086 Microprocessor Programming I
Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any
More informationINSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
8 Unsigned and Signed Integer Numbers 1. Unsigned integer numbers: each type of integer can be either byte-wide or word-wide. This data type can be used to represent decimal numbers in the range 0 through
More informationCode segment Stack segment
Registers Most of the registers contain data/instruction offsets within 64 KB memory segment. There are four different 64 KB segments for instructions, stack, data and extra data. To specify where in 1
More informationMnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C
ARITHMETIC AND LOGICAL GROUPS 6-1 Arithmetic and logical groups: The arithmetic group includes instructions for the addition, subtraction, multiplication, and division operations. The state that results
More information8086 Programming. Multiplication Instructions. Multiplication can be performed on signed and unsigned numbers.
Multiplication Instructions 8086 Programming Multiplication can be performed on signed and unsigned numbers. MUL IMUL source source x AL source x AX source AX DX AX The source operand can be a memory location
More informationIntel 8086: Instruction Set
IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction
More informationLogic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A
Segment 4A Logic Instructions Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Course Instructor Mohammed Abdul kader Lecturer, EEE, IIUC Basic
More informationLecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide
Lecture 9 INC and DEC Arithmetic Operations Overflow Multiply and Divide INC adds one to a single operand DEC decrements one from a single operand INC destination DEC destination where destination can
More informationLecture (07) x86 programming 6
Lecture (07) x86 programming 6 By: Dr. Ahmed ElShafee 1 The Flag Register 31 21 20 19 18 17 16 14 13 12 11 10 9 8 7 6 4 2 0 ID VIP VIF AC VM RF NT IOP 1 IOP 0 O D I T S Z A P C 8088/8086 80286 80386 80486
More information8088/8086 Programming Integer Instructions and Computations
Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One
More informationEEM336 Microprocessors I. Arithmetic and Logic Instructions
EEM336 Microprocessors I Arithmetic and Logic Instructions Introduction We examine the arithmetic and logic instructions. The arithmetic instructions include addition, subtraction, multiplication, division,
More informationEx: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.
INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0
More informationIntel 8086 MICROPROCESSOR ARCHITECTURE
Intel 8086 MICROPROCESSOR ARCHITECTURE 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14, 16
More informationIntel 8086 MICROPROCESSOR. By Y V S Murthy
Intel 8086 MICROPROCESSOR By Y V S Murthy 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14,
More informationInstructions moving data
do not affect flags. Instructions moving data mov register/mem, register/mem/number (move data) The difference between the value and the address of a variable mov al,sum; value 56h al mov ebx,offset Sum;
More informationArithmetic and Logic Instructions And Programs
Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.
More information1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M
Increment R16 1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M 4 x (16+48) = 256 opcodes 2 PUSH/ POP R16/M16/SR/F 2 x (8+24+4+1) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M 4 x (16+48) = 256 opcodes INC
More information9/25/ Software & Hardware Architecture
8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called
More informationKingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems
Kingdom of Saudi Arabia Ministry of Higher Education Taif University Faculty of Computers & Information Systems المملكة العربية السعودية وزارة التعليم العالي جامعة الطاي ف آلية الحاسبات ونظم المعلومات
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
More informationADVANCE MICROPROCESSOR & INTERFACING
VENUS INTERNATIONAL COLLEGE OF TECHNOLOGY Gandhinagar Department of Computer Enggineering ADVANCE MICROPROCESSOR & INTERFACING Name : Enroll no. : Class Year : 2014-15 : 5 th SEM C.E. VENUS INTERNATIONAL
More informationInteger Arithmetic Part2
Islamic University Of Gaza Assembly Language Faculty of Engineering Discussion Computer Department Chapter 7 Eng. Ahmed M. Ayash Date: 21/04/2013 Chapter 7 Integer Arithmetic Part2 7.4: Multiplication
More informationLesson 1. Fundamentals of assembly language
Lesson 1. Fundamentals of assembly language Computer Structure and Organization Graduate in Computer Sciences Graduate in Computer Engineering Graduate in Computer Sciences Graduate in Computer Engineering
More informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program to search a number in given array. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
More information8086 INSTRUCTION SET
8086 INSTRUCTION SET Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE
More informationMarking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of
More informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
More informationMicroprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)
Microprocessor and Assembly Language Week-5 System Programming, BCS 6th, IBMS (2017) High Speed Memory Registers CPU store data temporarily in these location CPU process, store and transfer data from one
More informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE
More informationSummer 2003 Lecture 4 06/14/03
Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General
More informationEC-333 Microprocessor and Interfacing Techniques
EC-333 Microprocessor and Interfacing Techniques Lecture 3 The Microprocessor and its Architecture Dr Hashim Ali Fall - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides
More information8086 Programming ADD BX,245FH BX BX + 245FH ADD [BX],AL [DS:BX] [DS:BX] + AL ADD CL,[BP] CL CL + [SS:BP] ADD BX,[SI + 2] BX BX + [DS:(SI + 3:SI + 2)]
Addition Instruction 8086 Programming The table illustrates the addressing modes available to the ADD instruction. These addressing modes include almost all addressing modes. The only types of addition
More informationUNIT 2 PROCESSORS ORGANIZATION CONT.
UNIT 2 PROCESSORS ORGANIZATION CONT. Types of Operand Addresses Numbers Integer/floating point Characters ASCII etc. Logical Data Bits or flags x86 Data Types Operands in 8 bit -Byte 16 bit- word 32 bit-
More informationChapter Four Instructions Set
Chapter Four Instructions set Instructions set 8086 has 117 instructions, these instructions divided into 6 groups: 1. Data transfer instructions 2. Arithmetic instructions 3. Logic instructions 4. Shift
More information3.1 DATA MOVEMENT INSTRUCTIONS 45
3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,
More informationASSEMBLY LANGUAGE PROGRAMMING OF THE MICROCOMPUTER
CHAPTER ASSEMBLY LANGUAGE PROGRAMMING OF THE MICROCOMPUTER 2.1 Introduction To run a program, a microcomputer must have the program stored in binary form in successive memory locations. There are three
More informationEx : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.
Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H. MOV AX, 5000H MOV DS, AX MOV AL, 20H MOV CL, 30H ADD AL, CL MOV CL, 10H MUL CL
More informationJones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION 80x86 Instructions
80x86 Instructions Chapter 4 In the following sections, we review some basic instructions used by the 80x86 architecture. This Jones is by & no Bartlett means a Learning, complete list LLC of the Intel
More informationInternal architecture of 8086
Case Study: Intel Processors Internal architecture of 8086 Slide 1 Case Study: Intel Processors FEATURES OF 8086 It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 220 memory locations (1
More informationLecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit
Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit 1 1. introduction The internal function of 8086 processor are partitioned logically into processing units,bus Interface Unit(BIU)
More informationQ1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100
16.317: Microprocessor-Based Systems I Summer 2012 Exam 1 July 20, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationMICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN
MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN ROAD MAP SDK-86 Intel 8086 Features 8086 Block Diagram 8086 Architecture Bus Interface Unit Execution Unit 8086 Architecture 8086 Programmer s Model Flag Register
More informationCS401 Assembly Language Solved MCQS From Midterm Papers
CS401 Assembly Language Solved MCQS From Midterm Papers May 14,2011 MC100401285 Moaaz.pk@gmail.com MC100401285@gmail.com PSMD01(IEMS) Question No:1 ( Marks: 1 ) - Please choose one The first instruction
More informationAssignment no:4 on chapter no :3 : Instruction set of 8086
Assignment no:4 on chapter no :3 : Instruction set of 8086 1) Describe any two string operation instruction of 8086 with syntax & one example of each. 1] REP: REP is a prefix which is written before one
More informationBasic Execution Environment
Basic Execution Environment 3 CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel Architecture processor as seen by assembly-language programmers.
More informationDefining and Using Simple Data Types
85 CHAPTER 4 Defining and Using Simple Data Types This chapter covers the concepts essential for working with simple data types in assembly-language programs The first section shows how to declare integer
More informationMicroprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil
Microprocessor By Mrs. R.P.Chaudhari Mrs.P.S.Patil Chapter 1 Basics of Microprocessor CO-Draw Architecture Of 8085 Salient Features of 8085 It is a 8 bit microprocessor. It is manufactured with N-MOS technology.
More informationCC411: Introduction To Microprocessors
CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Describe the Intel family of microprocessors from 8085 to Pentium. In terms of bus size, physical memory & special
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete
More informationIBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.
IBM PC Hardware CPU 8088, 8086 80286 80386 80486 Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory
More informationMarking Scheme. Examination Paper. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of
More informationModule 3 Instruction Set Architecture (ISA)
Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O
More informationIntroduction to IA-32. Jo, Heeseung
Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 9 Integer Arithmetic and Bit Manipulation April, 2014 1 Assembly Language LAB Bitwise
More informationINTRODUCTION TO IA-32. Jo, Heeseung
INTRODUCTION TO IA-32 Jo, Heeseung IA-32 PROCESSORS Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer
More informationProgram controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.
8086 Microprocessor Microprocessor Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. It is used as CPU (Central Processing Unit) in computers.
More informationComputer Architecture 1 ح 303
Lecture 4 A. Addressing MODES 1. Introduction to assembly language programming: Program is a sequence of commands used to tell a microcomputer what to do. Each command in a program is an instruction Programs
More informationA Presentation created By Ramesh.K Press Ctrl+l for full screen view
Press Ctrl+l for full screen view A Presentation created By Ramesh.K rameshpkd@gmail.com Press Ctrl+l for full screen view A Microprocessor sor is a multipurpose, programmable logic device that reads binary
More informationBasic Assembly Instructions
Basic Assembly Instructions Ned Nedialkov McMaster University Canada SE 3F03 January 2013 Outline Multiplication Division FLAGS register Branch Instructions If statements Loop instructions 2/21 Multiplication
More informationQ1: Multiple choice / 20 Q2: Protected mode memory accesses
16.317: Microprocessor-Based Systems I Summer 2012 Exam 2 August 1, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationWe can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...
COMPUTER ARCHITECTURE II: MICROPROCESSOR PROGRAMMING We can study computer architectures by starting with the basic building blocks Transistors and logic gates To build more complex circuits Adders, decoders,
More informationInteger Arithmetic. Pu-Jen Cheng. Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed.
Computer Organization & Assembly Languages Integer Arithmetic Pu-Jen Cheng Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed. Chapter Overview
More informationChapter 3: Addressing Modes
Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires
More informationLecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.
Lecture 5: Computer Organization Instruction Execution Computer Organization Addressing Buses Fetch-Execute Cycle Computer Organization CPU Control Unit U Input Output Memory Components Control Unit fetches
More informationENE 334 Microprocessors
Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives
More informationAPPENDIX C INSTRUCTION SET DESCRIPTIONS
APPENDIX C INSTRUCTION SET DESCRIPTIONS This appendix provides reference information for the 80C186 Modular Core family instruction set. Tables C-1 through C-3 define the variables used in Table C-4, which
More informationCS-202 Microprocessor and Assembly Language
CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture
More informationIntroduction to Microprocessor
Introduction to Microprocessor The microprocessor is a general purpose programmable logic device. It is the brain of the computer and it performs all the computational tasks, calculations data processing
More information16.317: Microprocessor Systems Design I Spring 2014
16.317: Microprocessor Systems Design I Spring 2014 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by
More informationAssembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice
Assembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice Addressing data access specification arrays - specification and manipulation impacts of addressing to performance Processor architecture CISC (more
More informationET355 Microprocessors Thursday 6:00 pm 10:20 pm
ITT Technical Institute ET355 Microprocessors Thursday 6:00 pm 10:20 pm Unit 4 Chapter 6, pp. 139-174 Chapter 7, pp. 181-188 Unit 4 Objectives Lecture: BCD Programming Examples of the 805x Microprocessor
More informationMPID MICROPROCESSOR AND ITS INTERFACING DEVICES EEE III II SEMESTER OBJECTIVE QUESTIONS
MPID MICROPROCESSOR AND ITS INTERFACING DEVICES EEE III II SEMESTER OBJECTIVE QUESTIONS UNIT I 8086 ARCHITECTURE OBJECTIVE TYPE QUESTIONS 1 The number of address spaces of 8085 is ( a) 4 ( b ) 8 ( c )
More informationComplex Instruction Set Computer (CISC)
Introduction ti to IA-32 IA-32 Processors Evolutionary design Starting in 1978 with 886 Added more features as time goes on Still support old features, although obsolete Totally dominate computer market
More information16.317: Microprocessor Systems Design I Fall 2013
16.317: Microprocessor Systems Design I Fall 2013 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationEEM336 Microprocessors I. Data Movement Instructions
EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:
More informationdb "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'
PA4 Sample Solution.model large.stack 100h.data msg1 db "This programs scans a string of up to 256 bytes and counts the repetitions of the number 4206 and sums them.",0dh,0ah,'$' msg2 db "Please enter
More informationicroprocessor istory of Microprocessor ntel 8086:
Microprocessor A microprocessor is an electronic device which computes on the given input similar to CPU of a computer. It is made by fabricating millions (or billions) of transistors on a single chip.
More informationBasic Assembly SYSC-3006
Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming
More informationWeek /8086 Microprocessor Programming II
Week 5 8088/8086 Microprocessor Programming II Quick Review Shift & Rotate C Target register or memory SHL/SAL 0 C SHR 0 SAR C Sign Bit 2 Examples Examples Ex. Ex. Ex. SHL dest, 1; SHL dest,cl; SHL dest,
More informationBAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ
LAB4 RELATED INSTRUCTIONS: Compare, division and jump instructions CMP REG, memory memory, REG REG, REG memory, immediate REG, immediate operand1 - operand2 Result is not stored anywhere, flags are set
More informationUNIT III MICROPROCESSORS AND MICROCONTROLLERS MATERIAL OVERVIEW: Addressing Modes of Assembler Directives. Procedures and Macros
OVERVIEW: UNIT III Addressing Modes of 8086 Assembler Directives Procedures and Macros Instruction Set of 8086 Data Transfer Group Arithmetic Group Logical Instructions Rotate and Shift instructions Loop
More informationVARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad
Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory
More informationAssembly Language: IA-32 Instructions
Assembly Language: IA-32 Instructions 1 Goals of this Lecture Help you learn how to: Manipulate data of various sizes Leverage more sophisticated addressing modes Use condition codes and jumps to change
More informationComputer Architecture and System Programming Laboratory. TA Session 3
Computer Architecture and System Programming Laboratory TA Session 3 Stack - LIFO word-size data structure STACK is temporary storage memory area register points on top of stack (by default, it is highest
More informationComputer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly
Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly Instructor: Rob Bergen Applied Computer Science University of Winnipeg Decimal Addition Review decimal addition
More informationQ1: Multiple choice / 20 Q2: Data transfers and memory addressing
16.317: Microprocessor Systems Design I Fall 2014 Exam 1 October 1, 2014 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationLecture 9. INC and DEC. INC/DEC Examples ADD. ADD Examples SUB. INC adds one to a single operand DEC decrements one from a single operand
Lecture 9 INC and DEC Arithmetic Operations Shift Instructions Next week s homework! INC adds one to a single operand DEC decrements one from a single operand INC destination DEC destination where destination
More informationAssembly Language Each statement in an assembly language program consists of four parts or fields.
Chapter 3: Addressing Modes Assembly Language Each statement in an assembly language program consists of four parts or fields. The leftmost field is called the label. - used to identify the name of a memory
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication
USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication INTERNAL ASSESSMENT TEST 1 Date : 26/02/2018 Marks: 40 Subject
More information1. Introduction to Assembly Language
www.vchowk.com 1. Introduction to Assembly Language Solved EXERCISE 1 Note: Dear fellows I tried my best to solve this exercise questions if there s any mistake or doubt in any question correct it and
More informationAddressing Modes on the x86
Addressing Modes on the x86 register addressing mode mov ax, ax, mov ax, bx mov ax, cx mov ax, dx constant addressing mode mov ax, 25 mov bx, 195 mov cx, 2056 mov dx, 1000 accessing data in memory There
More informationMr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU
5 Years Integrated M.Sc.(IT) Semester 4 060010402 System Programming Question Bank Unit 1: Introduction 1. Write the decimal equivalent for each integral power of 2 from 2! to 2!". 2. Convert the following
More informationLAB 5 Arithmetic Operations Simple Calculator
LAB 5 Arithmetic Operations Simple Calculator Objective: Practice arithmetic operation for the 80x86, such as add, subtract, multiple, divide, and mod. When dealing with the multiply, divide, and mod instructions
More informationAssembler Programming. Lecture 2
Assembler Programming Lecture 2 Lecture 2 8086 family architecture. From 8086 to Pentium4. Registers, flags, memory organization. Logical, physical, effective address. Addressing modes. Processor Processor
More informationChapter 2 COMPUTER SYSTEM HARDWARE
Chapter 2 COMPUTER SYSTEM HARDWARE A digital computer system consists of hardware and software. The hardware consists of the physical components of the system, whereas the software is the collection of
More information