Download presentation
Presentation is loading. Please wait.
Published byJob King Modified over 9 years ago
1
PART I SISTEM UTILITIES LECTURE 5 MACROPROCESSING Ştefan Stăncescu 1
2
MACROPROCESSING 2 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 andmacro development at macro call
3
MACROPROCESSING 3 macro definition is a program line with the macroinstruction name + the generic list of operands (parameters) and all instruction list lines (macro body). macro call is a program line w/macroinstruction name + current formal parameter list macro development is theapel macro call replacement with macro body
4
MACROPROCESSING 4 Macro definition: MACRO add_a_squaresum, square moverega,number mulrega,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 5... sum=0 C add_a_square sum,no1 moverega,no1 mulrega,rega add sum,rega C add_a_square sum,no2 moverega,no2 mulrega,rega add sum,rega C add_a_square sum,no3 moverega,no3 mulrega,rega add sum,rega C add_a_square sum,no4 moverega,no4 mulrega,rega add sum,rega...
6
MACROPROCESSING 6 PROCEDURES add_a_square : moverega,number mulrega,rega add sum,rega ret w/procedures:... move sum,0 move number,no1 calladd_a_square move number,no2 calladd_a_square move number,no3 calladd_a_square move number,no4 calladd_a_square...
7
MACROPROCESSING 7 MACROirpparameter, corp_irp ENDMACRO... sum=0 irpnumber, moverega,number mulrega,rega add sum,rega ENDMACRO... Or with macro nesting:... sum=0 irpnumber, add_a_square sum,number ENDMACRO...
8
MACROPROCESSING 8 With iterated procedures... move sum,0 movei,N loop:move number,n(i) calladd_a_square dcri jmpnzi,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 9 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 10
11
MACROPROCESSOR 11 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 12 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.comhttp://www.microsoft.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.