Nested Folder Functions


HOW WORK NESTED FOLDERS


I tested three different methods to make nested folders on the ti-92/ti-92+/ti-89, and now I can saw that this method should be the best one.
It doesn't modify the VAT itself, so the method is 100% compatible with the TI-OS. (100%, not 99.9%) The idea is to create into the main folder the file 'nested'. This file contains the array that describes the nested folders tree.
Each entry of the array have the following format :

00.w : Parent Folder
02.w : Folder to make nested in the parent folder

There are as many as entry as there are nested folders in the calculator. Nothing more simple ! If you don't really understand how it works, don't worry, the api92 library provides functions to use them.

NESTED FOLDERS FUNCTIONS


 


api92::nf_CheckIfValid

The api92::nf_CheckIfValid function checks if all nested folders are valid, and corrects the nested folder buffer if not.

  • Parameters :
    Nothing
  • Return Values :
    No register modified

api92::nf_GetBufferAddr

The api92::nf_GetBufferAddr function get and returns the address of the buffer that describes nested folders.

  • Parameters :
    Nothing
  • Return Values :
    D0.w : 0 if buffer not found, else handle of buffer
    A1.l : Address of nested buffer
    No other register modified

api92::nf_AddFolder

The api92::nf_AddFolder function make a folder a nested folder, or make it a normal folder.

  • Parameters :
    D1.w : Handle of the parent folder
    D2.w : Handle of the nested folder
  • Return Values :
    D1.w : Error Code
    No other register modified

Notice that if the handle of the parent folder is the handle of the folder VAT, the nested folder will be a normal folder


api92::nf_IsFolderNested

The api92::nf_IsFolderNested function checks if a folder is nested or not.

  • Parameters :
    D1.w : Handle of a folder
  • Return Values :
    D0.w : 0 if the folder is not nested, else handle of parent folder
    No other register modified

api92::nf_IsParentOf

The api92::nf_IsParentOf function checks if a folder is a parent of an other folder. Notice that it will work even if the tree between the two folders is big.

  • Parameters :
    D0.w : Handle of the parent folder
    D1.w : Handle of a folder
  • Return Values :
    D0.w : 0 if no, else yes
    No other register modified

api92::nf_GetNestedCount

The api92::nf_GetNestedCount function gets the number of nested folders in a parent folder.

  • Parameters :
    D0.w : Handle of a folder
  • Return Values :
    D2.w : Number of nested folders that contain the folder.
    No other register modified

api92::nf_GetVatName

The api92::nf_GetVatName function gets the complete name of a var, with '\' between folders names, and '…' char if the directory is too long.
(ie : main\tmp\myfile ie : …ograms\games\simcity\map)

  • Parameters :
    D0.w : Handle of source folder
    D1.w : Length of the buffer (minimum : 10bytes)
    D2.w : 0-based index of the file in the source folder
    A0.l : Address of the buffer
  • Return Values :
    D1.w : Error code
    A0.l : Address of the beginning of the created string in the buffer
    No other register modified

See also : Example of use in : slctfil3.asm ; filecmp.asm


api92::nf_GetFolderName

The api92::nf_GetFolderName function gets the complete name of a folder, including nested folders.

  • Parameters :
    D0.w : Handle of source folder
    D1.w : Length of the buffer (minimum : 10bytes)
    A0.l : Address of the buffer
  • Return Values :
    D1.w : Error code
    A0.l : Address of the beginning of the created string in the buffer
    No other register modified

Api92::nf_GetFolderSize

The Api92::nf_GetFolderSize function gets the memory space used by a folder, including recursive call or not.

  • Parameters :
    D0.w : Handle of source folder
    D1.w : 0 = recursive call. Else no recursive call
  • Return Values :
    D2.l : Memory space used
    No other register modified


Api92::nf_DeleteFolder

The Api92::nf_DeleteFolder function deletes a folder, including ALL nested folders inside.

  • Parameters :
    D0.w : Handle of folder to delete
  • Return Values :
    D1.w : Error Code
    No other register modified