Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive.

Slides:



Advertisements
Similar presentations
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Advertisements

1 Assembly Instructions Assembly language instructions may involve mnemonics, labels, variables, constants, and directives. Examples are as follows. here.
Memory Address Segment-offset address Base location (segment) + logical location (offset) Example: For 32-bits segment-offset address, 08F1:0100 represents.
Assembly Language Fundamentals
Department of Computer Science and Software Engineering
Irvine, Kip R. Assembly Language For Intel-Based Computers TYPE and SIZE Operators TYPE –returns the size, in bytes of a single element of a data label.
80x86 Instruction Set Dr. Qiang Lin.
Memory model ModelDescription SMALLCode in one segment Data in one segment MEDIUMCode in > 1 segment Data in one segment COMPACTCode in one segment Data.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
Assembly Language :CSC 225 (Lec#4: Flag Register and Conditional Statements) By Dr. Syed Noman.
Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras.
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 Chapter 5: Procedures Kip R. Irvine.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Symbolic Constants Equal-Sign Directive Calculating.
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
Assembly Language for Intel-Based Computers Chapter 3: Assembly Language Fundamentals Kip Irvine.
Irvine, Kip R. Assembly Language For Intel-Based Computers.data string db "This is a string." COUNT = ($–string) ; calculate string length.code mov cx,COUNT.
CS2422 Assembly Language & System Programming September 28, 2006.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#8) By Dr. Syed Noman.
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
CSC 221 Computer Organization and Assembly Language
1/2002JNM1 Basic Elements of Assembly Language Integer Constants –If no radix is given, the integer is assumed to be decimal. Int 21h  Int 21 –A hexadecimal.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Sahar Mosleh California State University San MarcosPage 1 CPU Flags and Boolean Instructions.
Introduction to 8086 Assembly Language Assembly Language Programming University of Akron Dr. Tim Margush.
LAB Flag Bits and Register
Lecture 4 ( Assembly Language).
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
Chapter Five–80x86 Assembly program development Principles of Microcomputers 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 1.
Arithmetic Flags and Instructions
L AB 2. P ROGRAM STRUCTURE The assembly language program consist of code, data and stack. Data segment: contains all the variable definition..Data Code.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
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.
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.
Irvine, Kip R. Assembly Language for Intel-Based Computers. Chapter 7: Integer Arithmetic Slides to Accompany Assembly Language for Intel-Based Computers,
B ASIC INSTRUCTIONS. I NTRODUCTION There are over a hundred instructions in the instruction set for the 8086 CPU; there are also instructions designed.
2/20/2016CAP 2211 Flow Control Instructions. 2/20/2016CAP 2212 Transfer of Control Flow control instructions are used to control the flow of a program.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
1 Using the Assembler Chapter – 4(A). 2 Exchanging Two Variables title Exchange Two Variables (Exchange.asm).model small.stack 100h.data value1 db 0Ah.
CS2422 Assembly Language and System Programming 0 Week 9 Data Transfers, Addressing, and Arithmetic.
Instruction set Architecture
Data Transfers, Addressing, and Arithmetic
ICS312 SET 7 Flags.
Microprocessor and Assembly Language
The FLAGS Register An x bit means an unidentified value 9/12/2018
Assembly Language for Intel-Based Computers, 5th Edition
Microprocessor and Assembly Language
Arithmetic Instructions
Assembly Language for Intel-Based Computers, 4th Edition
Symbolic Instruction and Addressing
X86’s instruction sets.
Chapter 4: Instructions
Data Transfers, Addressing, and Arithmetic
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
תכנות בסיסי בשפת סף פרק 5 מצגת 3.
Symbolic Instruction and Addressing
University of Gujrat Department of Computer Science
Assembler Directives end label end of program, label is entry point
Computer Architecture and System Programming Laboratory
Chapter 6 –Symbolic Instruction and Addressing
Assembly Tools Assembler is a program that converts source-code program into a machine language AKA: object file Linker joins together two or more object.
Chapter 8: Instruction Set 8086 CPU Architecture
Introduction to 8086 Assembly Language
Part IV The FLAGS Register
Presentation transcript:

Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive

Irvine: Assembly Language for Intel-Based Computers (1999) prod = 10 * 5; Evaluates an expression maxInt = 7FFFh ; Maximum 16-bit signed value minInt = 8000h ; Minimum 16-bit signed value maxUInt = 0FFFFh; Maximum 16-bit unsigned value string = ‘XY’ ; Up to two characters allowed count = 500 endvalue = count + 1; Can use a predefined symbol.386 maxLong = 7FFFFFFFh; Maximum 32-bit signed value minLong = h; Minimum 32-bit signed value maxULong = 0FFFFFFFFh; Maximum 32-bit unsigned value Equal-Sign Directive

Irvine: Assembly Language for Intel-Based Computers (1999) Using the Equal-Sign Directive

Irvine: Assembly Language for Intel-Based Computers (1999) Data Transfer Instructions INC DEC MOV Operands with Displacements XCHG Instruction

Irvine: Assembly Language for Intel-Based Computers (1999) Exchanging Two Variables title Exchange Two Variables (Exchange.asm).model small.stack 100h.data value1 db 0Ah value2 db 14h.code main proc mov ; initialize DS register mov ds,ax mov al,value1 ; load the AL register xchg value2,al ; exchange AL and value2 mov value1,al ; store AL back into value1 mov ax,4C00h ; exit program int 21h main endp end main

Irvine: Assembly Language for Intel-Based Computers (1999) Arithmetic Instructions INC and DEC ADD SUB Flags affected by ADD and SUB

Irvine: Assembly Language for Intel-Based Computers (1999) INC and DEC INC –adds 1 to destination operand DEC –subtracts 1 from destination operand (both) –operand can be either a register or variable –Carry flag not affected

Irvine: Assembly Language for Intel-Based Computers (1999) INC and DEC Examples.data membyte db 25 memword dw 36 doubleVal dd h.code inc al dec bx inc eax inc membyte inc memword dec doubleVal

Irvine: Assembly Language for Intel-Based Computers (1999) ADD Instruction ADD destination, source Adds source operand to destination operand Affects the Carry, Overflow, Sign and Zero flags source operand can be register, immediate value, or memory destination operand can be register or memory only one operand can be a memory operand

Irvine: Assembly Language for Intel-Based Computers (1999) ADD Instruction Examples.data membyte db 25 memword dw 36 doubleVal dd h.code add al,5 add bx,ax add eax,edx add membyte,al add memword,bx add doubleVal,edx

Irvine: Assembly Language for Intel-Based Computers (1999) SUB Instruction SUB destination, source Subtracts source operand from destination operand Affects the Carry, Overflow, Sign and Zero flags source operand can be register, immediate value, or memory destination operand can be register or memory only one operand can be a memory operand

Irvine: Assembly Language for Intel-Based Computers (1999) SUB Instruction Examples.data membyte db 25 memword dw 36 doubleVal dd h.code sub al,5 sub bx,ax sub eax,edx sub membyte,al sub memword,bx sub doubleVal,edx

Irvine: Assembly Language for Intel-Based Computers (1999) Flags Affected by ADD and SUB After the instruction has executed,... If the destination is zero, the Zero flag is set If the destination is negative, the Sign flag is set If there was a carry out of the highest bit of the destination, the Carry flag is set If the signed result is too small or too large to fit in the destination, the Overflow flag is set

Irvine: Assembly Language for Intel-Based Computers (1999) Signed Overflow Signed overflow occurs when adding two signed integers, if and only if... –both operands are positive, or both operands are negative –and the sign of the sum is opposite to the sign of the values being added mov al,+127 add al,+1 ; AL = 80h (-128), Overflow

Irvine: Assembly Language for Intel-Based Computers (1999) Signed Overflow Examples mov al,+127 add al,+1 ; AL = 80h (-128), Overflow mov dx, ; DX = 8000h (-32768) add dx,-1 ; DX = 8001h, Overflow mov dx, ; DX = 8000h (-32768) sub dx,1 ; DX = 8001h, Overflow

Irvine: Assembly Language for Intel-Based Computers (1999) Basic Operand Types