WonderSwan Total Sound Driver
Top

## Software development kit

### Using device of the WTD

- User application can not use the following device because WTD is using the following device.
  - Sound device.
  - Serial device. (Omit the "WTD_H.FX")
  - H-blank timer device.

  ### Liberally file

  This liberally can play music and effect on the WonderSwan.
  User can control the WTD by the function call of the WTD.

  liberally version
  liberally file | Specification
  --- | ---
  WTD_SRAM.LIB | DGROUP = S-RAM( Address 0x10000 to 0x1FFFF), WTD can use MIDI. And user application can not use serial port.
  WTDHSRAM.LIB | DGROUP = S-RAM( Address 0x10000 to 0x1FFFF), WTD can not use MIDI. And user application can use serial port.
  WTD_IRAM.LIB | DGROUP = I-RAM( Address 0x00000 to 0x0FFFF), WTD can use MIDI. And user application can not use serial port.
  WTDHIRAM.LIB | DGROUP = I-RAM( Address 0x00000 to 0x0FFFF), WTD can not use MIDI. And user application can use serial port.

  Those liberally are microsoft's format.
  Those liberally are made MASM (Microsoft macro assembler version 6.11a).
  We confirm that the LSI-C86 for WonderWitch can use those liberally.

  In-direct liberally of the Wonder Witch
  File name | Specification
  --- | ---
  WTD.FX | This is In-directliberally for the Wonder Witch Application. WTD can use MIDI. And user application can not use serial port.
  WTD_H.FX | This is In-directliberally for the Wonder Witch Application. WTD can not use MIDI. And user application can use serial port.

  ### Liberally functions

- Function call of the WTD is as follows.
- About the details, please see document "DEVELOP.pdf".

  Liberally Function |
  --- | ---
  void WTD_FunctionLoad(&Wtd_Function); | Load of the function struct. (This fanction is liberally version only.) If you want to use the liberally version, you must call this function.

  In-direct liberally functions & WTD controlling functions |
  --- | ---
  int wtdIL.Stay(); | Open and setup the WTD.
  int wtdIL.StayOut(); | Close and shutdown the WTD.
  void wtdIL.Init(); | Initialize the WTD
  char wtdIL.MusicPlay(char far *Music); | Play the music.
  void wtdIL.MusicStop(); | Stop the music.
  char wtdIL.EffectPlay(char far *Effect) | Play the effect.
  void wtdIL.EffectStop(); | Stop the effect.
  void wtdIL.PcmPlay(char far *PCM); | Play the PCM voice.
  void wtdIL.PcmStop(); | Stop the PCM voice.
  char wtdIL.PcmVoiceSet(char no,char far *wave); | Set the voice.
  char wtdIL.SoftEmbSet(char no,char far *emb); | Set the envelope
  char far *wtdIL.ChangeFar(void far *add); | Convert the far address of the i8086.
  void wtdIL.SoundSetChannel(int mode); | Direct device access.(Do not use.)
  int wtdIL.SoundGetChannel(); | Direct device access.(Do not use.)
  void wtdIL.SoundSetOutput(int mode); | Direct device access.(Do not use.)
  int wtdIL.SoundGetOutput(int mode); | Direct device access.(Do not use.)
  int wtdIL.SoundGetRandom(); | Get Rundom
  void wtdIL.SetPlayMode(int mode); | Direct device access.(Do not use.)
  int wtdIL.GetPlayMode(); | Direct device access.(Do not use.)
  void wtdIL.SetMusicVolume(char volume); | Set the volume of the music.
  int wtdIL.GetMusicVolume(); | Get the volume of the music.
  void wtdIL.SetEffectVolume(char volume); | Set the volume of the effect.
  int wtdIL.GetEffectVolume(); | Get the volume of the effect.
  void wtdIL.SetPcmVolume(char volume); | Set the volume of the PCM voice.
  int wtdIL.GetPcmVolume(); | Get the volume of the PCM voice.
  void wtdIL.SetFIFO(int size,char far *FIFO); | Set the FIFO buffer of the serial communication of the MIDI.

  ### Structure and Using memory of the WTD

- Work area (4096bytes) of the WTD is as follows.

  Address | Area
  --- | ---
  0x0000 to 0x00FF | Work area for user.
  0x0100 to 0x01FF | Voice table for the PCM of the WonderSwan.
  0x0200 to 0x037F | Envelope table for the expression, pitch bend and panpot.
  0x0380 to 0x03FF | Common structure.
  0x0400 to 0x05FF | Individual structure for the effect.
  0x0600 to 0x0FFF | Individual structure for the music.

  #### liberally version

- WTD have a global variable "_WTD_work" (C-language name is WTD_work[0x1000]).
- User application can access it global variable by exturn define.

  #### In-direct liberally of the Wonder Witch

- When stay WTD, WTD make work area on the heap area (4096byte).

  ### Data format

- .WTD (Music data) file
- .WTV (Voice data) file
- .WSC (ROM image of the WonderSwan emulator) file