 A macro represents a commonly used group of statements in the source programming language.  The macro processor replaces each macro instruction with.

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

COP 3402 Systems Programming
Macro simple idea of textual substitution useful when you need a group of instructions or directives frequently.
The Assembly Language Level
Macro Processor.
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
System Programming Mr. M. V. Nikum (B.E.I.T). Introduction What is System? System is the collection of various components Ex:- College is a system What.
Macro Processors (MP) Macro: Macro Processors (MP): Examples:
8.2 Characteristics of a High Level Programming Language
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
An introduction to systems programming
1 Chapter 4 Macro Processors Source Code (with macro) Macro Processor Expanded Code Compiler or Assembler obj.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Functions and Program Structure Chapter 4. Introduction Functions break large computing tasks into smaller ones Appropriate functions hide details of.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Chapter 4 Macro Processors
Describing Syntax and Semantics
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
Inline Function. 2 Expanded in a line when it is invoked Ie compiler replace the function call with function code To make a function inline the function.
1 Chapter 4 Macro Processors Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University 9/17/2009.
Macro & Function. Function consumes more time When a function is called, the copy of the arguments are passed to the parameters in the function. After.
Chapter 2 Software Tools and Assembly Language Syntax.
1 Chapter-01 Introduction to Computers and C++ Programming.
Course Introduction C++ An Introduction to Computing.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Debug and Assembler By, B.R.Chandavarkar Lect. COMP Department NITK, Surathkal.
Programming With C.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
5-1 Chapter 5 - Languages and the Machine Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer.
Assembly Language Macros Most assemblers include support for macros. The term macro refers to a word that stands for an entire group of instructions. Macro.
6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer.
An introduction to systems programming
Machine Independent Macro Processor Features Concatenation of Macro Parameters Generation of Unique Labels Conditional Macro Expansion Keyword Macro.
4. Macro Processors1 Chapter IV: Macro Processors Overview: r To study the design and implementation of macro processors. r A macro represents a commonly.
CSC425 - Introduction To Computer Programming 1. 2 Generation Of Programming Languages A set of rules that telling a computer what to do. There are over.
Objective At the conclusion of this chapter you will be able to:
Ass. Prof. Dr Masri Ayob TK 6123 Lecture 13: Assembly Language Level (Level 4)
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
ICS312 Set 14 MACROS. Macros The program structure is similar to that for procedures. As for procedure names, macro names represent a group of instructions.
Assembly Language for x86 Processors 7th Edition Chapter 13: High-Level Language Interface (c) Pearson Education, All rights reserved. You may modify.
Macro Processors.
Functions  A Function is a self contained block of one or more statements or a sub program which is designed for a particular task is called functions.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Chapter 12: Programming in the Large By: Suraya Alias 1-1.
CSCI-383 Object-Oriented Programming & Design Lecture 25.
Processor Fundamentals Assembly Language. Learning Objectives Show understanding of the relationship between assembly language and machine code, including.
Macro Processors Basic Functions Machine-Independent Features Design Options Implementation Examples.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
1 Chapter 4 Macro Processors. 2 Introduction A macro instruction (abbreviated to macro) is simply a notational convenience for the programmer. A macro.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 11–Macro-Processors.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
System is a set of interacting or interdependent components forming an integrated whole.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Macro Processor Design Options Recursive Macro Expansion General-Purpose Macro Processors Macro Processing within Language Translators.
CHAPTER NINE.
Programming what is C++
Addressing Modes in Microprocessors
Language Translation Compilation vs. interpretation.
System Programming and administration
MACRO Processors CSCI/CMPE 3334 David Egle.
Chapter 4 Macro Processors
C Preprocessor(CPP).
Processor Fundamentals
What Is? function predefined, programmer-defined
UNIT – IV MACRO PROCESSORS
CHAP 4 MACRO PROCESSORS.
Lecture 3 - Instruction Set - Al
Presentation transcript:

 A macro represents a commonly used group of statements in the source programming language.  The macro processor replaces each macro instruction with the corresponding group of source language statements. This is called expanding the macros.  Macro instructions allow the programmer to write a shorthand version of a program, and leave the mechanical details to be handled by the macro processor.

 The most common use of macro processors is in assembler language programming. However, macro processors can also be used with high-level programming languages, operating system command languages, etc.

 Macro Instruction : It is a notational convenience for the programmer. It allows the programmer to write shorthand version of a program (module programming).  Macro processor : The macro processor replaces each macro instruction with the corresponding group of source language statements (expanding). Normally, it performs no analysis of the text it handles. It does not concern the meaning of the involved statements during macro expansion.

 The design of a macro processor generally is machine independent.

 Two new assembler directives are used in macro definition:  MACRO: identify the beginning of a macro definition.  MEND: identify the end of a macro definition.

Each parameter begins with ‘&’ name MACRO parameters : body : MEND

 Body: the statements that will be generated as the expansion of the macro.

It is an abbreviation for a sequence of operations. E.g. A 1,DATA A 2,DATA A 3,DATA A 1,DATA A 2,DATA A 3,DATA DATA DC F’5’

 Start of definition > MACRO  Macro name > Name  Sequence to be abbreviated >  End of definition > MEND Macro pseudo-op is the first line of the definition and identifies the following line as a macro instruction name. Following the name line is the sequence of instructions being abbreviated. The definition is terminated by a line with the MEND pseudo-op.

 Process of replacement is called macro expansion. Definition is saved in the macro processor. The occurrence in the source program of the macro name, as an operation mnemonic to be expanded is called macro call.

 Macro Instruction Arguments : There is lack of facility as there is no way for a specific macro call to modify the coding that replaces it. An important extension of this facility consists of providing for arguments or parameters in macro calls. Corresponding macro dummy arguments will appear in macro definition.

E.g. A 1,DATA 1 A 2,DATA 1 A 3,DATA 1. A 1,DATA 2 A 2,DATA 2 A 3,DATA 2 DATA 1 DC F’5’ DATA 2 DC F’10’

 In this case instructions are very similar but not identical. They can be considered to perform the same operation with a variable parameter or argument. Such a parameter is called a macro instruction argument, or “dummy argument”, it is specified on the macro name line and distinguished by the ampersand (&), which is always its first character.

 Multiple Arguments : LOOP 1 A1,DATA 1 A2,DATA 2 A3,DATA 3 LOOP 2 A1,DATA 3 A2,DATA 2 A3,DATA 1 DATA 1 DC F’5’ DATA 2 DC F’10’ DATA 3 DC F’15’

 AIF and AGO permit the conditional reordering of the sequence of macro expansion.