Assembler

Assembler unit processes assembly instructions in the Asm-end block and generates code for them.

This procedure processes one assembler instruction. It resets data used for instruction processing, reads next assembler token, checks for label and processes prefix instructions (if present). Then it checks and processes assembler directive (DB, DW or DD) or assembler instruction parameters. Finally it generates intermediate code for assembler instruction.

This procedure scans assembler instruction and returns the next assembler token.

This function checks if identifier in instruction is valid and returns its data. Identifier can be a local lable starting with the @ sign or any other declared Turbo Pascal identifier.

Assembler expressions (instruction parameters) are processed similarly to Pascal expressions. The expression is divided into smaller parts according to the operator precedence. For assembler expressions Turbo Pascal uses few data structures and procedures. TAsmExpression contains fields that hold data for each expression (instruction parameter).

This function checks and processes assembler directives DB, DW and DD. More then one byte, word or double word can be separated by comma.

Assembler instructions (in fact mnemonics) are stored in a symbol table where each instruction has few data bytes which define which procedure will process it and what combinations of parameters are possible.

This procedure generates intermediate code from opcodes and references generated for current assembler instruction.