1 / 12

PART I SISTEM UTILITIES

Ştefan Stăncescu. PART I SISTEM UTILITIES. LECTURE 5 MACROPROCESSING. MACROPROCESSING. Macroinstruc tion => new instriction for easy use of frequent instructions lists . M acroproce s so r => program that ease macroinstructions definition and macroinstructions mean of use

turnerg
Download Presentation

PART I SISTEM UTILITIES

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. Ştefan Stăncescu PART ISISTEM UTILITIES LECTURE 5 MACROPROCESSING

  2. MACROPROCESSING • Macroinstruction=> new instriction for • easy use of frequent instructions lists. • Macroprocessor => program that ease • macroinstructions definition and • macroinstructions mean of use • Macroprocessor first functionalities • macro definition, macro call • and macro development at macro call

  3. MACROPROCESSING • macro definitionis • a program line with the macroinstruction name + • the generic list of operands (parameters) • and all instruction listlines (macro body). • macro call is • a program line w/macroinstruction name + current formal parameter list • macro development is • the apel macro call replacement with • macro body

  4. MACROPROCESSING • Macro definition:  • MACRO add_a_square sum, square • move rega,number • mul rega,rega • add sum,rega • ENDMACRO • Macro call: • ... • sum=0 • add_a_square sum,no1 • add_a_square sum,no2 • add_a_square sum,no3 • add_a_square sum,no4 • ...

  5. MACROPROCESSING • ... • sum=0 • C add_a_square sum,no1 • move rega,no1 • mul rega,rega • add sum,rega • C add_a_square sum,no2 • move rega,no2 • mul rega,rega • add sum,rega • C add_a_square sum,no3 • move rega,no3 • mul rega,rega • add sum,rega • C add_a_squaresum,no4 • move rega,no4 • mul rega,rega • add sum,rega • ...

  6. MACROPROCESSING • PROCEDURES • add_a_square : • move rega,number • mul rega,rega • add sum,rega • ret • w/procedures: • ... • move sum,0 • move number,no1 • call add_a_square • move number,no2 • call add_a_square • move number,no3 • call add_a_square • move number,no4 • call add_a_square • ...

  7. MACROPROCESSING • MACRO irp parameter,<parameter list> • corp_irp • ENDMACRO •  ... • sum=0 • irp number,<no1,no2,no3,no4> • move rega,number • mul rega,rega • add sum,rega • ENDMACRO • ... • Or with macro nesting: • ... • sum=0 • irp number,<no1,no2,no3,no4> • add_a_square sum,number • ENDMACRO • ...

  8. MACROPROCESSING • With iterated procedures • ... • move sum,0 • move i,N • loop: move number,n(i) • call add_a_square • dcr i • jmpnz i,loop • ... • CONCLUSIONS: • Procedures: easy programming, short code, length invariable with n - number of calls, time consuming call/ret. • Macro: no jumps in memory space, less processing time, much more memory space, no acceptable in loops

  9. MACROPROCESSOR • DEFTAB, define table, a macro list, for each with • macro call template line prototype + • + macro body + • + with list of generic parameters replaced with order no. • NAMTAB, name table with • call macro name + DEFTAB definition address • ARGTAB, argument(formal parameter) table • temporary memory argument stack • written at macro call • read in macro development

  10. MACROPROCESSOR

  11. MACROPROCESSOR • ARGTAB: • ... • adaugă_un_pătrat suma,nr1 • adaugă_un_pătrat suma,nr2 • adaugă_un_pătrat suma,nr3 • adaugă_un_pătrat suma,nr4 • ...

  12. MACROPROCESSOR • 1.L.L. Beck, “System Software: An introduction to systems programming”, Addison Wesley. 3’rd edition, 1997. • 2.John R. Levine, "Linkers and Loaders", Morgan Kauffman, 2000 • 3.*** MASM 8.0 http://www.microsoft.com

More Related