Difference between revisions of "83Plus:Software:usb8x/Asm Interface/MSD/MSD ImportVariable"

From WikiTI
Jump to: navigation, search
(flags a->b)
 
Line 8: Line 8:
 
=== Inputs ===
 
=== Inputs ===
 
* HL points to an ASCIIZ string of *.8x* file (path included)
 
* HL points to an ASCIIZ string of *.8x* file (path included)
* A is flags byte
+
* B is flags byte
 
{| border="1" cellpadding="2"  cellspacing="0"  
 
{| border="1" cellpadding="2"  cellspacing="0"  
 
|-
 
|-
Line 28: Line 28:
 
<code>
 
<code>
 
  ld hl,sFilename
 
  ld hl,sFilename
  xor a ;do not overwrite existing variable and create in RAM
+
  ld b,0 ;do not overwrite existing variable and create in RAM
 
  U_CALL MSD_ImportVariable
 
  U_CALL MSD_ImportVariable
 
  ...
 
  ...

Latest revision as of 18:19, 9 September 2006

Synopsis

Name: MSD_ImportVariable

Minimum usb8x version: 0.10

Imports *.8x* file from specified directory and stores in RAM/Flash.

Inputs

  • HL points to an ASCIIZ string of *.8x* file (path included)
  • B is flags byte
Bit 0 Set if existing variable should be deleted if duplicate is found
Bit 1 Set if variable should be created in Flash; reset if in RAM

Outputs

  • Variable is created in RAM or Flash
  • C set if problems
  • Returns C set if duplicate variable was found

Destroys

  • AF, BC, DE, HL

Notes

Example code to import "game.8xp" in the root directory to RAM:

ld hl,sFilename
ld b,0 ;do not overwrite existing variable and create in RAM
U_CALL MSD_ImportVariable
...
sFilename: DB "/game.8xp",0

If you are writing an application, you must copy the strings you use to RAM first, or else usb8x will not be able to see them.

See Also

  • [[../MSD_ExportVariable|MSD_ExportVariable]] - Export variable in RAM/Flash to specified directory as *.8x* file