1 / 10

Chapter 5

Chapter 5. Macros and Macro Preprocessors. Other facilities for Expansion Time Loops. The REPT statement: REPT <expression> MACRO CONST10 LCL &M &M SET 1 REPT 10 DC ‘&M’ &M SET &M+1 ENDM MEND. The IRP statement: IRP < formal parameter >, < argument-list >

julian-mann
Download Presentation

Chapter 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5 Macros and Macro Preprocessors

  2. Other facilities for Expansion Time Loops • The REPT statement: REPT <expression> MACRO CONST10 LCL &M &M SET 1 REPT 10 DC ‘&M’ &M SET &M+1 ENDM MEND

  3. The IRP statement: IRP <formal parameter>, <argument-list> MACRO CONSTS &M, &N, &Z IRP &Z, &M, 7, &N DC ‘&Z’ ENDM MEND

  4. Design of a Macro Preprocessor • The macro preprocessor accepts an assembly program containing definitions and calls and translates it into an assembly program which calls and translates it into an assembly program which does not contain any macro definitions or calls. • A macro assembler is an assembler that performs macro expansion as well as assembly. • A macro preprocessor segregates macro expansion from the process of program assembly. • A macro preprocessor is economical as it uses an existing assembler but a macro assembler is more efficient as it performs macro expansion as well as assembly.

  5. Program with macro definitions and calls Macro Pre- processor Assembler Target Program A schematic of a macro preprocessor

  6. Design Overview • Identify the macro calls in the program. • Determine the values of formal parameters. • Maintain the values of expansion time variables declared in the macro. • Organize expansion time control flow. • Determine the values of sequencing symbols. • Perform expansion of a model statement. The following 4 step procedure is followed to arrive at a design specification for each task: • Identify the information necessary to perform a task. • Design a suitable data structure to record the information. • Determine the processing necessary to obtain the information. • Determine the processing necessary to perform the task.

  7. Data Structures

  8. Contd.

More Related