New/Old Assembler Directives Data Definition Statement syntax –[name] directive initializer [,initializer]… At least one initializer is required in a.

Slides:



Advertisements
Similar presentations
Introduction to Assembly Language
Advertisements

Sheet 1 Introduction to Computer Organization and Assembly Language.
BNF. What is BNF? BNF stands for “Backus-Naur Form,” after the people who invented it BNF is a metalanguage--a language used to describe another language.
Assembly Programming Notes for Practical2 Munaf Sheikh
1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
Memory Address Segment-offset address Base location (segment) + logical location (offset) Example: For 32-bits segment-offset address, 08F1:0100 represents.
ICS312 Set 6 Operands. Basic Operand Types (1) Register Operands. An operand that refers to a register. MOV AX, BX ; moves contents of register BX to.
Lecture 2 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
CPS4200 System Programming 2007 Spring 1 Systems Programming Chapter 2 Assembler I.
 Demonstrate use of a “for loop” in the design and development of a Java program to calculate the total of a one-dimensional array of 6 integers.  Design.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Symbolic Constants Equal-Sign Directive Calculating.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Intrinsic Data Types (1 of 2) BYTE, SBYTE 8-bit unsigned.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 3: Assembly Language Fundamentals (c) Pearson Education, All rights reserved.
1 Lecture 3: Assembly Language Fundamentals Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly Language for Intel-Based Computers Chapter 3: Assembly Language Fundamentals Kip Irvine.
Practical Session 2. Labels Definition valid characters in labels are: letters, numbers, _, $, ~,., and ? first character can be: letter, _, ? and.
Practical Session 2. Labels Definition valid characters in labels are: letters, numbers, _, $, ~,., and ? first character can be: letter, _, ? and.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#8) By Dr. Syed Noman.
Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras.
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
Lecture 6 Assembler Directives. 2  Code generation flow  Assembler directives—Introduction  Segment control  Generic segment (SEGMENT, RSEG)  Absolute.
Fundamentals of Assembly language
Sahar Mosleh California State University San MarcosPage 1 JMP and Loops Memory Operand Move Instruction Array Data Related Operation and Directives.
Chapter 3: Assembly Language Fundamentals
Assembly Fundamentals Computer Organization and Assembly Languages Yung-Yu Chuang 2005/10/13 with slides by Kip Irvine.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#7)
A Simple Two-Pass Assembler
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.
Assembly Language for x86 Processors 6th Edition Chapter 3: Assembly Language Fundamentals (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 3: Assembly Language Fundamentals (c) Pearson Education, All rights reserved.
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.
Introduction to 8086 Assembly Language Assembly Language Programming University of Akron Dr. Tim Margush.
Assemblers.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Multiplication and Division Instructions & the 0Ah function.
Overview of Assembly Language Chapter 4 S. Dandamudi.
1 Assemblers System Programming by Leland L. Beck Chapter 2.
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.
Introduction to Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
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.
Programming Fundamentals. Today’s Lecture Multidimensional Arrays Arrays as Class Member Data Arrays of Objects C-Strings.
Review of Assembly language. Recalling main concepts.
ICS 312 SET 10 Multiplication & Division & input using function 0Ah.
Data Structures Covers Chapter 5, pages 144 – 160 and Chapter 6, pages 198 – 203.
Lecture 2 Chapter 4 –Requirements for coding in Assembly Language 1.
Assembly Language for x86 Processors 6th Edition Chapter 3: Assembly Language Fundamentals (c) Pearson Education, All rights reserved. You may modify.
1 Chapter 3 Assembly Language Fundamentals Assembly Language for Intel-Based Computers, 4th edition Revised 3/11/05.
Assembly Language for x86 Processors 6th Edition
Format of Assembly language
Presentation on Real Mode Memory Addressing
Assembly Lab 3.
Data Transfers, Addressing, and Arithmetic
x86 Assembly Language Fundamentals
Symbol Definition—CODE, DATA, IDATA, XDATA
Assembly Language Ms. V.Anitha AP/CSE SCT
Assembler Directives Code generation flow
Microprocessor and Assembly Language
INTRODUCTION ABOUT ASSEMBLY
Assembly Language for Intel-Based Computers, 5th Edition
Defining Types of data expression Dn [name] expression Dn [name]
Lecture 6 Assembler Directives.
Symbolic Instruction and Addressing
Chapter 4 –Requirements for coding in Assembly Language
Chapter 4 –Requirements for coding in Assembly Language
Requirements for coding in Assembly Language
Assembler Directives end label end of program, label is entry point
Chapter 6 –Symbolic Instruction and Addressing
Introduction to Strings
Introduction to 8086 Assembly Language
Presentation transcript:

New/Old Assembler Directives

Data Definition Statement syntax –[name] directive initializer [,initializer]… At least one initializer is required in a data definition even if it is ? (does not assign a specific value) –The name is a label that marks the offset of a variable from the beginning of its enclosing segment.

Examples Var1BYTE35h;use h for hex Var2byte255;case not checked Var3db‘A’;old syntax Var4sbyte-128;signed byte Var5byte?;uninitialized

Defining Lists.data List byte 10, 20, 30, 40 List2 byte 10, 32, 41h, b List3byte 10, 20, 30, 40 byte50, 60, 70, 80 byte90, 100, 120

Defining Strings String1byte“This is a string”, 0 String2byte‘T’,’h’,’i’,’s’,‘i’,…. String3byte “This is a long string that” byte“that extends across many” byte“lines”, 0Dh, 0Ah,0 String4\ byte “Continuation character \ may be” byte“ used to concatenate two lines” byte“ into one.”,0

Using the DUP Operator Generates a repeated storage allocation, using a constant expression as a counter BYTE20 DUP(0) –Results in 20 bytes, all equal to 0 BYTE20 DUP(?) –Results in 20 bytes, uninitialized BYTE4DUP(“STACK”) –Results in 20 bytes “STACKSTACKSTACKSTACK”

Symbolic Constants Created by associating an identifier with either an integer value or some text. Does not reserve any storage. They are only used during assembly of a program, so they cannot change value during runtime.

Equal-Sign Directive Associates a symbol name with an integer value.code –COUNT = 500 –Mov al, COUNT.code –ESC_KEY = 27 –Moval, ESC_KEY.data –COUNT = 50 –Array COUNT DUP(0) Useful for constants. Easy to later change one line of code.

Calculating the Sizes of Strings and Arrays Use the current location counter ($). –List byte 10, 20,30, 40 –ListSize = ($ - list) The calculation must be done immediately following the list definiton –mystring byte “This is my string”,0 –String_len = ($ - mystring –1)

Calculating the Sizes of Strings and Arrays of Words and Doublewords ListWORD1000h, 2000h, 3000h Listsize = ($ - list) / 2 List DWORD h, h, DWORD h, h Listsize = ($ - list) / 4 This is important when using loops through arrays

Lists and Strings List1 db 10, ‘A’, 41h, 0Ah, b, 101q Listptr db List1 Cstring db “This is a string”,0 Clength = ($ - Cstring); sets Clength to length of Cstring Array1 db 20 dup(0); 20 bytes, all equal to zero Array2 db 4 dup(“ABC”); 12 bytes, “ABCABCABCABC”