83Plus:Software:usb8x/Asm Interface/MSD/MSD Initialize

From WikiTI
Jump to: navigation, search

Synopsis

Name: MSD_Initialize

Minimum usb8x version: 0.10

Initializes the USB mass storage device.

Inputs

  • HL points to a buffer for internal use (typically 254 bytes)
  • DE points to a sector buffer (typically 512 bytes)

Outputs

  • C set if problems

Destroys

  • AF, BC, DE, HL

Notes

The exact sizes of each memory buffer can be obtained with the [[../MSDVersion|MSDVersion]] entry point. They will conveniently fit in a 768-byte buffer such as appBackUpScreen. However, it can be allocated dynamically (in this example with appBackUpScreen) as follows:

U_CALL MSDVersion
ld de,appBackUpScreen
push de
add hl,de
ex de,hl
pop hl
U_CALL MSD_Initialize

There are many reasons why this call would fail. offErrorCode will contain a more detailed error code.