Microprocessor Systems Design I

Slides:



Advertisements
Similar presentations
Instruction Set of 8086 Engr. M.Zakir Shaikh
Advertisements

Registers of the 8086/ /2002 JNM.
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 8: Data Transfer Instructions.
Department of Computer Science and Software Engineering
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 14 Compare instructions; conditional execution.
80x86 Instruction Set Dr. Qiang Lin.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Princess Sumaya University
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
Microprocessor Systems Design I
Chapter 4 Basic Instructions. 4.1 Copying Data mov Instructions mov (“move”) instructions are really copy instructions, like simple assignment statements.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 4: 80386DX memory, addressing.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
Flag Control instructions CLC clear carry flag CF = 0 STC set carry flag CF= 1 CMC complement carry flag [CF] CF.
Types of Registers (8086 Microprocessor Based)
LAB Flag Bits and Register
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Review of Assembly language. Recalling main concepts.
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
Microprocessor MA Rahim Khan Computer Engineering and Networks Department.
6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
CS2422 Assembly Language and System Programming 0 Week 9 Data Transfers, Addressing, and Arithmetic.
Chapter Nov-2010
Data Transfers, Addressing, and Arithmetic
Microprocessor Systems Design I
Microprocessor Systems Design I
16.317: Microprocessor System Design I
Introduction to 8086 Microprocessor
Microprocessor Systems Design I
8086 Microprocessor.
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
The FLAGS Register An x bit means an unidentified value 9/12/2018
EE3541 Introduction to Microprocessors
EE3541 Introduction to Microprocessors
Assembly IA-32.
INSTRUCTION SET.
Assembly Language Programming Part 2
16.317: Microprocessor System Design I
ADDRESSING MODES.
Intel 8088 (8086) Microprocessor Structure
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Arithmetic Instructions
X86’s instruction sets.
Introduction to Assembly Language
Chapter 4: Instructions
Data Transfers, Addressing, and Arithmetic
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
Intel 8088 (8086) Microprocessor Structure
CS-401 Computer Architecture & Assembly Language Programming
اصول اساسی برنامه نویسی به زبان اسمبلی
תכנות בסיסי בשפת סף פרק 5 מצגת 3.
Symbolic Instruction and Addressing
University of Gujrat Department of Computer Science
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
Chapter 5 Arithmetic and Logic Instructions
CNET 315 Microprocessor & Assembly Language
Chapter 8: Instruction Set 8086 CPU Architecture
Part IV The FLAGS Register
Presentation transcript:

16.317 Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 7: Data transfer instructions (cont.) Arithmetic instructions

Microprocessors I: Lecture 7 Lecture outline Announcements/reminders HW 1 due today (by end of the day) HW 2 to be posted; due 2/14 Review Data transfer instructions Today’s lecture Finish data transfer instructions Start arithmetic instructions (time permitting) 6/3/2018 Microprocessors I: Lecture 7

Review: data & data transfer instructions x86 data accesses Registers: access as 8-bit (e.g. AL, AH), 16-bit (AX), 32-bit (EAX) Memory Data size usually matches register If not, explicitly specify (BYTE PTR, WORD PTR, DWORD PTR) MOV: basic data transfer Can use registers, memory, immediates If segment reg. is destination, source must be register MOVSX/MOVZX Sign-extend or zero-extend register/memory value 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 XCHG Swap contents of source and destination Format: XCHG D, S Operation: (D) = (S) (S) = (D) Restrictions: Memory operand can only be used as destination 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 LEA Perform effective address computation and store result in register Format: LEA D, EA Operation: D = EA Example: LEA SI, [10H + DI] 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 Load full pointer Load contents of memory into both register and segment register Format: Lxx D, addr xx = DS, ES, FS, GS, SS Operation: (D) = contents of addr Segment register xx = contents of: addr + 2 if D is 16-bit register addr + 4 if D is 32-bit register 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 Example DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 16 03 17 Show the results of running the following program if DATA_SEG_ADDR = 1200H: 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 Example solution DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 16 03 17 MOV AX,DATA_SEG_ADDR AX = DATA_SEG_ADDR = 1200H MOV DS, AX DS = AX = 1200H MOV SI, [INIT_TABLE] SI = memory @ DS:INIT_TABLE = 2211H LES DI,[INIT_TABLE+02H] DI = memory @ DS:INIT_TABLE+02H = 4433H ES = memory @ DS:INIT_TABLE+04H = 6655H 6/3/2018 Microprocessors I: Lecture 7

Example solution (cont.) DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 16 03 17 MOV AX,[INIT_TABLE+06H] AX = memory @ DS:INIT_TABLE+06H = 8877H MOV SS, AX SS = AX = 8877H MOV AX,[INIT_TABLE+08H] AX = memory @ DS:INIT_TABLE+08H = AA99H MOV BX,[INIT_TABLE+0AH] BX = memory @ DS:INIT_TABLE+0AH = CCBBH 6/3/2018 Microprocessors I: Lecture 7

Example solution (cont.) DATA_SEG_ADDR:0000 DATA_SEG_ADDR:INIT_TABLE 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 16 03 17 MOV CX,[INIT_TABLE+0CH] CX = memory @ DS:INIT_TABLE+0CH = EEDDH MOV DX,[INIT_TABLE+0EH] DX = memory @ DS:INIT_TABLE+0EH = 16FFH 6/3/2018 Microprocessors I: Lecture 7

Arithmetic instructions Addition ADD ADC INC Subtraction SUB SBB DEC NEG Multiplication/division MUL IMUL DIV IDIV 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 Flags All arithmetic instructions set flags CF = carry flag (carry output from MSB of add/sub) OF = overflow flag ZF = zero flag (result is zero) SF = sign flag (1 if negative, 0 if positive) PF = parity flag (even parity in LSB) AF = auxiliary carry (carry between nibbles) Stored in FLAGS register Referenced in conditional instructions 6/3/2018 Microprocessors I: Lecture 7

Addition instructions ADD D, S Operation: (D) = (D) + (S) ADC D, S Operation: (D) = (D) + (S) + (CF) INC D Operation: (D) = (D) + 1 6/3/2018 Microprocessors I: Lecture 7

Subtraction instructions SUB D, S Operation: (D) = (D) – (S) SBB D, S Operation: (D) = (D) – (S) – (CF) DEC D Operation: (D) = (D) – 1 NEG D Operation: (D) = -(D) Two’s complement negation 6/3/2018 Microprocessors I: Lecture 7

Microprocessors I: Lecture 7 Final notes Next time: Continue with arithmetic instructions Logical instructions Reminders: HW 1 due today (by end of the day) HW 2 to be posted; due 2/14 6/3/2018 Microprocessors I: Lecture 7