|
|||||||||||
|
Technical Support On-Line Manuals A251 User's Guide |
A251 User's GuideProgram AddressesProgram addresses are absolute or relocatable expressions with the memory class CODE or ECODE. Typically, program addresses are used in jump and call instructions. For indirect jumps or calls, it is required to load a program address in a register or a jump table. The following jumps and calls are possible:
Example for all 251 Variants
EXTRN CODE (my_function)
CSEG AT 3
JMP ext_int ; an interrupt vector
?PR?myintr SEGMENT CODE ; define a segment for program code
RSEG ?PR?myintr
ext_int: JB FLAG,flag_OK
INC my_var
flag_OK: CPL FLAG
RETI
?PR?myprog SEGMENT CODE INBLOCK ; a segment within a 2K block
RSEG ?PR?myprog
func1: CALL sub_func ; will generate ACALL
loop: CALL my_function ; external function -> LCALL
MOV A,my_var
JNZ loop
RET
sub_func: CLR FLAG
MOV R0,#20
loop1: CALL my_function
DJNZ R0,loop1
RET
| ||||||||||
|
|||||||||||