AMX Circular List Manager
K
A
DAK
135
11. AMX Circular List Manager11.1 Circular ListsThe AMX Circular List Manager provides a general circular list facility for use by
application program modules.
Circular lists must be located in alterable memory (RAM).
A circular list is a data structure used by an application to maintain an ordered list of
8-bit, 16-bit or 32-bit elements. The elements are stored in slots in the list. Each list
contains a fixed, user defined number of slots.
The AMX Circular List Manager provides the following list manipulation procedures:
ajrstl AARSTL Reset (initialize) a circular list
ajabl AAABL Add to bottom of circular list
ajatl AAATL Add to top of circular list
ajrbl AARBL Remove from bottom of circular list
ajrtl AARTL Remove from top of circular list
The Circular List Manager procedures are reentrant permitting them to be shared by
concurrently executing tasks, ISPs and Timer Procedures.
Examples
Elements can be added to the top and removed from the bottom of a circular list. This
makes these lists particularly attractive for character buffering b y ISPs. Received
characters can be added to the bottom of the circular list and removed from the top. If the
process that removes a character decides that it cannot yet handle the character, it can
return the character to the top of the circular list.
16-bit lists are useful for handling both a character and its receiver status. When a
character is received, the character and its status are added to the bottom of a circular list.
The task processing received characters pulls a 16-bit element from the top of the circular
list to get each character and its status.
32-bit lists can be used to manage pointers to more complex structures. For instance, a
sawmill application might use two lists to keep track of log measurements and resulting
lumber counts in a Log Description Block, a private application structure. As logs are
measured, their dimensions are inserted into a Log Description Block. A pointer to the
block is added to the bottom of a circular list which serves as input to the cutting process.
This process removes a pointer to the next available Log Description Block from the top
of this list. Once the log is cut, the log's lumber results are added to the block and the
block pointer is added to the bottom of another circular list for lumber tally processing.