RTC
®
5 PC Interface Board
Rev. 1.9 e
6 Developing User Applications
77
Indexed subroutines are written to “List 3” via the
load_sub command in order of entry. The smallest
possible starting address is thereby automatically
determined, in accordance with already registered
indexed subroutines (and character sets). If an
indexed subroutine is stored using an already-
existing index, then the prior subroutine with that
same index will not be overwritten, and remains in
the protected buffer area (“List 3”), though it can
then no longer be accessed through its index via
sub_call (but can still be called through its absolute
memory address).
Use get_sub_pointer to query whether a subroutine
is referenced via a particular index. If no subroutine is
referenced, the return value will be “–1” (i.e. 2
32
–1).
To load an indexed subroutine into a protected buffer
area that is already fully loaded with indexed subrou-
tines, you must first appropriately expand the
protected buffer area’s size with config_list and then
defragment it with save_disk/load_disk (expanding
the size alone is not sufficient; see page 79).
Observe the following guidelines when programming
indexed subroutines:
• In an indexed subroutine, the set_end_of_list
command will be replaced with a list_nop
command.
• Absolute jumps within or out from the protected
buffer area (“List 3”) will be ignored during
execution (see "Jumps", page 81). Therefore,
absolute jumps cannot be used in indexed
subroutines.
• Relative jumps that exceed the boundaries of an
indexed subroutine and a jump command which
initiates a jump on the command itself will be
ignored during execution, too.
Calling Subroutines
Subroutines are not started directly, but instead via a
list command within a list or from a subroutine.
Nested calls up to a maximum depth of 63 are also
possible.
“Normal” Calls
As previously described, non-indexed subroutines
can be called via the list_call command and a
parameter specifying the absolute memory address.
Indexed subroutines can be called either via the
sub_call command along with the index or via the
list_call command along with the absolute memory
address.
Notes
• Index management or defragmentation (see
page 79) can result in a change of the indexed
subroutine’s absolute memory address.
Therefore, SCANLAB recommends not calling
indexed subroutines via the list_call command.
“Ab sC al ls ”
With the RTC
®
5’s predecessor boards, subroutines
could only use relative vector and arc commands (see
page 93) if the corresponding processes were
intended to be repeated in different parts of the
image field.
Thanks to “AbsCalls”, the RTC
®
5 has removed this
restriction. “AbsCalls” pass on the current position in
the form of an offset that is usable for subsequent
execution of absolute vector and arc commands in
the subroutine. Nested calls are taken into account
when the offset is determined. This can be used, for
instance, to define character sets via absolute vectors.
“AbsCalls” from subroutines can be made with the
commands list_call_abs and sub_call_abs.
Conditional Calls
To enable calling of subroutines (“normal” calls and
“AbsCalls”) dependent on external control signals,
additional commands are available for conditional
branching during program execution (see "Condi-
tional Command Execution", page 213).