Hardware Reference
In-Depth Information
Here, the symbol field is blank since the instruction does not form part of
the start of a block of code. The operation, MOV , is an opcode that instructs the
microprocessor to perform an operation which will move data from one location
to another. The operand required by the instruction specifies the lower half of
the 16-bit accumulator ( AL ) as the destination for the data and the contents of the
variable storage location maxcount as the source of the data. The programmer
has again added a brief comment to clarify the action of the line.
It should be noted that any line of source code starting with a semicolon is
ignored by the assembler and treated as a comment. This allows the programmer
to include longer comments as well as program or module headers which provide
lengthy information on the action of the statements that follow. Furthermore,
since the four fields in each source code statement are each separated by white
space it is not essential that they are precisely aligned in columns. However,
whereas the following lines of source text are perfectly legal:
start: MOV AH,05H ; Printer output function code
MOV DL,OAH ; First generate
INT 21H ; a line feed
MOV DL,00H ; Next generate
INT 21H ; a carriage return
MOV DL,41H ; First character to print is A
MOV CL,3EH ; Number of characters to print
MOV AH,05H ; Set up the function code
prch: INT 21H ; and print the character
INC DL ; Get the next character
LOOP prch ; and go round again
MOV AL,00H ; Set up the return code
MOV AH,4CH ; and the function code
INT 21H ; for an exit to DOS
they would be much more readable had they been entered in the strict format
shown below:
start: MOV
AH,05H ; Printer output function code
NOV
DL,OAH ; First generate a
INT
21H
; line feed
MOV
DL,00H ; Next generate a
INT
21H
; carriage return
MOV
DL,41H ; First character to print
MOV
CL,3EH ; Number of characters to print
NOV
AH,05H ; Set up the function code
prch: INT
21H
; and print the character
INC
DL
; Get the next character
LOOP prch
; and go round again
MOV
AL,00H ; Set up the return code
MOV
AH,4CH ; and the function code
INT
21H
; for an exit to DOS
Macro assemblers
A macro facility allows the programmer to write blocks of often-used code and
incorporate these in programs by referring to them by name. The blocks of code
are each defined as a macro. Thereafter, the macro assembler expands the macro
call by automatically assembling the block of instructions that it represents into
Search WWH ::




Custom Search