RTC6 boards
Doc. Rev. 1.0.21 en-US
6 Developing RTC6-User Programs
115
Index Management and Defragmentation
Index Management
To duplicate, renumber or convert indexed
subroutines, copy_dst_src is provided.
By copy_dst_src, an indexed subroutine is indexed
one more time. copy_dst_src only alters the
corresponding entries in the internal management
table and does not modify the RTC6 List Memory
content.
No longer needed indices (unneeded entries in the
internal management table) can be deleted by
load_sub directly followed by a list_return. Here,
too, deletion occurs only in the internal management
table, while the list commands of the previously
indexed subroutine continue to reside in the
RTC6 List Memory.
get_sub_pointer can be used to query whether a
subroutine for a particular index exists. If no
subroutine exists, get_sub_pointer returns a “–1”
value (that is, 2
32
–1).
A true duplicate of an indexed subroutine in the
protected RTC6 List Memory area “List 3” can be
created (after copy_dst_src) with
save_disk/load_disk. Subroutines with multiple
indices are thereby written several times to the
RTC6 List Memory. Keep this in mind in order to
prevent unintended memory overflow of the
protected RTC6 List Memory area “List 3”.
load_sub always enters a new indexed subroutine
after the indexed subroutine with the highest
memory address. Therefore, subroutines that are no
longer required and are located in the protected
RTC6 List Memory area “List 3” may block memory
positions for further indexed subroutines.
For this reason, simply increasing the size of the
protected RTC6 List Memory “List 3” by config_list
fails to produce further usable memory for storing
additional indexed subroutines (the protected
RTC6 List Memory area “List 3” can only be expanded
downward, not upward).
Defragmentation
This situation can be resolved by defragmenting with
save_disk/load_disk.
Thereby, all indexed subroutines and (by
set_sub_pointer) subsequently indexed subroutines
are rewritten to the protected RTC6 List Memory area
“List 3” (in index sequence, starting at the lowest
memory position of the protected RTC6 List Memory
area “List 3”).
The now-available upper memory positions can then
be used for storing additional indexed subroutines.
Notes
• Before calling load_disk, be sure the protected
RTC6 List Memory area “List 3” is of sufficient size
after configuration of “List 1” and “List 2”.
Indexed subroutines without sufficient space
there are not stored by load_disk. save_disk
returns the number of stored lis
t commands. No-
longer-needed subroutines should previously
deleted from the index management by a
load_sub which is directly followed by a
list_return.
• In some circumstances, index management or
defragmentation can alter the absolute memory
address of an indexed subroutine. It is therefore
not advisable to call an indexed subroutine by
list_call.
• save_disk stores subroutines starting from the
start address to the first-encountered list_return.
Relative jumps are not evaluated. So do not use
branches to several list_return. Instead, reclose
eventual branches prior to one single list_return.