83Plus:Software:usb8x/BASIC Interface/ExportVariable

From WikiTI
Revision as of 13:23, 17 August 2006 by Brandonw (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

Name: ExportVariable

Function Number: 9

Minimum usb8x version: 0.10

Exports variable from RAM or Flash to specified directory as *.8x* file.

Inputs

  • 2: String variable to use (Str1-0)

Outputs

  • 1: Error code (0 = success)

Notes

Be sure to initialize the mass storage driver with [[../MSDInit|MSDInit]] before calling this entry point.

This entry point will fail if a *.8x* file of the same name is already in the specified directory.

You have your choice of Str1-Str0 to use with this function. Pass this number as the second element in Ans. The string is formatted as follows:

"/FOLDER1/FOLDER2/GAME.8XP"

The variable to export starts the string. It is the token for the variable you want to transfer. This means you must select this variable from a menu instead of typing it yourself (for example, selecting "Str9" from the VARS menu, not typing 'S', 't', 'r', '9'). A colon follows this, and finally the path to export the variable to.

For example, to send matrix A to the root directory, use the following for the string:

"[A]:/"

The "[A]" was selected from the [2nd]+[MATRX] menu.

To send prgmGAME to the "test" directory, use the following for the string:

"prgmGAME:/test"

To send a REAL variable or AppVar, simply enter the string. If a REAL variable and AppVar have the same name, it will send the REAL variable. To send AppVar ABC to the root directory:

"ABC:/"

Example

The following code will export ZTETRIS to the root directory:

OpenLib(USBDRV8X
{7
ExecLib ;initialize mass storage driver
"prgmZTETRIS:/->Str1
{9,1
ExecLib ;export variable in Str1

See Also

[[../MSDInit|MSDInit]] - Initialize the mass storage driver