Computer Organization And Assembly Language

Slides:



Advertisements
Similar presentations
Computer Organization And Assembly Language
Advertisements

Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 2015年5月14日 1 Chapter Four.
Department of Computer Science and Software Engineering
80x86 Instruction Set Dr. Qiang Lin.
Prof. Muhammad Saeed III. 1/27/2015Computer Architecture & Assembly Language2 Assembly Language Instructions.
1 Lecture 4: Data Transfer, Addressing, and Arithmetic Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers Chapter 5: Procedures Kip R. Irvine.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language for Intel-Based Computers
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Chapter 4 Basic Instructions. 4.1 Copying Data mov Instructions mov (“move”) instructions are really copy instructions, like simple assignment statements.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
Prof. Muhammad Saeed III. 1/27/2015Computer Architecture & Assembly Language2 Assembly Language Instructions.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Sahar Mosleh California State University San MarcosPage 1 CPU Flags and Boolean Instructions.
Computer Architecture and Assembly Language Practical session outline Introduction 80x86 assembly –Data storage –The registers –Flags –Instructions Assignment.
The x86 Architecture Lecture 15 Fri, Mar 4, 2005.
Computer Architecture and Assembly Language. Byte structure : a byte has 8 bits MSB (Most Significant Bit) LSB (Least Significant Bit) Data Representation.
Copyright 2000ELEC 242 Arithmetic Instructions1 Arithmetic Instructions Arithmetic and logical instructions modify the contents of the Flag (Status) register.
CET 3510 Microcomputer Systems Tech. Lecture 2 Professor: Dr. José M. Reyes Álamo.
Assembly Language for Intel-Based Computers, 6 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
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.
Logic Conditional Processing. Status flags - review The Zero flag is set when the result of an operation equals zero. The Carry flag is set when an instruction.
1 ICS 51 Introductory Computer Organization Fall 2009.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
1 The Stack and Procedures Chapter 5. 2 A Process in Virtual Memory  This is how a process is placed into its virtual addressable space  The code is.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
MOV Instruction MOV destination,source  MOV AX,BX  MOV SUM,EAX  MOV EDX,ARRAY[EBX][ESI]  MOV CL,5  MOV DL,[BX]
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Computer Architecture and Assembly Language
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
Assembly Language for Intel-Based Computers, 4 th Edition Week 10: Conditional Processing Slides modified by Dr. Osama Younes.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
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.
CSC 221 Computer Organization and Assembly Language
Stack Operations Dr. Hadi AL Saadi.
Computer Architecture and Assembly Language
16.317: Microprocessor System Design I
Chapter 4 Data Movement Instructions
Assembly IA-32.
Assembly Language Lab (4).
More on logical instruction and
Assembly Language Programming Part 2
Assembly Language for x86 Processors
Arithmetic Instructions
Symbolic Instruction and Addressing
Chapter 4: Instructions
Data Transfers, Addressing, and Arithmetic
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Practical Session 4.
The Microprocessor & Its Architecture
3.6 Data transfer Instructions
Computer Architecture CST 250
Chapter 5 Arithmetic and Logic Instructions
Chapter 6 –Symbolic Instruction and Addressing
Computer Organization and Assembly Language
CNET 315 Microprocessor & Assembly Language
CSC 497/583 Advanced Topics in Computer Security
Computer Organization and Assembly Language
Computer Architecture and System Programming Laboratory
Presentation transcript:

Computer Organization And Assembly Language III Prof. Muhammad Saeed

Computer Architecture & Assembly Language X86 Processor Assembly Language Assembly Language Instrutions 1/27/2015 Computer Architecture & Assembly Language

Computer Architecture & Assembly Language Language Instructions MOV MOV reg, reg MOV mem, reg MOV reg, mem MOV mem, imm MOV reg, imm MOVZX MOVZX reg32, reg/mem8 MOVZX reg32, reg/mem16 MOVZX reg16, reg/mem8 MOVSX MOVSX reg32, reg/mem8 MOVSX reg32, reg/mem16 MOVSX reg16, reg/mem8 1/27/2015 Computer Architecture & Assembly Language

Computer Architecture & Assembly Language Language Instructions XCHG XCHG reg, reg XCHG reg, mem XCHG mem, reg INC, DEC INC reg/mem DEC reg/mem The Overflow, Sign, Zero, Auxiliary Carry, and Parity flags are changed according to the value of the destination operand. ADD, SUB ADD dest, source The Carry, Zero, Sign, Overflow, Auxiliary Carry, and Parity flags are changed according to the value that is placed in the destination operand. SUB dest, source NEG The Carry, Zero, Sign, Overflow, Auxiliary Carry, and Parity flags are changed according to the value that is placed in the destination operand. NEG reg NEG mem 1/27/2015 Computer Architecture & Assembly Language

Language Instructions PUSH PUSH reg/mem16 PUSH reg/mem32 PUSH imm32 The PUSH instruction first decrements ESP and then copies a source operand into the stack. A 16-bit operand causes ESP to be decremented by 2. A 32-bit operand causes ESP to be decremented by 4. POP POP reg/mem16 POP reg/mem32 The POP instruction first copies the contents of the stack element pointed to by ESP into a 16- or 32-bit destination operand and then increments ESP. If the operand is 16 bits, ESP is incremented by 2; if the operand is 32 bits, ESP is incremented by 4

Language Instructions PUSHFD and POPFD The PUSHFD instruction pushes the 32-bit EFLAGS register on the stack, and POPFD pops the stack into EFLAGS. PUSHAD and POPAD The PUSHAD instruction pushes all of the 32-bit general-purpose registers on the stack in the given order: EAX, ECX, EDX, EBX, ESP, EBP, ESI, and EDI. The POPAD instruction pops the same registers off the stack in reverse order. PUSHA and POPA PUSHA instruction, pushes the 16-bit general-purpose registers (AX, CX, DX, BX, SP, BP, SI, DI) on the stack in the order listed. The POPA instruction pops the same registers in reverse

Language Instructions AND AND reg,reg AND reg,mem AND reg,imm AND mem,reg AND mem,imm The AND instruction performs a boolean (bitwise) AND operation between each pair of matching bits in two operands and places the result in the destination operand OR OR reg,reg OR reg,mem OR reg,imm OR mem,reg OR mem,imm The OR instruction performs a boolean OR operation between each pair of matching bits in two operands and places the result in the destination operand

Language Instructions XOR OR reg,reg OR reg,mem OR reg,imm OR mem,reg OR mem,imm The XOR instruction performs a boolean exclusive-OR operation between each pair of matching bits in two operands and stores the result in the destination operand NOT NOT reg NOT mem The NOT instruction toggles (inverts) all bits in an operand

Language Instructions TEST The TEST instruction performs an implied AND operation between each pair of matching bits in two operands and sets the Sign, Zero, and Parity flags based on the value assigned to the destination operand. The only difference between TEST and AND is that TEST does not modify the destination operand. The TEST instruction always clears the Overflow and Carry flags. It modifies the Sign, Zero, and Parity flags in the same way as the AND instruction.

Language Instructions CMP In x86 assembly language we use the CMP instruction to compare integers. Character codes are also integers, so they work with CMP as well. The CMP (compare) instruction performs an implied subtraction of a source operand from a destination operand. Neither operand is modified. CMP uses the same operand combinations as the AND instruction.

Language Instructions

Language Instructions

Computer Architecture & Assembly Language Program 1st Program .586 .MODEL flat, stdcall option casemap :none Include D:\msaeed\academic\assemblylanguage\masm32\include\windows.inc Include D:\msaeed\academic\assemblylanguage\masm32\include\kernel32.inc Include D:\msaeed\academic\assemblylanguage\masm32\include\user32.inc Includelib D:\msaeed\academic\assemblylanguage\masm32\lib\kernel32.lib Includelib D:\msaeed\academic\assemblylanguage\masm32\lib\user32.lib .DATA WindowTitle BYTE “Greetings",0 Message BYTE “Hello, World",0 .CODE main: invoke MessageBox, NULL, ADDR Message, ADDR WindowTitle, MB_OK invoke ExitProcess, eax end main 1/27/2015 Computer Architecture & Assembly Language

END