Using the VDrive or VMusic in your own projects
-----------------------------------------------

The VDrive or VMusic devices would make a great addition to a wide variety
of projects.

This library was prepared to work with a VMusic2 device, so from this point
onwards "VMusic2" will refer to both devices - apart from any music-related
functionality.

The device works over a serial interface. Connecting the device to the TI is
left as an exercise for the reader. ;) The PICAXE.BAS program is suitable
for use with a PICAXE-28X1 microcontroller (http://www.picaxe.co.uk/).

Function design
---------------

The various functions of the VMusic2 are split up into relevant modules. For
example, directory-related functions are in the VMusic2.Directory module.

The library will send command strings out via the TI's link port - and will
return instantly (ie, not waiting for a response). You are expected to call
VMusic2.Update frequently - this deciphers the input from the device and
raises events. You MUST have a label named VMusic2EventHandler outside the
VMusic2 module.

An example would be useful, no?

; --- ;

	call VMusic2.Initialise
	
MainLoop

	bcall(_GetCSC)
	cp skClear
	ret z
	
	call VMusic2.Update

	jr MainLoop

; Event handler
VMusic2EventHandler
	ret

; VMusic2 library
.include "VMusic2/VMusic2.asm"

; --- ;

The handler is called when data is received from the VMusic2 device. In some
cases this data will just be a simple response (a prompt or an error message
for example). In other cases it might be the response to an earlier request,
and in some cases you will receive multiple events!

VMusic2.Directory.GetListing, for example, will raise multiple events for
each new item found, and a prompt when finished.

When the event handler is called, hl points to the data received. d is type
of the response - 0 is general data, 1 is a prompt (OK), 2 is a bad command,
and 3 is a command failed. e relates to the id of the event that was called
originally.