What is macro instructions?

Makra instruction in computer programming is the only instructions that, when the program is assembled, is replaced by a predefined code block. The term was originally applied to the instructions used in the programming of the compilation language, in which the long recurring code was sometimes needed for very simple operations. The development of macro instructions was one of the first steps to create a language based on a library of representative functions, so small events could be collected together under a single command call in a separate program. Early macro libraries were most often supplied by hardware and software manufacturers to help programmers to use and access functions correctly.ULD is able to use the same macro instruction. In the compilation language, each step must be explicitly written to achieve a certain outcome. An example could be a program that added three numbers together.

Operator PHigher -level drivers are often taken for granted, but the operation of three numbers to the assembly requires at least six separate lines of code. The first two lines load numbers into fields called registers that actually correspond to physical circuits inside the computer. The third line adds two registers and the fourth line stores the result in another register. The fifth line loads the last number to be added to the register and the final statement adds the previous result to the third number.

This sequence of operations can be easily transformed into macro instructions, so only one line of code is needed, along with the Thčísla Ree, which are to be added as parameters. When the program is finally assembled by an assembler and converted into a machine code, actions were accepted by pre -processing before the assembly. The pre -processor takes the macro instructions and parameters and extends them to the required rows of the code and replaces the parameters with representative surrogate symbols inside the actual macro code.

afterThe use of the use of macro instruction would be built many commonly used code blocks into the MAKRO instructions libraries. These libraries contained several macro that help simplify programming in the compilation language and ensure that certain operations are performed in a consistent way across different programs. The extensive use of MAKRO libraries eventually led to higher level languages ​​that relied on their own libraries to provide extensive functions with much less recurring programming requirements.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?