Nested Folder Functions


HOW WORK NESTED FOLDERS

The Api92 library provides powerful functions for manipulating arrays. The only restriction is that items of the array must have the same size.
The array is saved in memory exactly as a VAT (variable allocation table) :

00.w : Number of items before resizing
02.w : Actual number of items
(…) : items

However, the Api92 library offers each time three versions of its functions about arrays.

  • The standard functions : array_Create, array_AddItem, array_DeleteItem, …
  • The ArrayInFiles functions : array_fCreate, array_fAddItem, array_fDeleteItem …
    It allows the program to create an array inside an existing file on the calculator. The main use of these functions is to save arrays in a valid file for the TIOS. ( for saving high scores for example, or passwords … )
  • The ArrayInHandle functions : Array_oCreate, array_oAddItem, array_oDeleteItem …
    This time you will use these functions to create an array into a existing handle.

 

 

CREATE AN ARRAY


Api92::array_Create

The Api92::array_Create function creates an array, allocating a new buffer.

  • Parameters :
    D1.w : Constant size for each item of the array
  • Return Values :
    D0.l : 0 if failure. Else handle of created array
    No other register modified

Api92::array_fCreate

The Api92::array_fCreate function creates a array inside an existing file.
  • Parameters :
    D0.w : Handle of the file
    D1.w : Constant size for each item of the array
    D2.w : Offset where to insert the array
  • Return Values :
    D0.l : 0 if failure. Else handle of created array
    No other register modified

Api92::array_oCreate

The Api92::array_oCreate function create a new array.
  • Parameters :
    D0.w : Handle of existing buffer
    D1.w : Constant size for each item of the array
    D2.w : Offset where to insert the array
    D3.w : Current size of the buffer
  • Return Values :
    D0.l : 0 if failure. Else handle of created array
    D3.l : New size of the buffer
    No other register modified

 

ADD AN ITEM TO THE ARRAY


Api92::array_AddItem

The api92::array_AddItem function adds an item to an array created by api92::array_Create

  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.l : 0 if it failed. Else handle of buffer
    D1.w : Error Code
    A1.l : Address of created item entry
    No other register modified

Api92::array_fAddItem

The api92::array_fAddItem function adds an item to an array created by api92::array_fCreate

  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.l : 0 if it failed. Else handle of buffer
    D1.w : Error Code
    A1.l : Address of created item entry
    No other register modified

Api92::array_oAddItem

The api92::array_oAddItem function adds an item to an array created by api92::array_oCreate

  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file
    D3.w : Size of the buffer
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.l : 0 if it failed. Else handle of buffer
    D1.w : Error Code
    D3.l : New size of the buffer
    A1.l : Address of created item entry
    No other register modified


DELETE AN ITEM FROM THE ARRAY


Api92::array_DeleteItem

The Api92::array_DeleteItem function deletes an item from an array created by api92::array_Create.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : 0-based index of the item to delete
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    No other register modified

Api92::array_fDeleteItem

The Api92::array_fDeleteItem function deletes an item from an array created by api92::array_fCreate.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file
    D3.w : 0-based index of the item to delete
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    No other register modified

Api92::array_oDeleteItem

The Api92::array_oDeleteItem function deletes an item from an array created by api92::array_oCreate.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file
    D3.w : Size of the buffer
    D4.w : 0-based index of the item to delete
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    D3.w : New size of the buffer
    No other register modified

 

INSERT AN ITEM TO THE ARRAY


Api92::array_InsertItem

The Api92::array_InsertItem function inserts an item in an array created by api92::array_Create.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : 0-based index where to insert item
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    A1.l : Address of created item entry
    No other register modified

Api92::array_fInsertItem

The Api92::array_fInsertItem function inserts an item in an array created by api92::array_fCreate.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the buffer
    D3.w : 0-based index where to insert item
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    A1.l : Address of created item entry
    No other register modified

Api92::array_oInsertItem

The Api92::array_oInsertItem function inserts an item in an array created by api92::array_oCreate.
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file
    D3.w : Size of the buffer
    D4.w : 0-based index where to insert item
    A0.l : Address of the item data that should be added.
  • Return Values :
    D0.w : 0 if it failed. Else handle of the buffer
    D1.w : Error Code
    D3.w : New size of the buffer
    A1.l : Address of created item entry
    No other register modified

 

SORT FUNCTIONS



Api92::array_BubbleShort

The Api92::array_BubbleShort function is used to short an array. It is not a very fast way to short the array, that's why there should be soonly a quickshort function
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    A0.l : Address of an api92CB_arrayBBShort function
  • Return Values :
    No register modified


Format of the api92CB_BBShort function :

  • Parameters
    A0.l : Address of first item
    A1.l : Address of second item
  • Return Value
    D0.w : d0.w=0 if require to swap items. Else don't swap

Api92::array_oBubbleShort

The Api92::array_oBubbleShort function is used to short an array created in a file/buffer. It is not a very fast way to short the array, that's why there should be soonly a quickshort function
  • Parameters :
    D0.w : Handle of the array
    D1.w : Constant size for each item of the array
    D2.w : Offset of the array in the file/buffer
    A0.l : Address of an api92CB_arrayBBShort function
  • Return Values :
    No register modified


Format of the api92CB_BBShort function :

  • Parameters
    A0.l : Address of first item
    A1.l : Address of second item
  • Return Value
    D0.w : d0.w=0 if require to swap items. Else don't swap