Programmers accustomed to the conditional return instructions of
the 8080/Z80 will appreciate the following feature: A86 allows
the operand to a conditional jump instruction to be one of the
three RET instructions RET, RETF, or IRET. The assembler will
find a nearby return instruction of the indicated flavor, and use
that as the target for the conditional jump. For example, JZ RET
is the replacement for the 8080's RZ return-if-zero instruction.
In other 8086 assembly languages, you have to find the nearby
instruction yourself, attach a label to it, and use that label.
Note that it does not suffice to attach a label to a single RET
instruction and use that label throughout the program: the range
of conditional jumps is only 128 bytes in either direction.
What happens if A86 does not find a nearby return instruction? In
that case, A86 issues an error, "02 Jump > 128", for the next
matching return instruction in the program. If there is no
subsequent return instruction, the return mnemonic will appear as
an undefined symbol at the end of the program. In either case,
you correct the problem by inserting a free-standing return
instruction at some nearby point in the program, where it will
not affect the existing code (typically following an
unconditional JMP instruction). If there is no good place to
insert a return instruction, you can always replace the "Jcond
RET" with an "IF cond RET".
You might be also interested in:
:: Assembly Language Programs for Addition and Subtraction
:: Assembly Language Programs on array of Hexadecimal numbers
:: Assembly Language Programs on string
No comments:
Post a Comment