The assembler, when fed the above program, will generate the correct code. The statement ORG 0100H in the above program is not a machine code instruction. It is an instruction to the assembler , which instructs the assembler to generate the code to run at the designated origin address. Instructions to assemblers are called pseudo-ops . The assembler does not generate any machine code instructions for pseudo-ops or comments.
Assemblers scan the source program, generating machine instructions.
Sometimes, the assembler reaches a reference to a variable which has not yet been defined. This is referred to as a forward reference problem. The assembler can tackle this problem in a number of ways. On the first pass, the assembler simply reads the source file, counting up the number of locations that each instruction will take, and builds a symbol table in memory which lists all the defined variables cross-referenced to their associated memory address. On the second pass, the assembler substitutes opcodes for the mnemonics, and variable names are replaced by the memory locations obtained from the symbol table.