
- •1)Features of the Assembler. The main programs for work with the Assembler.
- •2) Data presentation in the computer. Binary and hexadecimal notations. Bits, bytes and words.
- •3)Main unprivileged commands. Data transfer.
- •4) Ways of addressing.
- •5) Dynamic libraries. Principles of using dynamic libraries.
- •6) Dynamic library structure.
- •7) File systems. Characteristics of files.
- •8) Numbers with a floating comma. Data types of fpu.
- •9) Work with the keyboard. The data buffer bios. Using ms dos function.
- •10) Base arithmetic fpu.
- •11)Comparison commands of fpu
- •12)Transcendental operations of fpu
- •Constants of fpu
- •16. Object modules.
- •17. Directive extern.
- •18) Directives call and invoke.
- •19) Use of libraries. Directive includelib.
- •20) Placement of data in external modules. Translation by tasm means.
- •21) Translation by masm means.
- •22) Directives of memory distribution. Pseudocommands of variable definitions.
- •23. Structures in the assembler
- •24. Program organization. Segments
- •25. Models of memory and the simplified directives of segment definition. Order of loading segments.
- •26. Procedures in the assembler
- •27. Programming bases in the Windows operating system
- •28. Call of the api functions from the program written on the assembler
- •29. Structure of the program written for Windows.
- •30. The general principles of creation of window applications in the Assembler
- •31. Directives of management of the program counter.
- •32. Global declarations.
- •33. Conditional assembling. Expressions
- •34. Attributes of the file. Temporary characteristics. File length.
- •35. File fat32 system. Catalogue structure. Fat table.
- •36. File ntfs system. Principles of construction.
- •37. Attributes of the records mft. Catalogues in ntfs.
- •38. Macrodefinitions. Blocks of repetitions. Macrooperators.
- •39. Management of files. Management of listing. Comments.
- •40) Virtual drivers and virtual Windows engines.
- •41) Modes of the user and kernel.
- •42) Types of Windows drivers.
- •44) Graphic video modes.
- •45) Work with a mouse.
- •46. System timer.
- •47. Services. Dispatcher of management of services.
- •49. Structure of the program which is writing down the driver in the system register.
- •50. Structure of the driver of the kernel mode.
- •1.Features of the Assembler. The main programs for work with the Assembler.
38. Macrodefinitions. Blocks of repetitions. Macrooperators.
A macro is a gro of repetitive instructions in a program which are codified only once and can be used as many times as necessary.
The main difference between a macro and a procedure is that in the macro the passage of parameters is possible and in the procedure it is not, this is only applicable for the TASM - there are other programming languages which do allow it. At the moment the macro is executed each parameter is substituted by the name or value specified at the time of the call.
We can say then that a procedure is an extension of a determined program, while the macro is a module with specific functions which can be used by different programs.
Another difference between a macro and a procedure is the way of calling each one, to call a procedure the use of a directive is required, on the other hand the call of macros is done as if it were an assembler instruction.
Syntax of a Macro
The parts which make a macro are:
Declaration of the macro Code of the macro Macro termination directive
The declaration of the macro is done the following way:
NameMacro MACRO [parameter1, parameter2...]
Even though we have the functionality of the parameters it is possible to create a macro which does not need them.
The directive for the termination of the macro is: ENDM
To use a macro it is only necessary to call it by its name, as if it were another assembler instruction, since directives are no longer necessary as in the case of the procedures.
Blocks repetitions
The simplest block repetitions REPT (not supported WASM) performs assembling portion of the program specified number of times. For example, if you want to create a byte array initialized values from 0 to 0FFh, this can be done by repeating the DB pseudo-command, as follows:
hexnumber = 0
hextable label byte; name of the array
rept 256, Block start
db hexnumber; These two lines are assembled
hexnumber = hexnumber +1; 256.
endm
Blocks of repetitions, as well as macros can be called with parameters. For this purpose, the directive IRP and IRPC:
irp parameter <value1, value2 ...>
...
endm
irpc parameter string
...
endm
Block described the directive IRP, will be called as many times as indicated in the list of values (in angle brackets), and each iteration will be determined by a label with the name of the parameter that is equal to the next value from the list. For example, the next block of repetitions will keep the stack registers AX, BX, CX and DX:
irp reg, <ax,bx,cx,dx>
push reg
endm
Directive IRPC (FORC in WASM) describes a block that is executed as many times as symbols the specified string, and each iteration will be determined by a label with the name of the parameter that is equal to the next character in the string. If the string contains spaces or other characters that are not allowed for the labels, it must be enclosed in angle brackets. For example, the next block is the string in memory, after placing each character in the string attribute 0Fh (white on black background), so that this line can then be copied directly into the video memory.
irpc character, <character string>
db '& character &', 0Fh
endm In this example, the ampersands that option instead of the character had been substituted its value even inside the quotation marks. Ampersand is one of the macro statement - the special operators that act only within the macro blocks and repetitions.
The macro statements or Macrooperators. The macro statements ampersand (&) is needed to ensure that the parameter that is passed as an operand of macro definitions or block repetitions, substitute value before processing line assembler. For example, the following macro will execute the command PUSH EAX, when called as PUSHREG A: pushreg macro letter push e & letter & x endm Sometimes it is possible to use only one ampersand at the beginning of the parameter if there is no ambiguity. For example, if the number is transmitted, and the need to create a set of variables with names ending this number: irp number, <1,2,3,4> number db? endm Macro statement <> (angle brackets) operates so that all the text in the parentheses is treated as a text string, even if it contains spaces or other separators. As we have seen, this macro statement is used to transfer text strings as parameters to the macro. Another frequent use of angle brackets - Transfer list of options embedded macro definitions or block repetitions. Macro statement! (Exclamation mark) is used similarly to the angle brackets, but only works in one the next character, so if that character is a comma - or angle bracket, it will still be sent as part of a macro parameter. Macro statement% (percentage) points out that being followed by the text of an expression and must be calculated. This is usually required in order to pass as a parameter to the macro not the expression itself, and its result.