AI doc by Steb (steb@bigfoot.com) 0.1 - coders edition
1964 website : http://www.emuhq.com/1964/
note...code in this file will be in MIPS ASM, tailored for Anarko's compiler. Code syntax will probably need changing slightly to make it work with other compilers

-- Registers --

0x4500000 - AI_BASE_REG (pointer to sound)
0x4400004 - AI_LEN_REG (length of sound (bytes) - must be <= 262144)
0x4400008 - AI_CONTROL_REG (are we on??)
0x4400010 - AI_DACRATE_REG 
0x4400014 - AI_BITRATE_REG

#define VI_NTSC_CLOCK		48681812        /* Hz = 48.681812 MHz */
#define VI_PAL_CLOCK		49656530        /* Hz = 49.656530 MHz */

-- sound details --

using cool edit, save file as RAW PCM Motorola, no header, no .DAT file.

-- playing a sound --

1) initialise sound by writing 1 to AI_CONTROL_REG (done at start of prog...once)

1) set AI_BASE_REG to point to the sound in virtual memory
2) Set AI_DACRATE_REG to (clock rate / sample rate of sound)
	i.e. PAL : AI_DACRATE_REG = VI_PAL_CLOCK / 22050
3) Set AI_BITRATE_REG to sounds bitrate - 1
4) Set AI_LEN_REG to the length of the file in bytes

-- Example code

; Play typing sound
  LI 	S0, 0x04500000		;AI Register base

  LI	S1, $TypeSndHere	;RAM addr of sound
  SW	S1, 0x0000(S0)
  LI    S1, 2251		;Dac rate : 49656530 / 22050
  SW    S1, 0x0010(S0)
  LI    S1, 15			;Bit rate-1
  SW    S1, 0x0014(S0)
  LI    S1, 9156		;length in bytes
  SW	S1, 0x0004(S0)
  LI    S1, 1			;dma on
  SW	S1, 0x0008(S0)

;include the type sound
TypeSndHere:
.incbin "type.pcm" 