Posts

Showing posts from October, 2017

Macros and Macro Processors

A   Macro  is a unit of specification for program generation through expansion (like a function). Macro consists of a name, a set of formal parameters and a body of code. When a macro is called the using the macro name with the set of actual parameters then the name with the parameters is replaced by the code generated from its body. This process is called macro expansion. Two types of Macro Expansion 1. Lexical expansion. 2. Semantic expansion. Lexical Expansion It is the process of replacing one character string with another character string during program generation.( actual parameters in place of formal parameters). Semantic Expansion In simple words, semantic expansion implies generation of instructions tailored to the requirements of a specific usage. Macro Definition and Call A macro definition starts with a reserved keyword MACRO and ends with a keyword MEND. The statements enclosed in between these keywords include macro definition and its body.

Assemblers

Elements of Assembly Language Programming An assembly language is a machine dependent, low-level programming language. It provides three basic features. 1. Mnemonic operation codes: Use of mnemonic operation codes eliminates the need of memorizing the numeric operation codes. And also helps in troubleshooting. 2. Symbolic operands: Symbolic names can be associated with data or instructions. which in a simple word means, that you can keep some meaningful names to the variables or an instruction. 3. Data declarations: Data can be declared in variety of notations ( eg:  10, 10.345, 10,00.121, 0.091 etc). A Simple assembly language statement(stmt): [label] <opcode>   <operand spec>[,<op spec>...] Opcodes and their alternative mnemonic code. instruction                                    assembly   opcode                                       mnemonic    00                                               STOP    01