Embedded system Fun Blog
























































Find out all the best information, libraries and circuit about the latest Embedded systems.
Showing posts with label vs1011. Show all posts
Showing posts with label vs1011. Show all posts

Saturday, 7 January 2012

VS1011 MP3 Decoder Module: source pack 4

.f:rom: http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2011/yl478_clt67/yl478_clt67/yl478_clt67_files/displaycontrol/mp3_VS1011E.c

/* Functions for VS1011E-L MP3 decoder
   modified from the VS1033D decoder demo at http://frank.circleofcurrent.com/musicclock/
   we changed the functions so that playback will not block in a while loop, but the 
   VS_playfile function is called repeatedly from main.c
   We also changed the values that are written into the registers of the VS1011E-L
   Our SPI speeds are also different as we are using a 16 MHz clock for the microcontroller
   as compared to the demo's 8 MHz clocked microcontroller.
  
   This file is free software; you can redistribute it and/or modify
   it under the terms of either the GNU General Public License version 2
   or the GNU Lesser General Public License version 2.1, both as
   published by the Free Software Foundation.
 */

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <stdio.h>
#include "fatfs/ff.h"
#include "fatfs/diskio.h"
#include "uart.h"
#include "SDcard_audio.h"

typedef enum {
    MP3_REG_MODE = 0x00,
    MP3_REG_CLOCKF = 0x03,
    MP3_REG_VOL = 0x0B,
} mp3_register_t;

//wait for the decoder to be ready
inline void mp3_waitReady(uint8_t cnt) {
    for(uint8_t i = 0; i < cnt; i++)
 {
  _delay_us(10);
  if (bit_is_clear(MP3_PORTINPUT, MP3_PIN_DREQ)) break;
 }
 loop_until_bit_is_set(MP3_PORTINPUT, MP3_PIN_DREQ);
}

inline uint8_t mp3_spi(uint8_t data)
{
    SPDR = data; // send
    loop_until_bit_is_set(SPSR, SPIF); // wait until sent
    return SPDR; // get reply
}

//write data in to register addr
void mp3_writeReg(mp3_register_t addr, uint16_t data) {
    spi_slow();

    MP3_PORTOUTPUT &= ~_BV(MP3_PIN_CS); // select

    mp3_spi(0b00000010); // write command
    mp3_spi(addr); // send address
    mp3_spi((data & 0xFF00) >> 8); // send data MSB first
    mp3_spi(data & 0x00FF);

    MP3_PORTOUTPUT |= _BV(MP3_PIN_CS); // deselect

    spi_fast();

    mp3_waitReady(10);
}

//send a packet of MP3 data from the buffer on the microcontroller to the VS1011E-L
void mp3_playPacket(uint8_t* buffer, uint8_t length) {
    spi_slow();
    loop_until_bit_is_set(MP3_PORTINPUT, MP3_PIN_DREQ); // wait for ready
    MP3_PORTOUTPUT &= ~_BV(MP3_PIN_DCS); // select
    for (uint8_t i = 0; i < length; i++)
    {
        mp3_spi(buffer[i]);
    }
    MP3_PORTOUTPUT |= _BV(MP3_PIN_DCS); // deselect
    spi_fast();
}

//play the file
mp3_playStatus_t VS_playfile(FIL* file) {
    uint8_t buff[32];
    UINT read;
 //fprintf(stdout,"VS DREQ %d\r\n", MP3_PORTINPUT & _BV(MP3_PIN_DREQ));
 if (MP3_PORTINPUT & _BV(MP3_PIN_DREQ)) {
     f_read(file, buff, 32, &read); // read the file
     mp3_playPacket(buff, read); // play the sound
     if (read != 32) return PLAYSTATUS_ENDOFFILE;
 } else return PLAYSTATUS_BUSY;
    return PLAYSTATUS_OK;
}

//initialize the VS-1011E-L by writing settings to its registers
void init_VS() {
    spi_slow();
    // DREQ is input, no pull-up
    MP3_PORTOUTPUT &= ~_BV(MP3_PIN_DREQ);
    _delay_ms(100); // slight delay, let VS1011 finish boot initialization
    MP3_PORTOUTPUT |= _BV(MP3_PIN_RST); // bring out of reset, get ready
    mp3_waitReady(10);
 mp3_writeReg(MP3_REG_MODE, 0b0000100000000010); // the mode setting for the decoder
 mp3_writeReg(MP3_REG_CLOCKF, 0x9800); // this is 12.288MHz XTALI with clock doubler
 mp3_writeReg(MP3_REG_VOL, 0); // attenuation = 0 for maximum volume
} 
 
 



VS1011 MP3 Decoder Module: vs10xx.c 2

.from: https://dev.openwrt.org/browser/trunk/package/fonera-mp3-drv/src/vs10xx.c?rev=8509

/*
 * a.lp_mp3 - VS1011B driver for Fonera
 * Copyright (c) 2007 phrozen.org - John Crispin <john@phrozen.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
 *
 * Feedback, Bugs.... mail john@phrozen.org
 *
 */

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>

#include <asm/io.h>
#include <asm/system.h>
#include <asm/irq.h>
#include "ar531xlnx.h"

#define AR5315_DSLBASE          0xB1000000
#define AR5315_GPIO_DI          (AR5315_DSLBASE + 0x0088)
#define AR5315_GPIO_DO          (AR5315_DSLBASE + 0x0090)
#define AR5315_GPIO_CR          (AR5315_DSLBASE + 0x0098)
#define AR5315_GPIO_INT         (AR5315_DSLBASE + 0x00a0)

#define GPIO_0            1<<0
#define GPIO_1            1<<1
#define GPIO_2            1<<2
#define GPIO_3            1<<3
#define GPIO_4            1<<4
#define GPIO_6            1<<6
#define GPIO_7            1<<7

#define DREQ                ((unsigned int)GPIO_7)
#define SCK                ((unsigned int)GPIO_1)
#define SI                ((unsigned int)GPIO_4)
#define BSYNC                ((unsigned int)GPIO_3)
#define CS                ((unsigned int)GPIO_0)
#define SO                ((unsigned int)GPIO_6)
#define RES                ((unsigned int)GPIO_2)

#define REG_MODE            0x0
#define REG_STATUS            0x1
#define REG_BASS            0x2
#define REG_CLOCKF            0x3
#define REG_DECODETIME            0x4
#define REG_AUDATA            0x5
#define REG_WRAM            0x6
#define REG_WRAMADDR            0x7
#define REG_HDAT0            0x8
#define REG_HDAT1            0x9
#define REG_A1ADDR            0xa
#define REG_VOL                0xb
#define REG_A1CTRL0            0xc
#define REG_A1CTRL1            0xd
#define REG_A1CTRL2            0xe

#define VS1011_NEEDS_DATA          spi_get_bit(DREQ)
#define VS1011_NEEDS_NO_DATA          (spi_get_bit(DREQ)== 0x00)
#define VS1011_WHILE_NEEDS_NO_DATA      while(spi_get_bit(DREQ)== 0x00){}

#define VS_CS_LO            spi_clear_bit(CS)
#define VS_CS_HI            spi_set_bit(CS)

#define VS_BSYNC_LO            spi_clear_bit(BSYNC)
#define VS_BSYNC_HI            spi_set_bit(BSYNC)

#define VS_RESET_LO            spi_clear_bit(RES)
#define VS_RESET_HI            spi_set_bit(RES)

#define VS1011_READ             SPI_io_vs1011b(0x03)
#define VS1011_WRITE             SPI_io_vs1011b(0x02)

void msDelay(int ms) {
    int i,a;
    int delayvar=10;

    for (a=0;a<ms;a++) {
        for (i=0;i<33084;i++) {
            delayvar*=2;       
            delayvar/=2;
        }
    }
}  

int spi_get_bit(unsigned int pin){
    return ((sysRegRead(AR5315_GPIO_DI)&pin)?(1):(0));
}

void spi_set_bit(unsigned int pin){
    sysRegWrite(AR5315_GPIO_DO, (sysRegRead(AR5315_GPIO_DO) | pin));
}

void spi_clear_bit(unsigned int pin){
    sysRegWrite(AR5315_GPIO_DO, (sysRegRead(AR5315_GPIO_DO) & ~pin));
}

void SPI_clock_vs1011b(void){
    spi_clear_bit(SCK);
    spi_set_bit(SCK);
}

unsigned char SPI_io_vs1011b(unsigned char byte){
    int i;
    unsigned char this_bit;
    unsigned char byte_out = 0;
    for(i = 7; i>=0; i--){
        if(byte & (1<<i)){
            this_bit = 1;
        } else {
            this_bit = 0;
        }
        if(this_bit){
            spi_set_bit(SI);
        } else {
            spi_clear_bit(SI);
        }
        SPI_clock_vs1011b();
        byte_out += spi_get_bit(SO)<<i;
    }
    return byte_out;
}

void SPI_init_vs1011(void){
    sysRegWrite(AR5315_GPIO_CR, (sysRegRead(AR5315_GPIO_CR) | SI | SCK | CS | BSYNC | RES) & ~(SO|DREQ));
    spi_clear_bit(SCK);
    spi_clear_bit(SI);
    VS_CS_HI;
    VS_BSYNC_HI;
}

void VS1011_send_SCI(unsigned char reg, unsigned int data){
    VS_CS_LO;
    VS1011_WRITE;
    SPI_io_vs1011b(reg);
    SPI_io_vs1011b((data>>8)&0xff);
    SPI_io_vs1011b(data&0xff);
    VS_CS_HI;
}

unsigned int VS1011_read_SCI(unsigned char reg){
    unsigned int data;   
    VS_CS_LO;
    VS1011_READ;
    SPI_io_vs1011b(reg);
    data = 0;
    data = SPI_io_vs1011b(0x00);
    data <<= 8;
    data += SPI_io_vs1011b(0x00);
    VS_CS_HI;
    return data;
}

void VS1011_send_SDI(unsigned char byte){
    int i;
    VS_BSYNC_LO;
    for(i = 7; i>=0; i--){
        if(byte & (1<<i)){
            spi_set_bit(SI);
           
        } else {
            spi_clear_bit(SI);
        }           
        spi_clear_bit(SCK);
        spi_set_bit(SCK);
    }
    VS_BSYNC_HI;
}

void VS1011_send_SDI_32(unsigned char* data){
    int i;
    VS1011_WHILE_NEEDS_NO_DATA;
    for(i=0; i<32; i++){
        VS1011_send_SDI(data[i]);
    }
}

void VS1011_send_zeros(unsigned char count){
    do{
        VS1011_send_SDI(0x0);
        count--;
    }while(count);
}

void VS1011_set_volume(unsigned int vol){
    VS1011_send_SCI(REG_VOL, vol);
}

void VS1011_SW_reset(unsigned int _crystal_freq){
    unsigned int regval = 0x0804;
    unsigned long int i = 0;
    msDelay(100);
    VS1011_send_zeros(32);
    VS1011_send_SCI(REG_MODE, regval);
    msDelay(10);
    while((VS1011_NEEDS_NO_DATA) && (i++<0xffff)){};
    VS1011_send_SCI(REG_CLOCKF, _crystal_freq);
    VS1011_send_zeros(16);
    VS1011_set_volume(0x00);
}

void VS1011_HW_reset(void){
   
    VS_RESET_LO;
    msDelay(1);
    VS_RESET_HI;
    msDelay(1);
}

void VS1011_init(unsigned int _crystal_freq, unsigned char hw){
    if(hw){
        SPI_init_vs1011();
    }
    printk("mp3_drv.ko : Init start\n");
    if(hw){
        VS1011_HW_reset();
    }
    VS1011_SW_reset(_crystal_freq);
    printk("mp3_drv.ko : init_ok\n");
}

void VS1011_sine(unsigned char state, unsigned char freq){
    VS1011_send_zeros(16);
    if(state == 0x01){
        VS1011_send_SDI(0x53);
        VS1011_send_SDI(0xEF);
        VS1011_send_SDI(0x6E);
        VS1011_send_SDI(freq);
        VS1011_send_zeros(0x04);
    } else {
        VS1011_send_SDI(0x45);
        VS1011_send_SDI(0x78);
        VS1011_send_SDI(0x69);
        VS1011_send_SDI(0x74);
        VS1011_send_zeros(0x04);       
    }
}

unsigned int VS1011_get_volume(void){
    return VS1011_read_SCI(REG_VOL);
}

unsigned int VS1011_get_decode_time(void){
    return VS1011_read_SCI(REG_DECODETIME);
}

const unsigned int sample_rate_values[]  = {0, 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000};

void VS1011_get_audio_data(AUDIO_DATA* audio){
    unsigned int audata = VS1011_read_SCI(REG_AUDATA);
    audio->sample_rate = sample_rate_values[(audata&0x1E00)>>9];
    audio->bitrate = audata&0x1FF;
    audio->is_stereo = (audata&0x8000)>>15;
}

void VS1011_print_registers(void){
    unsigned char i;
    for(i = 0; i< 14; i++){
        unsigned int regval = VS1011_read_SCI(i);
        printk("mp3_drv.ko : %d \n", regval);       
    }
}

void VS1011_volume(unsigned char left, unsigned char right){
    unsigned int regval = left;
    regval <<=8;
    regval += right;
    VS1011_send_SCI(REG_VOL, regval);
}

void VS1011_set_bass(unsigned int regval){
    VS1011_send_SCI(REG_BASS, regval);
}

void VS1011_set_reg(unsigned int reg, unsigned int regval){
    VS1011_send_SCI(reg, regval);
}

/*
int vs_test(void) {   
    SPI_init_vs1011();
    printk("%u\n", *R_GEN_CONFIG);
    VS1001_init(_crystal_freq);
    VS1001_print_registers();
    VS1001_volume(0x30, 0x30);
    msDelay(1000);
    VS1001_sine(1, 0x30);
    msDelay(1000);
    VS1001_sine(0, 0);
    VS1001_send_zeros(0x20);
    msDelay(1000);
    VS1001_sine(1, 0x30);
    msDelay(1000);
    VS1001_sine(0, 0);
    VS1001_send_zeros(0x20);
    msDelay(1000);
    VS1001_sine(1, 0x30);
    msDelay(1000);
    VS1001_sine(0, 0);
   
    AUDIO_DATA a;
    VS1001_get_audio_data(&a);
    printk("mp3_drv.ko : rate : %d, bit : %d, stereo : %d \n", a.sample_rate, a.bitrate, a.is_stereo);
    VS1001_SW_reset(_crystal_freq);
    return 0;
}*/

VS1011 MP3 Decoder Module: vs10xx.c and vs10xx.h

.info: http://210.240.226.206/%A4%FD%E5f%A4%AF%A6%D1%AEv/20100201/src/vs10xx.c

XxXxXxXxXxXxXxXxXxXxXxXx vs10xx.c XxXxXxXxXxXxXxXxXxXxXxXx

/** \file vs10xx.c
 * Functions for interfacing with the mp3 player chip.
 * \todo safe rewind
 * \todo VS1003 WMA "wma-bytes-left" variable adjustment at ff/rew
 */

#include "vs10xx.h"
#include "lcd.h"
#include "filesys.h"
#include "storage.h"
#include "ui.h"





#define SKIP_PLUGIN_VARNAME
const unsigned short patch[] = {
#include "vs1053b-patches.plg"
};


void LoadUserPatch(void) {
  int i = 0;

  ConsoleWrite(" LoadUserPatch ");
  while (i<sizeof(patch)/sizeof(patch[0])) {
    unsigned short addr, n, val;
    addr = patch[i++];
    n = patch[i++];
    if (n & 0x8000U) { /* RLE run, replicate n samples */
      n &= 0x7FFF;
      val = patch[i++];
      while (n--) {
        Mp3WriteRegister(addr, val>>8, val & 0xff);
      }
    } else {           /* Copy run, copy n samples */
      while (n--) {
        val = patch[i++];
        Mp3WriteRegister(addr, val>>8, val & 0xff);
      }
    }
  }
  Delay(1);
  while (!MP3_DREQ)
    ;
}


/** Read the 16-bit value of a VSer */
unsigned int Mp3ReadRegister (unsigned char addressbyte){
  unsigned int resultvalue = 0;

  Mp3SelectControl();
  SPIPutCharWithoutWaiting(VS_READ_COMMAND);
  SPIPutChar((addressbyte));
  SPIPutChar(0xff);
  SPIWait();
  resultvalue = (SPI_RESULT_BYTE) << 8;
  SPIPutCharWithoutWaiting(0xff);
  SPIWait();
  resultvalue |= (SPI_RESULT_BYTE);
  Mp3DeselectControl();
  return resultvalue;
}
  





/** Soft Reset of VS10xx (Between songs) */
void Mp3SoftReset(){
  /* Soft Reset of VS10xx */
  Mp3WriteRegister (SPI_MODE, 0x08, 0x04); /* Newmode, Reset, No L1-2 */
  Delay(1);
  while (!MP3_DREQ) /* wait for startup */
    ; 
  /* Set clock register, doubler etc. */
  Mp3WriteRegister(SPI_CLOCKF, 0xa0, 0x00); 
  while (!MP3_DREQ)
    ;
  LoadUserPatch();

}

/** Soft Reset of VS10xx (Between songs) */
void Mp3SoftResetWithoutPatch(){
  /* Soft Reset of VS10xx */
  Mp3WriteRegister (SPI_MODE, 0x08, 0x04); /* Newmode, Reset, No L1-2 */
  Delay(1);
  while (!MP3_DREQ) /* wait for startup */
    ; 
  /* Set clock register, doubler etc. */
  Mp3WriteRegister(SPI_CLOCKF, 0xa0, 0x00); 
  while (!MP3_DREQ)
    ;

}


/** Reset VS10xx */
void Mp3Reset(){
  //ConsolePutChar(13);

  Mp3PutInReset();
  Delay(1);

  /* Send dummy SPI byte to initialize atmel SPI */
  SPIPutCharWithoutWaiting(0xFF);
  
  /* Un-reset MP3 chip */
  Mp3DeselectControl();
  Mp3DeselectData();
  Mp3ReleaseFromReset();

  while (!MP3_DREQ)
    ;

#if 0
  ConsoleWrite("ClockF:");
  ConsolePutUInt(Mp3ReadRegister(SPI_CLOCKF));
  ConsolePutChar(13);
#endif
  
  /* Set clock register, doubler etc. */
  Mp3WriteRegister(SPI_CLOCKF, 0xa0, 0x00); 
  Delay(1);
  /* Wait for DREQ */
  while (!MP3_DREQ)
    ;


#if 0
  ConsoleWrite("ClockF:");
  ConsolePutUInt(Mp3ReadRegister(SPI_CLOCKF));
  ConsolePutChar(13);
  Mp3WriteRegister(SPI_WRAMADDR, 0xc0, 0x13);
  ConsoleWrite("0xC013:");
  ConsolePutUInt (Mp3ReadRegister(SPI_WRAM));
  ConsolePutUInt (Mp3ReadRegister(SPI_WRAM));
  ConsolePutChar(13);
#endif

  
  Mp3SoftReset();

#if 1
  ConsoleWrite("ClockF:");
  ConsolePutUInt(Mp3ReadRegister(SPI_CLOCKF));
  ConsolePutChar(13);
#endif


  Mp3WriteRegister(SPI_WRAMADDR, 0xc0, 0x13);
  ConsoleWrite("0xC013:");
  ConsolePutUInt (Mp3ReadRegister(SPI_WRAM));
  ConsolePutUInt (Mp3ReadRegister(SPI_WRAM));
  ConsolePutChar(13);


  /* Switch on the analog parts */
  Mp3SetVolume(20,20);

  SPISetFastClock();
  ConsoleWrite ("Init: VS10XX\r");

}


/** VS10xx Sine Test Function - Good getting started example */ 
void VsSineTest(){

  ConsoleWrite("Not For VS1053!"); /* Needs adjustment */

  /* Reset MP3 chip */
  Mp3PutInReset();       /* Pull xRESET low -> hardware reset */
  Delay(100);            /* 100 ms delay */

  /* Send dummy SPI byte to initialize SPI of Atmel microcontroller */
  SPIPutCharWithoutWaiting(0xFF);

  /* Un-reset MP3 chip */
  Mp3DeselectControl();  /* Pull xCS high    */
  Mp3DeselectData();     /* Pull xDCS high   */
  Mp3ReleaseFromReset(); /* Pull xRESET high */
  Delay(100);            /* 100 ms delay     */

  GREEN_LED = LED_ON;
  RED_LED = LED_ON;

  /* VS10xx Application Notes, chapter 4.8 ---------------------------------*/
  /* As an example, let's write value 0x0820 to register 00 byte by byte    */
  Mp3SelectControl();    /* Now SPI writes go to SCI port                   */
  SPIPutChar(0x02);      /* Send SPI Byte, then wait for byte to be sent.   */
  SPIPutChar(0x00);      /* 0x02 was WRITE command, 0x00 is register number */
  SPIPutChar(0x08);      /* This byte goes to MSB                           */
  SPIPutChar(0x20);      /* ..and this is LSB. (0x20=Allow Test Mode)       */
  SPIWait();             /* Wait until Atmel MCU signals SPI write complete */
  Mp3DeselectControl();  /* Now SPI writes don't go to SCI port             */

  while (!MP3_DREQ)      /* Wait for DREQ = 1                               */
    ;     /* Do nothing while waiting for DREQ = 1           */

  /* Send a Sine Test Header to Data port                                   */
  Mp3SelectData();       /* Now SPI writes go to SDI port                   */

  SPIPutChar(0x53);      /* - This is a special VLSI Solution test header - */
  SPIPutChar(0xef);      /* - that starts a sine sound. It's good for     - */
  SPIPutChar(0x6e);      /* - testing your code, the chip and also for    - */
  SPIPutChar(0x44);      /* - seeing if your MP3 decoder was manufactured - */
  SPIPutChar(0x00);      /* - by VLSI Solution oy. ------------------------ */
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIWait();
  Mp3DeselectData();
  
  RED_LED = LED_OFF;
  Delay (500);           /* 500 ms delay */
  GREEN_LED = LED_OFF;

  /* Stop the sine test sound */
  Mp3SelectData();
  SPIPutChar(0x45);
  SPIPutChar(0x78);
  SPIPutChar(0x69);
  SPIPutChar(0x74);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIWait();
  Mp3DeselectData();

  Delay(500);            /* 500 ms delay */
}  

/** Send 2048 zeros. */
void SendZerosToVS10xx(){
  Mp3SelectData();
  SPIPutCharWithoutWaiting(0);
  for (temp.i=0; temp.i<1048; temp.i++){ /* TESTING 1048 TESTING */
    while (!MP3_DREQ)
      ;
    SPIPutChar(0);
  }
  SPIWait();
  Mp3DeselectData();
}  

//Link in experimental AVI file sound track playing
//#define AVIPLAY
//#ifdef AVIPLAY
//#include "aviplay.c"
//#endif



/** Send a number of disk sectors to vs10xx.
 * Starting from current value in global variable sectorAddress,
 * sends a number of disk sectors to vs10xx and returns. */
unsigned char PlayDiskSectors (unsigned int nSectorsToPlay){
  
  /** How many sectors to send between ff/rew commands */
  unsigned char fallbackCount = 0;


//#ifdef AVIPLAY
//if (!PlayAvi()) return 0; //try to play AVI file soundtrack starting from                            //current sector, if avifile is played, return.
//#endif


  PrepareToReadDiskSector(sectorAddress.l);
  while (nSectorsToPlay--){

    AvailableProcessorTime();

    ReadDiskSector(sectorAddress.l);

    /* If playing state is something else than "play normally",
       exit returning the request number. */
    if ((playingState==PS_END_OF_SONG)||
 (playingState==PS_NEXT_SONG)||
 (playingState==PS_RECORDING)||
 (playingState==PS_PREVIOUS_SONG)){
      return playingState;
    }


    /* === REWIND / FAST FORWARD FUNCTIONALITY CODE BEGINS === */
    /* If you don't implement rewind / fast forward, leave these lines out */

    if (playingState==PS_FALLBACK_N){
      if ((--fallbackCount)==0){
 playingState=PS_NORMAL;
      }
    }

    if (playingState==PS_FALLBACK_1){
      /* Now we should have brand new sector in memory ready for sending to
  VS1003, so let's send zeroes between old and new data. */
      ConsoleWrite("(Zeros)");
      SendZerosToVS10xx();
      ConsoleWrite("->Fallback to normal");
      fallbackCount = 24;
      playingState = PS_FALLBACK_N;
    }


    if (playingState==PS_CUE){ //Request to start fast forward      
      if (Mp3ReadRegister(SPI_HDAT1)==((int)'W'<< 8)+'m'){
 ConsoleWrite("\rWmCUE->Wait");
 Mp3WriteRegister(SPI_AICTRL2, 0x12, 0x34);
 playingState = PS_CUE_WAIT1003;
      }else{
 playingState = PS_CUE_ACTION;
      }
    }
    
    if (playingState==PS_CUE_WAIT1003){ //Wait for permission to break data flow
      if (Mp3ReadRegister(SPI_AICTRL2)==0x2345){ //permission granted
 ConsoleWrite("->Action");
 playingState = PS_CUE_ACTION;
      }
    }
    
    if (playingState==PS_CUE_ACTION){
      if (nSectorsToPlay>128){
 sectorAddress.l += 128; //Skip sectors
 nSectorsToPlay -= 128;
 //adjust vs1003 song left 
 ConsoleWrite("->Fallback(5)");
 playingState = PS_FALLBACK_1; //Sector already in memory still goes.
      }
    }

    if (playingState==PS_REWIND){ //Request to start fast forward      
      Mp3WriteRegister(SPI_AICTRL2, 0x12, 0x34);
      playingState = PS_REW_WAIT1003;
    }

    if (playingState==PS_REW_WAIT1003){ //Wait for permission to break data flow
      if (1){
 //if (Mp3ReadRegister(SPI_AICTRL2)==0x2345){ //permission granted
   sectorAddress.l -= 128;
   nSectorsToPlay += 128;
   playingState = PS_FALLBACK_1; //Sector already in memory still goes.
   //}
      }
    }
    

    /* === END OF REWIND / FAST FORWARD FUNCTIONALITY CODE === */
    
 
  
    sectorAddress.l++;
    if (nSectorsToPlay){
      /*Do not seek after the last sector*/
      PrepareToReadDiskSector(sectorAddress.l);
    }

    Mp3SelectData();

    dataBufPtr = diskSect.raw.buf;
    while (dataBufPtr < diskSect.raw.buf+512){

      if (!MP3_DREQ){
        GREEN_LED = LED_ON;
        while (!MP3_DREQ){
          Mp3DeselectData();
          AvailableProcessorTime();
          Mp3SelectData();
        }
      }
      GREEN_LED = LED_OFF;
      
      /* Send 32 octets of disk block data to VS10xx */

      //Mp3WriteRegister (SPI_MODE, 0x0C, 0x00); /* Newmode, No L1-2 */
     
      SPIPutCharWithoutWaiting(*dataBufPtr++);
      SPIWait();
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIPutChar(*dataBufPtr++);
      SPIWait();
      
      //Mp3WriteRegister (SPI_MODE, 0x08, 0x00); /* Newmode, No L1-2 */


    }


    SPIWait();
    Mp3DeselectData();
  }


  return 0; //OK Exit
}




XxXxXxXxXxXxXxXxXxXxXxXx vs10xx.h XxXxXxXxXxXxXxXxXxXxXxXx

/** \file vs10xx.h
 * Headers for interfacing with the mp3 player chip.
 * Interfacing the New Way, not handling BSYNC -> not compatible with VS1001.
 */


#ifndef VS10XX_H
#define VS10XX_H

#include "board.h"

/** VS10xx SCI Write Command byte is 0x02 */
#define VS_WRITE_COMMAND 0x02

/** VS10xx SCI Read Command byte is 0x03 */
#define VS_READ_COMMAND 0x03


#define SPI_MODE 0x0   /**< VS10xx register */
#define SPI_STATUS 0x1   /**< VS10xx register */
#define SPI_BASS 0x2   /**< VS10xx register */
#define SPI_CLOCKF 0x3   /**< VS10xx register */
#define SPI_DECODE_TIME 0x4   /**< VS10xx register */
#define SPI_AUDATA 0x5   /**< VS10xx register */
#define SPI_WRAM 0x6   /**< VS10xx register */
#define SPI_WRAMADDR 0x7   /**< VS10xx register */
#define SPI_HDAT0 0x8   /**< VS10xx register */
#define SPI_HDAT1 0x9   /**< VS10xx register */
#define SPI_AIADDR 0xa   /**< VS10xx register */
#define SPI_VOL  0xb   /**< VS10xx register */
#define SPI_AICTRL0 0xc   /**< VS10xx register */
#define SPI_AICTRL1 0xd   /**< VS10xx register */
#define SPI_AICTRL2 0xe   /**< VS10xx register */
#define SPI_AICTRL3 0xf   /**< VS10xx register */

#define SM_DIFF  0x01   /**< VS10xx register */
#define SM_JUMP  0x02   /**< VS10xx register */
#define SM_RESET 0x04   /**< VS10xx register */
#define SM_OUTOFWAV 0x08   /**< VS10xx register */
#define SM_PDOWN 0x10   /**< VS10xx register */
#define SM_TESTS 0x20   /**< VS10xx register */
#define SM_STREAM 0x40   /**< VS10xx register */
#define SM_PLUSV 0x80   /**< VS10xx register */
#define SM_DACT  0x100   /**< VS10xx register */
#define SM_SDIORD 0x200   /**< VS10xx register */
#define SM_SDISHARE 0x400   /**< VS10xx register */
#define SM_SDINEW 0x800   /**< VS10xx register */
#define SM_ADPCM        0x1000   /**< VS10xx register */
#define SM_ADPCM_HP     0x2000   /**< VS10xx register */


/** Playing State Global, 0=normal playing, 1=abort playing */
extern xdata unsigned char playingState;



/** Execute VS1011/VS1002 Sine Test Function */
void VsSineTest();

void Mp3Reset();

/** Soft Reset of VS10xx (Between songs) */
void Mp3SoftReset();



/** Write VS10xx register*/
#define Mp3WriteRegister(addressbyte,highbyte,lowbyte){ \
 Mp3SelectControl(); \
 SPIPutCharWithoutWaiting(VS_WRITE_COMMAND); \
 SPIPutChar((addressbyte)); \
 SPIPutChar((highbyte)); \
 SPIPutChar((lowbyte)); \
 SPIWait(); \
 Mp3DeselectControl(); \
}

/** Set VS10xx Volume Register */
#define Mp3SetVolume(leftchannel,rightchannel){\
 Mp3WriteRegister(11,(leftchannel),(rightchannel));}

/** Read the 16-bit value of a VS10xx register */
unsigned int Mp3ReadRegister (unsigned char addressbyte);

/** Send 2048 zeros. \todo Timeouts for all DREQ busy loop waits! */
void SendZerosToVS10xx();

/** Play disk sectors from disk */
unsigned char PlayDiskSectors (unsigned int nSectorsToPlay);


/** This is called when there is free processor time, implement externally. */
void AvailableProcessorTime();


/** Soft reset without loading patch */
void Mp3SoftResetWithoutPatch();


/** Load User Patch */
void LoadUserPatch(void);



#endif


XxXxXxXxXxXxXxXxXxXxXxXx EOF XxXxXxXxXxXxXxXxXxXxXxXx

VS1011 MP3 Decoder Module: vs10xx.c source

 
.from: http://www.google.com/codesearch#hdIfIxYTHhY/trunk/Sources/vs10xx.c&q=VS1011.c&type=cs&l=2

/*  Phillip Duran
    VS1011.c
    A low level driver to intialize and operate the VS1011 DSP

    Updated: 2/21/08
*/

#include "VS1033.h"
#include "SPI.h"
#include <mc9s12e128.h>     /* derivative information */
#include "board.h"


// left and right volume levels
// volume grows louder and levels approach zero (0)
unsigned char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 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6
};
const unsigned short dtab[2278] = { // Data to write
    0x8010, 0x2000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0024, 0x0000,
    0x0024, 0x2800, 0x4c40, 0x8030, 0x2919, 0xe240, 0x0000, 0x0510,
    0x2919, 0xe140, 0x0000, 0x0010, 0x2800, 0x0dc0, 0x0000, 0x0041,
    0x0000, 0x0001, 0x2800, 0xa880, 0x0006, 0x2016, 0x8039, 0x3e13,
    0xb80f, 0x0000, 0x0055, 0x0030, 0x0497, 0x3f75, 0x780d, 0x0000,
    0x03ce, 0x2400, 0x11ce, 0x0000, 0x0024, 0x0000, 0x0024, 0x2800,
    0x1080, 0x0000, 0x02d5, 0x3f05, 0x4024, 0x0000, 0x0024, 0x2800,
    0x1180, 0x0000, 0x00d5, 0x3f05, 0x4024, 0x3009, 0x1bcd, 0x2000,
    0x0000, 0x36f3, 0x980f, 0x804b, 0x0000, 0x0401, 0x3e11, 0xb804,
    0x3e13, 0x7805, 0x0000, 0x0244, 0x0000, 0x0046, 0x419a, 0x380e,
    0x4cc2, 0xb80f, 0x0030, 0x0497, 0x2400, 0x1745, 0x0fff, 0xff45,
    0x0000, 0x0024, 0x0000, 0x0024, 0x3f60, 0x4024, 0x3710, 0x4024,
    0x3f01, 0x0024, 0xa152, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024,
    0x8cc2, 0x3e46, 0x36f3, 0x980f, 0x36f3, 0x5805, 0x2000, 0x0000,
    0x36f1, 0x9804, 0x8015, 0x3e12, 0x3805, 0x2900, 0x19c0, 0x0000,
    0x3fc5, 0x3602, 0x0024, 0x2000, 0x0000, 0xb500, 0x9bc5, 0x8062,
    0x6492, 0xb808, 0x2900, 0x19c0, 0x6198, 0x3844, 0x3009, 0x1808,
    0x4082, 0x1804, 0x0000, 0x0015, 0xf240, 0x3814, 0xf400, 0x4014,
    0x3583, 0x3801, 0x3510, 0x4024, 0x0000, 0x0204, 0x2800, 0x1c11,
    0x3500, 0x0024, 0xac42, 0x0024, 0x0000, 0x0020, 0x6848, 0x4800,
    0xac42, 0x1814, 0x2000, 0x0000, 0xc100, 0x9bc1, 0x8075, 0x0006,
    0x0197, 0x3e00, 0x5c00, 0x000f, 0xd641, 0xfe10, 0x0024, 0x0008,
    0xd4c0, 0x4cb2, 0x0024, 0xf200, 0xbc00, 0x2000, 0x0000, 0x36f0,
    0x4024, 0x8025, 0x2a00, 0x1f8e, 0x807e, 0x3e12, 0xb817, 0x3e10,
    0xb800, 0x0030, 0x0a57, 0x3700, 0x0024, 0x0000, 0x2002, 0xb024,
    0x0024, 0x002f, 0xe002, 0x2800, 0x22c5, 0x0006, 0x2017, 0x4024,
    0x1c00, 0xf400, 0x4097, 0x2800, 0x2400, 0x3f00, 0x1bcc, 0x3700,
    0xb804, 0x0000, 0x01c4, 0xa244, 0x0024, 0x4024, 0x0024, 0x3f00,
    0x9bc4, 0x36f0, 0x9800, 0x0030, 0x0717, 0x3602, 0x8024, 0x2100,
    0x0000, 0x3f05, 0xdbd7, 0x8095, 0x3e12, 0xb817, 0x3e12, 0x3815,
    0x3e05, 0xb814, 0x3625, 0x0024, 0x0000, 0x800a, 0x3e10, 0x7802,
    0x3e10, 0xf804, 0x3e11, 0x7806, 0x3e11, 0xf810, 0x3e14, 0x7813,
    0x3e13, 0xf80e, 0x3e03, 0x4842, 0x2800, 0x4880, 0xb88a, 0x8bc3,
    0x2900, 0x0540, 0x4588, 0x184c, 0xf400, 0x4007, 0x0000, 0x3940,
    0x6700, 0x0024, 0x0000, 0x02c1, 0x2800, 0x4205, 0x478e, 0x0024,
    0x0000, 0x0024, 0x2800, 0x4205, 0x0000, 0x0024, 0x2900, 0x0540,
    0x4518, 0x184c, 0x0000, 0x0401, 0x3413, 0x0024, 0xb010, 0xb3c0,
    0x0000, 0x0b80, 0x2800, 0x34c5, 0x6700, 0x0024, 0x0000, 0x0501,
    0x2800, 0x34c5, 0x0000, 0x0024, 0x0000, 0x0686, 0x4518, 0x184c,
    0x3009, 0x3852, 0x3e10, 0xf802, 0x3009, 0x3852, 0x2900, 0x19c0,
    0x3009, 0x3840, 0xb284, 0x984c, 0x2900, 0x19c0, 0x4568, 0x4003,
    0xb182, 0x134c, 0x2900, 0xd340, 0x4dc6, 0x10d2, 0x34d3, 0x1bcc,
    0x3600, 0xd802, 0x3e10, 0x0024, 0x2900, 0x2540, 0x3434, 0x8024,
    0x4080, 0x1bcc, 0x3009, 0x1812, 0x2800, 0x3458, 0x4d82, 0x0024,
    0x2800, 0x4940, 0xc890, 0x1bcc, 0x2900, 0xe9c0, 0x0000, 0x4208,
    0x0000, 0x3781, 0x3413, 0x0024, 0x3009, 0x13c0, 0xb010, 0x0024,
    0x0000, 0x0024, 0x2800, 0x4215, 0x0000, 0x0024, 0x0000, 0x0206,
    0x2900, 0x1880, 0x4568, 0x184c, 0x2900, 0xf380, 0x3613, 0x0024,
    0x4080, 0x0024, 0x0000, 0x0024, 0x2800, 0x4205, 0x0000, 0x0024,
    0x0006, 0x0610, 0x30f1, 0x0024, 0x6498, 0x0040, 0x4090, 0x23c4,
    0x6090, 0x2000, 0x0000, 0x0001, 0x2800, 0x4215, 0x0000, 0x0024,
    0x0006, 0x0010, 0xf150, 0x0024, 0x0000, 0x014e, 0x4010, 0x0024,
    0xf400, 0x4011, 0x2400, 0x3c8e, 0x3110, 0x0024, 0x3110, 0x2040,
    0x0006, 0x0253, 0x0000, 0x0706, 0x2900, 0x1880, 0x4568, 0x984c,
    0x0000, 0x0686, 0x3b10, 0x184c, 0x3bf0, 0x7802, 0x0000, 0x0501,
    0x4518, 0x3843, 0x0000, 0x0001, 0x3009, 0x3852, 0x2900, 0x19c0,
    0x3009, 0x3840, 0xb284, 0x984c, 0x2900, 0x19c0, 0x4568, 0x4003,
    0x4dc6, 0x0024, 0x2900, 0xd340, 0x0006, 0x01d2, 0x2800, 0x4940,
    0xc890, 0x9b92, 0xf400, 0x4145, 0x0000, 0x0801, 0x451a, 0x0024,
    0x0000, 0x7fc1, 0xb51a, 0x0024, 0x458a, 0x0024, 0x0000, 0x0024,
    0x2800, 0x28d5, 0x0000, 0x0024, 0x6d96, 0x4490, 0x3023, 0x0024,
    0x3009, 0x0000, 0x4090, 0x0024, 0x3009, 0x2000, 0x2800, 0x4895,
    0x0000, 0x0024, 0x30e3, 0x08cc, 0x3009, 0x0040, 0x3009, 0x03c1,
    0x4c82, 0x8842, 0x3009, 0x0bc3, 0x2800, 0x4898, 0x0000, 0x0024,
    0x0006, 0x0611, 0x2800, 0x4940, 0x3100, 0x0b4c, 0x4d82, 0x184c,
    0x2900, 0xe9c0, 0x0000, 0x28c8, 0x36f3, 0x4024, 0x36f3, 0xd80e,
    0x36f4, 0x5813, 0x36f1, 0xd810, 0x36f1, 0x5806, 0x36f0, 0xd804,
    0x36f0, 0x5802, 0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815,
    0x2000, 0x0000, 0x36f2, 0x9817, 0x8131, 0x3613, 0x0024, 0x3e12,
    0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, 0x0024, 0x0000,
    0x800a, 0x3e10, 0x3801, 0x0020, 0x0001, 0x3e10, 0xb803, 0x3e11,
    0x3805, 0x3e11, 0xb807, 0x3e14, 0x3811, 0x0006, 0x0390, 0x0030,
    0x03d1, 0x3e14, 0xb813, 0x3e13, 0xf80e, 0x3e03, 0x4024, 0x3001,
    0x4024, 0x3100, 0x0024, 0xb010, 0x0024, 0x0000, 0x0401, 0x2800,
    0x5385, 0x0000, 0x0024, 0x3100, 0x184c, 0xf292, 0x0024, 0xb012,
    0x0024, 0x2910, 0x9a80, 0x3900, 0x4024, 0x0000, 0x0401, 0x3100,
    0x0024, 0xb010, 0x0024, 0x0000, 0x1c00, 0x2800, 0x5885, 0x458a,
    0x0024, 0x0000, 0x0024, 0x2800, 0x5b05, 0x0000, 0x0024, 0x0006,
    0x1e50, 0x0006, 0x03d2, 0x0006, 0x79d3, 0x2910, 0x0700, 0x3a01,
    0x4024, 0xb88a, 0x8c00, 0x3009, 0x2000, 0x0006, 0x7a10, 0x3009,
    0x0000, 0x6090, 0x0024, 0x2800, 0x5b00, 0x3009, 0x2c00, 0x0000,
    0x0024, 0x2800, 0x5b15, 0x0000, 0x0024, 0x0006, 0x1e53, 0x0006,
    0x79d0, 0x0006, 0x03d2, 0x2910, 0x0700, 0x0000, 0x18c0, 0x3201,
    0x4c00, 0x3009, 0x2000, 0x0020, 0x0001, 0x31d3, 0x0024, 0x3100,
    0x0024, 0xb010, 0x0024, 0x0000, 0x0024, 0x2800, 0x6185, 0x4590,
    0x0024, 0x3100, 0x184c, 0xf292, 0x0024, 0xb012, 0x0024, 0x3930,
    0x4024, 0x003f, 0xe9c1, 0x3100, 0x0024, 0xb012, 0x0024, 0x2900,
    0x0e40, 0x3900, 0x4024, 0x0000, 0x404e, 0x2400, 0x608e, 0x0000,
    0x0024, 0x0000, 0x0401, 0x2900, 0x1300, 0xc890, 0x184c, 0x0000,
    0x0024, 0x2900, 0x0d80, 0x0000, 0x4084, 0x4590, 0x0024, 0x0000,
    0x0181, 0x2800, 0x6715, 0x0030, 0x03d0, 0x0000, 0x0085, 0x0006,
    0x0250, 0x0006, 0x0451, 0x3010, 0x0024, 0x30f0, 0x4024, 0x0006,
    0x0590, 0x6c92, 0x0024, 0x0000, 0x0020, 0xf2c2, 0x0024, 0x3910,
    0x0024, 0x0006, 0x01c0, 0x39f0, 0x4024, 0x0006, 0x01d1, 0x38d0,
    0x0440, 0x3810, 0x0441, 0x3810, 0x4400, 0x0000, 0x0181, 0x3800,
    0x0024, 0x0030, 0x03d0, 0x30a0, 0x0024, 0xb010, 0x0024, 0x0000,
    0x0081, 0x6012, 0x0024, 0x001d, 0x9941, 0x2800, 0x6c55, 0x0000,
    0x0024, 0x3000, 0x0024, 0x6012, 0x0024, 0x0030, 0x0110, 0x2800,
    0x6c55, 0x0000, 0x0024, 0x0006, 0x0651, 0x3000, 0x0024, 0x3100,
    0x4024, 0x6014, 0x0024, 0x0000, 0x0024, 0x2800, 0x6c41, 0x0000,
    0x0024, 0x3100, 0x0024, 0x3800, 0x0024, 0x0000, 0x0080, 0x6500,
    0x0024, 0x0000, 0x00c0, 0x2800, 0x7495, 0x0000, 0x0241, 0x0006,
    0x04d0, 0x0000, 0x1442, 0x3011, 0x984c, 0x30f1, 0xc024, 0x2900,
    0xfa40, 0xaf1e, 0x0024, 0x0000, 0x00c1, 0x3010, 0x8024, 0x3010,
    0xc024, 0x6d96, 0x0380, 0x4090, 0x2042, 0x3810, 0xc024, 0x2800,
    0x73d5, 0x0000, 0x00c5, 0x418a, 0x004c, 0x3000, 0x0024, 0x4010,
    0x0024, 0x3800, 0x0024, 0x30d4, 0x4024, 0x3009, 0x0440, 0x3810,
    0x07c1, 0x3820, 0x4024, 0x30f4, 0x4024, 0x3123, 0x0024, 0x3009,
    0x0400, 0x0006, 0x0411, 0xb880, 0x2000, 0x4580, 0x2400, 0x6500,
    0x0024, 0x0000, 0x0100, 0x2800, 0x7a55, 0x0000, 0x0201, 0x003f,
    0xc000, 0x2900, 0x1300, 0x3613, 0x0024, 0x0000, 0x3f81, 0x6012,
    0x0024, 0x0006, 0x0410, 0x2800, 0x7855, 0x0000, 0x0000, 0x0000,
    0x0105, 0x2800, 0xa400, 0x3800, 0x0024, 0x3000, 0x0024, 0x6090,
    0x0024, 0x4080, 0x2000, 0x0000, 0x0024, 0x2800, 0xa418, 0x0000,
    0x0024, 0x2900, 0x0d80, 0x0000, 0xa408, 0x6500, 0x0024, 0x0000,
    0x0140, 0x2800, 0x97d5, 0x0006, 0x0450, 0x3010, 0x0024, 0x30f0,
    0x4024, 0x4c82, 0x0024, 0x0000, 0xf601, 0x2800, 0x8d89, 0x0000,
    0x0024, 0x291a, 0x22c0, 0x3613, 0x0024, 0x6012, 0x0024, 0x0000,
    0x0041, 0x2800, 0x8d98, 0x0006, 0x0451, 0x0000, 0x0802, 0x0006,
    0x79d0, 0x3111, 0x8012, 0xfe22, 0x07c7, 0x48b2, 0x0024, 0x6cfe,
    0x0024, 0x0000, 0x0004, 0x2800, 0x8109, 0x6420, 0x0024, 0xb888,
    0x0442, 0x6420, 0x07c3, 0x0000, 0x0024, 0x2800, 0x8558, 0x4290,
    0x0024, 0x2400, 0x8500, 0x0000, 0x0024, 0x0000, 0x0401, 0x2900,
    0x1300, 0xc890, 0x184c, 0x0001, 0x0001, 0x3a10, 0x0024, 0xf400,
    0x4480, 0x6016, 0x0024, 0x0000, 0x0024, 0x2800, 0x8511, 0x0000,
    0x0024, 0x0000, 0x0012, 0x6498, 0x0024, 0x0006, 0x79d0, 0x0000,
    0x0041, 0x0006, 0x0451, 0x0006, 0x0413, 0x3111, 0xa012, 0xfe22,
    0x07c7, 0x6fb2, 0x0024, 0x3910, 0x0024, 0x39f0, 0x4024, 0x0000,
    0x0801, 0x3300, 0x0024, 0x4012, 0x0024, 0x0000, 0x4000, 0x6100,
    0x2c01, 0x0006, 0x0450, 0x2800, 0x8a91, 0x0000, 0x0401, 0x2900,
    0x1300, 0xc890, 0x184c, 0x2800, 0x8d80, 0x0000, 0x0085, 0x3010,
    0x0024, 0x30f0, 0x4024, 0x4c82, 0x0024, 0x0000, 0xf601, 0x2800,
    0x8d89, 0x0000, 0x0024, 0x291a, 0x22c0, 0x3613, 0x0024, 0x6012,
    0x0024, 0x0006, 0x0451, 0x2800, 0x7e48, 0x0000, 0x0041, 0x0013,
    0xaa40, 0x0030, 0x0850, 0x0006, 0x0451, 0x3800, 0x0024, 0x3110,
    0x0024, 0x31f0, 0x4024, 0x4c82, 0x0024, 0x0000, 0x0181, 0x2800,
    0xa419, 0x0030, 0x03d0, 0x2900, 0x0e40, 0x3613, 0x0024, 0x30d0,
    0x0024, 0xb010, 0x0024, 0x0000, 0x0081, 0x6012, 0x0024, 0x0000,
    0x0145, 0x2800, 0x9455, 0x6892, 0x0024, 0x0030, 0x0111, 0x0006,
    0x0652, 0x3100, 0x0024, 0x6090, 0x0024, 0x689a, 0x2800, 0x0000,
    0x1b00, 0x2910, 0x0700, 0x0000, 0xa408, 0x3000, 0x0024, 0x4012,
    0x0024, 0x6592, 0x20c1, 0x3000, 0x0024, 0xb010, 0x0024, 0x6592,
    0x0024, 0x6012, 0x0024, 0x0000, 0x1401, 0x2800, 0xa415, 0x0000,
    0x0024, 0x3000, 0x0024, 0xc012, 0x0024, 0x2800, 0xa400, 0x3800,
    0x4024, 0x6500, 0x0024, 0x0030, 0x0850, 0x2800, 0xa3d5, 0x0013,
    0xaa40, 0x0000, 0xf601, 0x291a, 0x22c0, 0x3613, 0x0024, 0x6012,
    0x0024, 0x0000, 0x5001, 0x2800, 0x9fd8, 0x0006, 0x0410, 0x0006,
    0x79d0, 0x0000, 0x07ce, 0x2400, 0x9d8e, 0xb884, 0x8012, 0x0001,
    0x0001, 0x3a10, 0x8024, 0xf400, 0x4480, 0x6016, 0x0024, 0x0000,
    0x0024, 0x2800, 0x9d91, 0x0000, 0x0024, 0x0000, 0x0012, 0x0000,
    0x0024, 0x0000, 0x5001, 0x0000, 0x0804, 0x0006, 0x79d0, 0x0006,
    0x0411, 0x3100, 0x2012, 0x0006, 0x0410, 0x6090, 0x0024, 0x3900,
    0x0024, 0x3000, 0x0024, 0x6012, 0x0024, 0x0000, 0x404e, 0x2800,
    0xa391, 0x0013, 0xaa40, 0x2400, 0xa24e, 0x0000, 0x0024, 0x0000,
    0x0401, 0x2900, 0x1300, 0xc890, 0x184c, 0x0000, 0x0024, 0x2910,
    0x0700, 0x0000, 0x1940, 0x2900, 0x0d80, 0x0013, 0xaa40, 0x0030,
    0x0850, 0x3800, 0x0024, 0x0030, 0x0490, 0x0000, 0x0000, 0x0006,
    0x0391, 0x3800, 0x0024, 0x3901, 0x4024, 0x36f3, 0x4024, 0x36f3,
    0xd80e, 0x36f4, 0x9813, 0x36f4, 0x1811, 0x36f1, 0x9807, 0x36f1,
    0x1805, 0x36f0, 0x9803, 0x36f0, 0x1801, 0x3405, 0x9014, 0x36f3,
    0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, 0x9817, 0x82a2,
    0x0030, 0x0653, 0x0030, 0x0351, 0x0000, 0xfa00, 0x0030, 0x0810,
    0x0030, 0x0012, 0x003f, 0xfdc3, 0x3e05, 0xb814, 0x3615, 0x0024,
    0x0000, 0x800a, 0x3810, 0x0024, 0x0013, 0xaa40, 0xb880, 0x2000,
    0x0006, 0x0190, 0x2900, 0x0400, 0x3900, 0x0024, 0x3200, 0x8004,
    0xb234, 0x984c, 0xc020, 0x0024, 0x3a00, 0x0024, 0x0000, 0x00c0,
    0x3be0, 0x0024, 0x0000, 0x02c0, 0x2910, 0x4500, 0x3b00, 0x0024,
    0x2916, 0x4780, 0x3613, 0x2004, 0x2911, 0xcb40, 0x3613, 0x0024,
    0x2914, 0x3340, 0x0000, 0x7d05, 0x2910, 0x9040, 0x6898, 0x184c,
    0x4182, 0x084c, 0x0000, 0x0302, 0x2800, 0xb255, 0x3200, 0x0024,
    0x003f, 0xfdc2, 0x2800, 0xb280, 0xb024, 0x0024, 0xc024, 0x0024,
    0x3a00, 0x8d4c, 0xb880, 0x984c, 0x3b00, 0x0024, 0x2911, 0xfe80,
    0x3b00, 0x0024, 0x0000, 0x7fce, 0x2400, 0xb50e, 0x0000, 0x0024,
    0x2900, 0x0e40, 0x3613, 0x0024, 0x0000, 0x0024, 0x0000, 0x1002,
    0x2900, 0xfa40, 0xbf8e, 0x184c, 0x4090, 0x4004, 0x0000, 0x0024,
    0x2800, 0xb3d5, 0x0000, 0x0024, 0x0000, 0x1045, 0x4584, 0x184c,
    0x2900, 0xfa40, 0xbf8e, 0x0024, 0x4080, 0x0024, 0x0000, 0x0024,
    0x2800, 0xbac5, 0x0000, 0x0024, 0x6498, 0x0024, 0x4480, 0x0024,
    0x0000, 0x0024, 0x2800, 0xb3c8, 0x0000, 0x0024, 0x2800, 0xb740,
    0x0000, 0x0024, 0x0000, 0x1402, 0x0000, 0x8006, 0x2900, 0xfa40,
    0xb88e, 0x184c, 0x4080, 0x0024, 0x0000, 0x0024, 0x2800, 0xb3d5,
    0x0000, 0x0024, 0x2901, 0x0380, 0x3613, 0x0024, 0x4080, 0x0024,
    0x0000, 0x0802, 0x2800, 0xcb95, 0x0030, 0x03d0, 0x3000, 0x0024,
    0xb020, 0x0024, 0x0000, 0x0024, 0x2800, 0xc005, 0x0000, 0x0024,
    0x2800, 0xc0c0, 0xf290, 0x038c, 0x003f, 0xffc4, 0x2901, 0x1ac0,
    0x3613, 0x038c, 0x3820, 0x184c, 0x6894, 0x0000, 0xb020, 0x0024,
    0x0000, 0x0024, 0x2800, 0xc485, 0x0000, 0x0024, 0x3009, 0x3841,
    0x2900, 0x1d40, 0x3009, 0x3840, 0x4084, 0x038c, 0x291d, 0x21c0,
    0x3000, 0x1bcc, 0x0030, 0x0310, 0x4180, 0x9801, 0x3800, 0x0024,
    0x0030, 0x0310, 0xf298, 0x0002, 0xb244, 0x0024, 0x2901, 0x1ac0,
    0x4288, 0x2002, 0x4080, 0x00cc, 0x0000, 0x0182, 0x2800, 0xcb98,
    0x0000, 0x0024, 0x3000, 0x0024, 0xb020, 0x0024, 0x0000, 0x0102,
    0x6024, 0x0024, 0x0006, 0x0391, 0x2800, 0xc9d5, 0x003f, 0xefc2,
    0x0000, 0x0402, 0x3000, 0x0024, 0xc024, 0x0024, 0x3800, 0x8024,
    0x003f, 0xefc2, 0x3000, 0x0024, 0xb020, 0x0024, 0x0000, 0x0202,
    0xc020, 0x0024, 0x6890, 0x2000, 0x2800, 0xcc80, 0x3900, 0x0024,
    0x0030, 0x0310, 0xb880, 0x0024, 0x2900, 0x0d80, 0x3800, 0x0024,
    0x0030, 0x0050, 0x003f, 0xfec2, 0x0006, 0x7e51, 0x0006, 0x7a92,
    0x0030, 0x0693, 0x3000, 0x0024, 0xb024, 0x0024, 0x0002, 0x8000,
    0x3830, 0xa400, 0x0001, 0x0000, 0x3009, 0x2800, 0x0000, 0x08c0,
    0xb880, 0x2c00, 0x3800, 0x0024, 0x0006, 0x0650, 0x3800, 0x0024,
    0x2913, 0x4280, 0x3613, 0x0024, 0x4080, 0x184c, 0x0000, 0x0024,
    0x2800, 0xd2d5, 0x0000, 0x0024, 0x2919, 0x6e40, 0x0000, 0xd088,
    0x3613, 0x0024, 0x2911, 0xfe80, 0x0000, 0xd088, 0x834d, 0x3e10,
    0x7807, 0x3e12, 0x380a, 0x3e11, 0x3805, 0x3e14, 0xf811, 0x0006,
    0x02d1, 0x31a0, 0x084c, 0x2800, 0xde00, 0xb182, 0x3806, 0x6d96,
    0x05c0, 0x4080, 0x184c, 0x0003, 0xffc7, 0x2800, 0xd785, 0x3223,
    0x050c, 0x2900, 0x1880, 0x489c, 0x44c4, 0x2800, 0xd940, 0xbcfe,
    0x0640, 0x2900, 0x19c0, 0x478a, 0x44c4, 0x6098, 0x0024, 0x0000,
    0x0001, 0x2800, 0xd955, 0x4c8e, 0x0640, 0x489c, 0x4147, 0x3009,
    0x0804, 0x4408, 0x070c, 0x4408, 0xab84, 0x0000, 0x0024, 0x2800,
    0xdb41, 0x6fda, 0x0401, 0x0000, 0x0024, 0x2800, 0xe145, 0x4f86,
    0x0024, 0x4898, 0x05cc, 0x0003, 0xffc5, 0x6fea, 0x4480, 0x0006,
    0x1d84, 0x2800, 0xe785, 0x6048, 0x084c, 0x3143, 0x0024, 0x2800,
    0xe798, 0xb182, 0x0680, 0x3233, 0x0024, 0xffb0, 0x084c, 0x48ba,
    0xab81, 0xffa0, 0x0440, 0x44ba, 0x05c1, 0x4ce2, 0x0684, 0x000c,
    0x8c45, 0x645a, 0xa840, 0x0000, 0x0024, 0x2800, 0xe3d5, 0x3193,
    0x2bc1, 0xc998, 0x088c, 0x2800, 0xe780, 0x3009, 0x2bc4, 0x4182,
    0x44c6, 0x0000, 0x0080, 0x2800, 0xe285, 0x460c, 0x0024, 0x460c,
    0x0024, 0x0000, 0x7fc0, 0xb60c, 0x0024, 0xf400, 0x4193, 0x2800,
    0xd555, 0x0000, 0x0024, 0x0000, 0x3fc6, 0xb26c, 0x0440, 0x4080,
    0x184c, 0x0fff, 0xfe04, 0x2800, 0xe645, 0x0000, 0x0021, 0x0000,
    0x1fc6, 0xb26c, 0x0024, 0x466c, 0x0024, 0x0fff, 0xfe44, 0xad42,
    0x0444, 0x466c, 0x0785, 0x4ce2, 0x4193, 0x2900, 0xe9c0, 0x0000,
    0xd548, 0x36f1, 0x8884, 0x0020, 0x0005, 0xc458, 0x4480, 0x32e3,
    0x1811, 0x36f4, 0xe804, 0x36f1, 0x1805, 0x36f2, 0x180a, 0x2000,
    0x0000, 0x36f0, 0x5807, 0x83a7, 0x3e10, 0xb806, 0x3e12, 0x380a,
    0x0000, 0x0246, 0x4112, 0xb812, 0xf212, 0x3847, 0x3e13, 0xf80e,
    0xac6e, 0x388d, 0x2900, 0xfa40, 0x0000, 0x1442, 0x003f, 0xc000,
    0x2900, 0x1300, 0x0000, 0x0201, 0x0000, 0x3fc2, 0x6024, 0x0024,
    0x0000, 0x3f82, 0x2800, 0xec05, 0x6024, 0x184c, 0x0000, 0x0140,
    0x2900, 0x0e55, 0x0000, 0xf208, 0x0000, 0x3fce, 0x2400, 0xf00e,
    0x0000, 0x0012, 0x2900, 0x12c0, 0x003f, 0xffc0, 0x3a10, 0x184c,
    0x003f, 0xffc0, 0x2900, 0x1300, 0x0000, 0x0401, 0x2900, 0x0e40,
    0x3613, 0x0024, 0x2900, 0x0e40, 0xb080, 0x184c, 0x36f3, 0x4024,
    0x36f3, 0xd80e, 0x36f1, 0xd812, 0x36f2, 0x180a, 0x2000, 0x0000,
    0x36f0, 0x9806, 0x83ce, 0x4c87, 0xe2e3, 0x0000, 0x3fc1, 0xb316,
    0x0024, 0x0000, 0xf755, 0xf400, 0x5544, 0x4c82, 0x0024, 0x0000,
    0x0024, 0x2800, 0xf6c5, 0x0000, 0x0024, 0xdcd2, 0x0024, 0x0000,
    0x0024, 0x2800, 0xf495, 0x0fff, 0xffc0, 0x2000, 0x0000, 0x36f0,
    0x9803, 0x0033, 0x504d, 0x0033, 0x504d, 0x0033, 0x504d, 0x0056,
    0x4157, 0x0041, 0x4d57, 0x0056, 0x4d57, 0x0046, 0x5341, 0x0043,
    0x4141, 0x0034, 0x504d, 0x0041, 0x344d, 0x0044, 0x494d, 0x0000,
    0x0000, 0x83e9, 0x3e10, 0x7803, 0x3e24, 0x3808, 0x2900, 0x0e40,
    0x0030, 0x0650, 0x2900, 0x0e40, 0xf296, 0x984c, 0xf236, 0x0000,
    0x0fff, 0xff41, 0xb012, 0x0024, 0xf236, 0x2001, 0x003f, 0xc000,
    0x2900, 0x1300, 0x0000, 0x0201, 0x0000, 0x0201, 0x2900, 0x1300,
    0xa210, 0x184c, 0x2900, 0x12c0, 0x4780, 0x184c, 0x2900, 0x12c0,
    0x4680, 0x188c, 0x0000, 0x0201, 0x2900, 0x1300, 0x0025, 0x4000,
    0x2801, 0x0100, 0x0001, 0xf402, 0x2900, 0x1300, 0x4680, 0x184c,
    0x4294, 0x0024, 0x0000, 0x2006, 0x2801, 0x02c5, 0xb06c, 0x0024,
    0x003f, 0xc006, 0x2801, 0x0095, 0x0000, 0x0201, 0x36f4, 0x1808,
    0x2000, 0x0000, 0x36f0, 0x5803, 0x840e, 0x3e11, 0xf812, 0x3e10,
    0x7802, 0x3e10, 0xf804, 0x3e11, 0x7806, 0x0006, 0x01d2, 0xbc82,
    0x380a, 0x3a10, 0x3888, 0x2900, 0xe9c0, 0x3af0, 0x4024, 0x2900,
    0x1880, 0x0000, 0x0d84, 0x0010, 0x5184, 0x000c, 0x5505, 0x6ce2,
    0x18cc, 0x0000, 0x0024, 0x2801, 0x0a05, 0x000c, 0xd505, 0x2900,
    0x1880, 0x0000, 0x1484, 0x0010, 0x5184, 0x6ce2, 0x184c, 0x0000,
    0x0024, 0x2801, 0x0a05, 0x0000, 0x7184, 0x2900, 0x1880, 0x3613,
    0x0024, 0x3a10, 0x0024, 0x2900, 0xe9c0, 0x3a50, 0x4024, 0x2900,
    0x19c0, 0x0000, 0x0e44, 0x3af0, 0x0024, 0x2900, 0x19c0, 0x0000,
    0x0444, 0x408e, 0x2a40, 0x0000, 0x02c4, 0x2801, 0x0d45, 0x6892,
    0x0acc, 0xb882, 0x0024, 0x2900, 0x19c0, 0x3a70, 0x584c, 0x0000,
    0x2001, 0xff82, 0x090c, 0x48b2, 0x184c, 0x2900, 0x0540, 0x0000,
    0x0344, 0xff90, 0x4046, 0x48b6, 0x984c, 0x3ac0, 0x8024, 0x2900,
    0x19c0, 0x0000, 0x0384, 0x3211, 0x0024, 0xffe0, 0x0a45, 0x4eb2,
    0x184c, 0x3a10, 0x0024, 0xb182, 0x2841, 0x2900, 0x19c0, 0x0000,
    0x0584, 0x4080, 0x2840, 0x3ac0, 0x584c, 0x2801, 0x1515, 0x3230,
    0x0024, 0x4080, 0x1bcc, 0x0000, 0x0904, 0x2801, 0x1945, 0x0000,
    0x02c0, 0x2900, 0x1880, 0x3613, 0x0024, 0x3a10, 0x184c, 0x3af0,
    0x4024, 0x2900, 0x0540, 0x0000, 0x0404, 0xffe0, 0x0842, 0x48ba,
    0x0b43, 0xffb8, 0x4103, 0x48b2, 0x0844, 0xffa6, 0x09c5, 0x40b2,
    0x888c, 0x4cea, 0x0a42, 0xb182, 0x41c0, 0x0fff, 0xff07, 0xac72,
    0x4043, 0x4ce2, 0x0bcc, 0x4224, 0x2844, 0x6cd2, 0x2845, 0xb880,
    0x2840, 0x3a00, 0x4024, 0x36f2, 0x9808, 0x36f1, 0x5806, 0x36f0,
    0xd804, 0x36f0, 0x5802, 0x2000, 0x0000, 0x36f1, 0xd812, 0x846b,
    0x3e10, 0x7802, 0x3e12, 0x3810, 0x3e10, 0xf812, 0x0006, 0x0012,
    0x3230, 0x0024, 0x4080, 0xb851, 0x0006, 0x01d1, 0x2801, 0x1e05,
    0x0020, 0x0003, 0x0000, 0x0082, 0xb886, 0x4452, 0x2900, 0xd340,
    0x0001, 0x20c8, 0x3210, 0x1bcc, 0x3260, 0x4024, 0xc132, 0x088c,
    0x3200, 0x8024, 0xf224, 0xa440, 0xb182, 0xa7c1, 0xf224, 0x4450,
    0xf224, 0x00cc, 0xf224, 0xa3c1, 0x3009, 0x2082, 0xf400, 0x4400,
    0x0006, 0x05d5, 0xf400, 0x4452, 0xb884, 0x3444, 0x3d00, 0x8024,
    0x2900, 0x2540, 0x3e10, 0x0024, 0x3009, 0x1bd1, 0x36f0, 0xd812,
    0x36f2, 0x1810, 0x2000, 0x0000, 0x36f0, 0x5802
};

/*#define CODE_SIZE 2316
const unsigned char atab[2316] = { // Register addresses
    0x7, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x7, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x7, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x7, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6,
    0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0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x6
};
const unsigned short dtab[2316] = { // Data to write
    0x8010, 0x2000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0024, 0x0000,
    0x0024, 0x2800, 0x48c0, 0x8030, 0x2919, 0xe240, 0x0000, 0x0510,
    0x2919, 0xe140, 0x0000, 0x0010, 0x2800, 0x0dc0, 0x0000, 0x0041,
    0x0000, 0x0001, 0x2800, 0x9d00, 0x0006, 0x2016, 0x8039, 0x3e13,
    0xb80f, 0x0000, 0x0055, 0x0030, 0x0497, 0x3f75, 0x780d, 0x0000,
    0x03ce, 0x2400, 0x11ce, 0x0000, 0x0024, 0x0000, 0x0024, 0x2800,
    0x1080, 0x0000, 0x02d5, 0x3f05, 0x4024, 0x0000, 0x0024, 0x2800,
    0x1180, 0x0000, 0x00d5, 0x3f05, 0x4024, 0x3009, 0x1bcd, 0x2000,
    0x0000, 0x36f3, 0x980f, 0x804b, 0x0000, 0x0401, 0x3e11, 0xb804,
    0x3e13, 0x7805, 0x0000, 0x0244, 0x0000, 0x0046, 0x419a, 0x380e,
    0x4cc2, 0xb80f, 0x0030, 0x0497, 0x2400, 0x1745, 0x0fff, 0xff45,
    0x0000, 0x0024, 0x0000, 0x0024, 0x3f60, 0x4024, 0x3710, 0x4024,
    0x3f01, 0x0024, 0xa152, 0x0024, 0x0000, 0x0024, 0x0000, 0x0024,
    0x8cc2, 0x3e46, 0x36f3, 0x980f, 0x36f3, 0x5805, 0x2000, 0x0000,
    0x36f1, 0x9804, 0x8015, 0x3e12, 0x3805, 0x2900, 0x19c0, 0x0000,
    0x3fc5, 0x3602, 0x0024, 0x2000, 0x0000, 0xb500, 0x9bc5, 0x8062,
    0x6492, 0xb808, 0x2900, 0x19c0, 0x6198, 0x3844, 0x3009, 0x1808,
    0x4082, 0x1804, 0x0000, 0x0015, 0xf240, 0x3814, 0xf400, 0x4014,
    0x3583, 0x3801, 0x3510, 0x4024, 0x0000, 0x0204, 0x2800, 0x1c11,
    0x3500, 0x0024, 0xac42, 0x0024, 0x0000, 0x0020, 0x6848, 0x4800,
    0xac42, 0x1814, 0x2000, 0x0000, 0xc100, 0x9bc1, 0x8075, 0x0006,
    0x0197, 0x3e00, 0x5c00, 0x000f, 0xd641, 0xfe10, 0x0024, 0x0008,
    0xd4c0, 0x4cb2, 0x0024, 0xf200, 0xbc00, 0x2000, 0x0000, 0x36f0,
    0x4024, 0x807e, 0x0000, 0x07c0, 0x0030, 0x0497, 0x0000, 0x0055,
    0x4090, 0x3c15, 0x0000, 0x0015, 0x2800, 0x2014, 0x3f05, 0x4024,
    0x2000, 0x0000, 0x0000, 0x0024, 0x8087, 0x3e12, 0xb817, 0x3e12,
    0x3815, 0x3e05, 0xb814, 0x3625, 0x0024, 0x0000, 0x800a, 0x3e10,
    0x7802, 0x3e10, 0xf804, 0x3e11, 0x7806, 0x3e11, 0xf810, 0x3e14,
    0x7813, 0x3e13, 0xf80e, 0x3e03, 0x4842, 0x2800, 0x4500, 0xb88a,
    0x8bc3, 0x2900, 0x0540, 0x4588, 0x184c, 0xf400, 0x4007, 0x0000,
    0x3940, 0x6700, 0x0024, 0x0000, 0x02c1, 0x2800, 0x3ec5, 0x478e,
    0x0024, 0x0000, 0x0024, 0x2800, 0x3ec5, 0x0000, 0x0024, 0x2900,
    0x0540, 0x4518, 0x184c, 0x0000, 0x0401, 0x3413, 0x0024, 0xb010,
    0xb3c0, 0x0000, 0x0b80, 0x2800, 0x3185, 0x6700, 0x0024, 0x0000,
    0x0501, 0x2800, 0x3185, 0x0000, 0x0024, 0x0000, 0x0686, 0x4518,
    0x184c, 0x3009, 0x3852, 0x3e10, 0xf802, 0x0000, 0x0002, 0x3009,
    0x3852, 0x2900, 0x19c0, 0x3009, 0x3840, 0x4086, 0x984c, 0x2900,
    0x19c0, 0x4568, 0x0024, 0xb182, 0x134c, 0x2900, 0xd340, 0x4dc6,
    0x10d2, 0x34d3, 0x1bcc, 0x3600, 0xd802, 0x3e10, 0x0024, 0x2900,
    0x21c0, 0x3434, 0x8024, 0x4080, 0x1bcc, 0x3009, 0x1812, 0x2800,
    0x3118, 0x4d82, 0x0024, 0x2800, 0x45c0, 0xc890, 0x1bcc, 0x2900,
    0xe9c0, 0x0000, 0x3ec8, 0x0000, 0x3781, 0x3413, 0x0024, 0x3009,
    0x13c0, 0xb010, 0x0024, 0x0000, 0x0024, 0x2800, 0x3ed5, 0x0000,
    0x0024, 0x0000, 0x0206, 0x2900, 0x1880, 0x4568, 0x184c, 0x2900,
    0xf380, 0x3613, 0x0024, 0x4080, 0x0024, 0x0000, 0x0024, 0x2800,
    0x3ec5, 0x0000, 0x0024, 0x0006, 0x0610, 0x30f1, 0x0024, 0x6498,
    0x0040, 0x4090, 0x23c4, 0x6090, 0x2000, 0x0000, 0x0001, 0x2800,
    0x3ed5, 0xf150, 0x0024, 0x0000, 0x014e, 0x4010, 0x0024, 0x0006,
    0x0010, 0xf400, 0x4011, 0x2400, 0x390e, 0x3110, 0x0024, 0x3110,
    0x2040, 0x0006, 0x0253, 0x0000, 0x0706, 0x2900, 0x1880, 0x4568,
    0x984c, 0x0000, 0x0686, 0x3b10, 0x184c, 0x3bf0, 0x7802, 0x0000,
    0x0002, 0x0000, 0x0501, 0x4518, 0x3843, 0x0000, 0x0001, 0x3009,
    0x3852, 0x2900, 0x19c0, 0x3009, 0x3840, 0x4086, 0x984c, 0x2900,
    0x19c0, 0x4568, 0x0024, 0x4dc6, 0x0024, 0x2900, 0xd340, 0x0006,
    0x01d2, 0x2800, 0x45c0, 0xc890, 0x9b92, 0x0000, 0x0801, 0x451a,
    0x4140, 0x0000, 0x7fc1, 0xb51a, 0x0024, 0x458a, 0x0024, 0x0000,
    0x0024, 0x2800, 0x2555, 0x0000, 0x0024, 0x6d96, 0x4490, 0x3023,
    0x0024, 0x3009, 0x0000, 0x4090, 0x0024, 0x3009, 0x2000, 0x2800,
    0x4515, 0x0000, 0x0024, 0x30e3, 0x08cc, 0x3009, 0x0040, 0x3009,
    0x03c1, 0x4c82, 0x8842, 0x3009, 0x0bc3, 0x2800, 0x4518, 0x0000,
    0x0024, 0x0006, 0x0611, 0x2800, 0x45c0, 0x3100, 0x0b4c, 0x4d82,
    0x184c, 0x2900, 0xe9c0, 0x0000, 0x2548, 0x36f3, 0x4024, 0x36f3,
    0xd80e, 0x36f4, 0x5813, 0x36f1, 0xd810, 0x36f1, 0x5806, 0x36f0,
    0xd804, 0x36f0, 0x5802, 0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2,
    0x1815, 0x2000, 0x0000, 0x36f2, 0x9817, 0x8123, 0x3613, 0x0024,
    0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, 0x0024,
    0x0000, 0x800a, 0x3e10, 0x3801, 0x0000, 0x0401, 0x3e10, 0xb803,
    0x3e11, 0x3805, 0x3e11, 0xb807, 0x3e14, 0x3811, 0x0030, 0x03d1,
    0x0006, 0x0390, 0x3e14, 0xb813, 0x3e13, 0xf80e, 0x3e03, 0x4024,
    0x3001, 0x4024, 0x3100, 0x0024, 0xb010, 0x0024, 0x0013, 0x5501,
    0x2800, 0x5245, 0x458a, 0x0024, 0x0006, 0x1e50, 0x2800, 0x5405,
    0x0000, 0x0024, 0x0006, 0x79d3, 0x0006, 0x03d2, 0xb88b, 0xa530,
    0x31a3, 0x2000, 0x3100, 0x0024, 0x6012, 0x0024, 0x0006, 0x7a10,
    0x2800, 0x5415, 0x3009, 0x0000, 0x6090, 0x0024, 0x2800, 0x5400,
    0x3009, 0x2c00, 0x0006, 0x79d0, 0x2800, 0x5415, 0x0000, 0x0024,
    0x0006, 0x1e53, 0x0006, 0x03d2, 0x3201, 0x4c00, 0x3009, 0x2000,
    0x0020, 0x0001, 0x0030, 0x0310, 0x3000, 0x0024, 0xb010, 0x0024,
    0x0000, 0x0024, 0x2800, 0x57c5, 0x4590, 0x0024, 0x3000, 0x184c,
    0xf292, 0x0024, 0xb010, 0x0024, 0x2900, 0x0e40, 0x3800, 0x0024,
    0x2900, 0x0d80, 0x0000, 0x0024, 0x4590, 0x0024, 0x0000, 0x0181,
    0x2800, 0x5d55, 0x0030, 0x03d0, 0x0006, 0x0590, 0x0006, 0x0452,
    0x0006, 0x0251, 0x0000, 0x0085, 0x3110, 0x0024, 0x31f0, 0x4024,
    0x0006, 0x0211, 0x6c92, 0x0024, 0x0000, 0x0020, 0xf2c2, 0x0024,
    0x3a10, 0x0024, 0x0006, 0x01c0, 0x3af0, 0x47c1, 0x38d0, 0x0480,
    0x3810, 0x0400, 0x3810, 0x4024, 0x0000, 0x0181, 0x3800, 0x0024,
    0x0030, 0x03d0, 0x30a0, 0x0024, 0xb010, 0x0024, 0x0000, 0x0081,
    0x6012, 0x0024, 0x001d, 0x9941, 0x2800, 0x6295, 0x0000, 0x0024,
    0x3000, 0x0024, 0x6012, 0x0024, 0x0030, 0x0110, 0x2800, 0x6295,
    0x0000, 0x0024, 0x0006, 0x0691, 0x3000, 0x0024, 0x3100, 0x4024,
    0x6014, 0x0024, 0x0000, 0x0024, 0x2800, 0x6281, 0x0000, 0x0024,
    0x3100, 0x0024, 0x3800, 0x0024, 0x0000, 0x0080, 0x6500, 0x0024,
    0x0000, 0x0241, 0x2800, 0x6e15, 0x0006, 0x04d0, 0x0000, 0x1442,
    0x3011, 0x984c, 0x30f1, 0xc024, 0x2900, 0xfa40, 0xaf1e, 0x0024,
    0x0000, 0x00c1, 0x3010, 0x8024, 0x3010, 0xc024, 0x6d96, 0x0380,
    0x4090, 0x2042, 0x3810, 0xc024, 0x2800, 0x6a15, 0x0006, 0x0411,
    0x3013, 0x0024, 0x3000, 0x0024, 0x4010, 0x0024, 0x3800, 0x0024,
    0x30d4, 0x4024, 0x3009, 0x0440, 0x3810, 0x07c1, 0x3820, 0x4024,
    0x30f4, 0x4024, 0x3123, 0x0024, 0x3009, 0x0400, 0x0006, 0x0411,
    0x0000, 0xc801, 0x0006, 0x0652, 0xb880, 0x2000, 0x3900, 0x0024,
    0x3200, 0x0024, 0x6090, 0x0024, 0x6012, 0x2800, 0x0000, 0x00c5,
    0x2800, 0x6e15, 0x0000, 0x0024, 0x0030, 0x0253, 0x3300, 0x0024,
    0x4080, 0x0024, 0x0030, 0x03d0, 0x2800, 0x89c5, 0x0000, 0x0181,
    0x0000, 0x00c0, 0x6500, 0x0024, 0x0000, 0x0100, 0x2800, 0x7415,
    0x0000, 0x0201, 0x003f, 0xc000, 0x2900, 0x1300, 0x3613, 0x0024,
    0x0000, 0x3f81, 0x6012, 0x0024, 0x0006, 0x0410, 0x2800, 0x7215,
    0x0000, 0x0000, 0x0000, 0x0105, 0x2800, 0x9880, 0x3800, 0x0024,
    0x3000, 0x0024, 0x6090, 0x0024, 0x4080, 0x2000, 0x0000, 0x0024,
    0x2800, 0x9898, 0x0000, 0x0024, 0x2900, 0x0d80, 0x0000, 0x9888,
    0x6500, 0x0024, 0x0000, 0x0140, 0x2800, 0x8e95, 0x0006, 0x0450,
    0x3010, 0x0024, 0x30f0, 0x4024, 0x4c82, 0x0024, 0x0000, 0xf601,
    0x2800, 0x8749, 0x0000, 0x0024, 0x291a, 0x22c0, 0x3613, 0x0024,
    0x6012, 0x0024, 0x0000, 0x0041, 0x2800, 0x8758, 0x0006, 0x0451,
    0x0006, 0x79d0, 0x0000, 0x0802, 0x3111, 0x8012, 0xfe22, 0x07c7,
    0x48b2, 0x0024, 0x6cfe, 0x0024, 0x0000, 0x0004, 0x2800, 0x7ac9,
    0x6420, 0x0024, 0xb888, 0x0442, 0x6420, 0x07c3, 0x0000, 0x0024,
    0x2800, 0x7f18, 0x4290, 0x0024, 0x2400, 0x7ec0, 0x0000, 0x0024,
    0x0000, 0x0401, 0x2900, 0x1300, 0xc890, 0x184c, 0x0001, 0x0001,
    0x3a10, 0x0024, 0xf400, 0x4480, 0x6016, 0x0024, 0x0000, 0x0024,
    0x2800, 0x7ed1, 0x0000, 0x0024, 0x0000, 0x0012, 0x6498, 0x0024,
    0x0006, 0x0413, 0x0006, 0x0451, 0x0000, 0x0041, 0x0006, 0x79d0,
    0x3111, 0xa012, 0xfe22, 0x07c7, 0x6fb2, 0x0024, 0x3910, 0x0024,
    0x39f0, 0x4024, 0x0000, 0x0801, 0x3300, 0x0024, 0x4012, 0x0024,
    0x0000, 0x4000, 0x6100, 0x2c01, 0x0006, 0x0450, 0x2800, 0x8451,
    0x0000, 0x0401, 0x2900, 0x1300, 0xc890, 0x184c, 0x2800, 0x8740,
    0x0000, 0x0085, 0x3010, 0x0024, 0x30f0, 0x4024, 0x4c82, 0x0024,
    0x0000, 0xf601, 0x2800, 0x8749, 0x0000, 0x0024, 0x291a, 0x22c0,
    0x3613, 0x0024, 0x6012, 0x0024, 0x0006, 0x0451, 0x2800, 0x7808,
    0x0000, 0x0041, 0x0006, 0x0451, 0x0030, 0x0850, 0x0013, 0xaa40,
    0x3800, 0x0024, 0x3110, 0x0024, 0x31f0, 0x4024, 0x4c82, 0x0024,
    0x0030, 0x03d0, 0x2800, 0x9899, 0x0000, 0x0181, 0x2900, 0x0e40,
    0x3613, 0x0024, 0x30d0, 0x0024, 0xb010, 0x0024, 0x0000, 0x0081,
    0x6012, 0x0024, 0x0000, 0x0145, 0x2800, 0x8d95, 0x6892, 0x0024,
    0x0006, 0x0692, 0x0030, 0x0111, 0x689a, 0x0400, 0x6090, 0x0024,
    0x2800, 0x9880, 0x3a00, 0x0024, 0x3000, 0x0024, 0x4012, 0x0024,
    0x2800, 0x9880, 0x3800, 0x4024, 0x6500, 0x0024, 0x0030, 0x0850,
    0x2800, 0x9855, 0x0013, 0xaa40, 0x4112, 0x184c, 0x2900, 0x1300,
    0xc890, 0x0024, 0x0000, 0xf601, 0x291a, 0x22c0, 0x3613, 0x0024,
    0x6012, 0x0024, 0x0000, 0x07ce, 0x2800, 0x97d8, 0x0006, 0x79d0,
    0x2400, 0x948e, 0xb884, 0x8012, 0x0001, 0x0001, 0x3a10, 0x8024,
    0xf400, 0x4480, 0x6016, 0x0024, 0x0000, 0x0024, 0x2800, 0x9491,
    0x0000, 0x0024, 0x0000, 0x0012, 0x0000, 0x0024, 0x0000, 0x0801,
    0x0006, 0x0411, 0x0006, 0x79d0, 0x3100, 0x2012, 0x4012, 0x0024,
    0x0002, 0x4000, 0x6100, 0x2401, 0x0000, 0x0024, 0x2800, 0x97d1,
    0x0000, 0x0024, 0x2900, 0x0d80, 0x0000, 0x0024, 0x0030, 0x0850,
    0x0013, 0xaa40, 0x3800, 0x0024, 0x0006, 0x0391, 0x0000, 0x0000,
    0x0030, 0x0490, 0x3800, 0x0024, 0x3901, 0x4024, 0x36f3, 0x4024,
    0x36f3, 0xd80e, 0x36f4, 0x9813, 0x36f4, 0x1811, 0x36f1, 0x9807,
    0x36f1, 0x1805, 0x36f0, 0x9803, 0x36f0, 0x1801, 0x3405, 0x9014,
    0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, 0x9817,
    0x8274, 0x0030, 0x0653, 0x0030, 0x0012, 0x0030, 0x0351, 0x0030,
    0x0810, 0x0000, 0xfa00, 0x003f, 0xfdc2, 0x3e05, 0xb814, 0x3615,
    0x0024, 0x0000, 0x800a, 0x3810, 0x0024, 0x0013, 0xaa40, 0xb880,
    0x2000, 0x0006, 0x0190, 0x3900, 0x0024, 0x3200, 0x0024, 0xb024,
    0x0024, 0x2900, 0x0400, 0x3a00, 0x8024, 0x3200, 0x8004, 0xc200,
    0x984c, 0x3a00, 0x0024, 0x0000, 0x00c0, 0x3be0, 0x0024, 0x0000,
    0x02c0, 0x2910, 0x4500, 0x3b00, 0x0024, 0x3373, 0x2004, 0xb880,
    0x984c, 0x2916, 0x4780, 0x3b00, 0x0024, 0x2911, 0xcb40, 0x3613,
    0x0024, 0x2914, 0x3340, 0x0000, 0x7d05, 0x2910, 0x9040, 0x6898,
    0x184c, 0x4182, 0x084c, 0x0000, 0x0302, 0x2800, 0xa7d5, 0x3200,
    0x0024, 0x003f, 0xfdc2, 0x2800, 0xa800, 0xb024, 0x0024, 0xc024,
    0x0024, 0x0000, 0x1045, 0x0006, 0x6011, 0x0001, 0x0390, 0xb880,
    0x2802, 0x3904, 0x0f8c, 0x3b00, 0x184c, 0x2911, 0xfe80, 0x3b00,
    0x0024, 0x0000, 0x7fce, 0x2400, 0xab4e, 0x0000, 0x0024, 0x2900,
    0x0e40, 0x3613, 0x0024, 0x0000, 0x0024, 0x0000, 0x1002, 0x2900,
    0xfa40, 0xbf8e, 0x184c, 0x4090, 0x4004, 0x0000, 0x0024, 0x2800,
    0xaa15, 0x0000, 0x0024, 0x4584, 0x184c, 0x2900, 0xfa40, 0xbf8e,
    0x0024, 0x4080, 0x0024, 0x0000, 0x0024, 0x2800, 0xb0c5, 0x0000,
    0x0024, 0x6498, 0x0024, 0x4480, 0x0024, 0x0000, 0x0024, 0x2800,
    0xaa08, 0x0000, 0x0024, 0x2800, 0xad40, 0x0000, 0x0024, 0x0000,
    0x8006, 0x0000, 0x1402, 0x2900, 0xfa40, 0xb88e, 0x184c, 0x4080,
    0x0024, 0x0000, 0x0024, 0x2800, 0xaa15, 0x0000, 0x0024, 0x2901,
    0x0880, 0x3613, 0x0024, 0x4080, 0x0024, 0x0030, 0x0350, 0x2800,
    0xcb95, 0x0000, 0x0024, 0x003f, 0xffc4, 0x2901, 0x1fc0, 0x3613,
    0x0024, 0x6894, 0x2080, 0x3000, 0x184c, 0xb020, 0x0024, 0x0000,
    0x0024, 0x2800, 0xb8c5, 0x0000, 0x0024, 0x3009, 0x3841, 0x2900,
    0x1d40, 0x3009, 0x3840, 0x4084, 0x038c, 0x291d, 0x21c0, 0x3000,
    0x1bcc, 0x0030, 0x0310, 0x4180, 0x9801, 0x3800, 0x0024, 0x0030,
    0x0310, 0xf294, 0x0004, 0xb428, 0x0024, 0x2901, 0x1fc0, 0x3801,
    0x0024, 0x4080, 0x0024, 0x0006, 0x01d1, 0x2800, 0xcb98, 0x0000,
    0x0024, 0x0000, 0x0cc7, 0x0000, 0x3fc5, 0x0011, 0x1246, 0x3613,
    0x0024, 0x3009, 0x3841, 0x3009, 0x0440, 0x2900, 0xe9c0, 0x3009,
    0x07c1, 0x2900, 0x1880, 0xb888, 0x984c, 0x4898, 0x0024, 0x4c86,
    0x9bc1, 0xbde6, 0x0024, 0x6dfe, 0x0024, 0x0000, 0x0182, 0x2800,
    0xc7d5, 0x0030, 0x03d0, 0x0000, 0x01c4, 0x2900, 0x0540, 0x3613,
    0x0024, 0x4088, 0x184c, 0x0000, 0x0140, 0xa408, 0x0024, 0x3009,
    0x3844, 0x2900, 0x0540, 0x0000, 0x0204, 0x3123, 0x1bc4, 0xf200,
    0x0024, 0xf200, 0x0024, 0x4408, 0x8400, 0x6404, 0x0024, 0x0006,
    0x0250, 0x2800, 0xc411, 0x0006, 0x0253, 0x3009, 0x0404, 0x4498,
    0x0024, 0x0006, 0x01d2, 0x4484, 0x8846, 0xb386, 0x8bc7, 0x4fd6,
    0x0024, 0x0000, 0x8006, 0xff68, 0xa842, 0x3009, 0x2bc3, 0x3009,
    0x0c02, 0x6240, 0x0042, 0x30f0, 0xec00, 0x6dbe, 0x0024, 0x0000,
    0x0182, 0x3811, 0x8024, 0x38f1, 0xc024, 0x0030, 0x03d0, 0x3000,
    0x0024, 0xb020, 0x0024, 0x0000, 0x0102, 0x6024, 0x0024, 0x0006,
    0x0652, 0x2800, 0xca95, 0x6890, 0x0024, 0x0000, 0x0602, 0x3000,
    0x0024, 0xc024, 0x0024, 0x6890, 0x2002, 0x0006, 0x0391, 0xb880,
    0x2400, 0x2800, 0xcc80, 0x3a00, 0x0024, 0x0030, 0x0310, 0xb880,
    0x0024, 0x2900, 0x0d80, 0x3800, 0x0024, 0x0030, 0x0693, 0x0006,
    0x7a92, 0x0006, 0x7e51, 0x003f, 0xfec2, 0x0030, 0x0050, 0x3000,
    0x0024, 0xb024, 0x0024, 0x0002, 0x8000, 0x3830, 0xa400, 0x0001,
    0x0000, 0x3009, 0x2800, 0x0000, 0x08c0, 0xb880, 0x2c00, 0x3800,
    0x0024, 0x0006, 0x0690, 0x3800, 0x0024, 0x2913, 0x4280, 0x3613,
    0x0024, 0x4080, 0x184c, 0x0000, 0x0024, 0x2800, 0xd2d5, 0x0000,
    0x0024, 0x2919, 0x6e40, 0x0000, 0xd088, 0x3613, 0x0024, 0x2911,
    0xfe80, 0x0000, 0xd088, 0x834d, 0x3e10, 0x7807, 0x3e12, 0x380a,
    0x3e11, 0x3805, 0x3e14, 0xf811, 0x0006, 0x02d1, 0x31a0, 0x084c,
    0x2800, 0xde00, 0xb182, 0x3806, 0x6d96, 0x05c0, 0x4080, 0x184c,
    0x0003, 0xffc7, 0x2800, 0xd785, 0x3223, 0x050c, 0x2900, 0x1880,
    0x489c, 0x44c4, 0x2800, 0xd940, 0xbcfe, 0x0640, 0x2900, 0x19c0,
    0x478a, 0x44c4, 0x6098, 0x0024, 0x0000, 0x0001, 0x2800, 0xd955,
    0x4c8e, 0x0640, 0x489c, 0x4147, 0x3009, 0x0804, 0x4408, 0x070c,
    0x4408, 0xab84, 0x0000, 0x0024, 0x2800, 0xdb41, 0x6fda, 0x0401,
    0x0000, 0x0024, 0x2800, 0xe145, 0x4f86, 0x0024, 0x4898, 0x05cc,
    0x0003, 0xffc5, 0x6fea, 0x4480, 0x0006, 0x1d84, 0x2800, 0xe785,
    0x6048, 0x084c, 0x3143, 0x0024, 0x2800, 0xe798, 0xb182, 0x0680,
    0x3233, 0x0024, 0xffb0, 0x084c, 0x48ba, 0xab81, 0xffa0, 0x0440,
    0x44ba, 0x05c1, 0x4ce2, 0x0684, 0x000c, 0x8c45, 0x645a, 0xa840,
    0x0000, 0x0024, 0x2800, 0xe3d5, 0x3193, 0x2bc1, 0xc998, 0x088c,
    0x2800, 0xe780, 0x3009, 0x2bc4, 0x4182, 0x44c6, 0x0000, 0x0080,
    0x2800, 0xe285, 0x460c, 0x0024, 0x460c, 0x0024, 0x0000, 0x7fc0,
    0xb60c, 0x0024, 0xf400, 0x4193, 0x2800, 0xd555, 0x0000, 0x0024,
    0x0000, 0x3fc6, 0xb26c, 0x0440, 0x4080, 0x184c, 0x0fff, 0xfe04,
    0x2800, 0xe645, 0x0000, 0x0021, 0x0000, 0x1fc6, 0xb26c, 0x0024,
    0x466c, 0x0024, 0x0fff, 0xfe44, 0xad42, 0x0444, 0x466c, 0x0785,
    0x4ce2, 0x4193, 0x2900, 0xe9c0, 0x0000, 0xd548, 0x36f1, 0x8884,
    0x0020, 0x0005, 0xc458, 0x4480, 0x32e3, 0x1811, 0x36f4, 0xe804,
    0x36f1, 0x1805, 0x36f2, 0x180a, 0x2000, 0x0000, 0x36f0, 0x5807,
    0x83a7, 0x3e10, 0xb806, 0x3e12, 0x380a, 0x0000, 0x0246, 0x4112,
    0xb812, 0xf212, 0x3847, 0x3e13, 0xf80e, 0xac6e, 0x388d, 0x2900,
    0xfa40, 0x0000, 0x1442, 0x003f, 0xc000, 0x2900, 0x1300, 0x0000,
    0x0201, 0x0000, 0x3fc2, 0x6024, 0x0024, 0x0000, 0x3f82, 0x2800,
    0xec05, 0x6024, 0x184c, 0x0000, 0x0140, 0x2900, 0x0e55, 0x0000,
    0xf208, 0x0000, 0x3fce, 0x2400, 0xf00e, 0x0000, 0x0012, 0x2900,
    0x12c0, 0x003f, 0xffc0, 0x3a10, 0x184c, 0x003f, 0xffc0, 0x2900,
    0x1300, 0x0000, 0x0401, 0x2900, 0x0e40, 0x3613, 0x0024, 0x2900,
    0x0e40, 0xb080, 0x184c, 0x36f3, 0x4024, 0x36f3, 0xd80e, 0x36f1,
    0xd812, 0x36f2, 0x180a, 0x2000, 0x0000, 0x36f0, 0x9806, 0x83ce,
    0x4c87, 0xe2e3, 0x0000, 0x3fc1, 0xb316, 0x0024, 0x0000, 0xf755,
    0xf400, 0x5544, 0x4c82, 0x0024, 0x0000, 0x0024, 0x2800, 0xf6c5,
    0x0000, 0x0024, 0xdcd2, 0x0024, 0x0000, 0x0024, 0x2800, 0xf495,
    0x0fff, 0xffc0, 0x2000, 0x0000, 0x36f0, 0x9803, 0x0033, 0x504d,
    0x0033, 0x504d, 0x0033, 0x504d, 0x0056, 0x4157, 0x0044, 0x494d,
    0x0041, 0x4d57, 0x0056, 0x4d57, 0x0046, 0x5341, 0x0043, 0x4141,
    0x0034, 0x504d, 0x0041, 0x344d, 0x0000, 0x0000, 0x83e9, 0x3e10,
    0x7803, 0x3e24, 0x3808, 0x2900, 0x0e40, 0x0030, 0x0650, 0x2900,
    0x0e40, 0xf296, 0x984c, 0xf236, 0x0000, 0x0fff, 0xff41, 0xb012,
    0x0024, 0xf236, 0x2001, 0x003f, 0xc000, 0x2900, 0x1300, 0x0000,
    0x0201, 0x0000, 0x0201, 0x2900, 0x1300, 0xa210, 0x184c, 0x2900,
    0x12c0, 0x4780, 0x184c, 0x2900, 0x12c0, 0x4680, 0x188c, 0x0000,
    0x0201, 0x2900, 0x1300, 0x0025, 0x4000, 0x2801, 0x0100, 0x0001,
    0xf402, 0x2900, 0x1300, 0x4680, 0x184c, 0x4294, 0x0024, 0x0000,
    0x2006, 0x2801, 0x02c5, 0xb06c, 0x0024, 0x003f, 0xc006, 0x2801,
    0x0095, 0x0000, 0x0201, 0x36f4, 0x1808, 0x2000, 0x0000, 0x36f0,
    0x5803, 0x840e, 0x3613, 0x0024, 0x3e12, 0xb804, 0x0000, 0x800a,
    0x0000, 0x0204, 0x6142, 0xb802, 0x0006, 0x5e55, 0x2801, 0x07d5,
    0x3009, 0x1402, 0x6298, 0x4097, 0x3009, 0x3404, 0x0010, 0x0004,
    0x6248, 0x1c01, 0xf400, 0x4117, 0x2801, 0x0784, 0x0030, 0x0395,
    0x3009, 0x1c01, 0x3d00, 0x4024, 0x3009, 0x1bc2, 0x2000, 0x0000,
    0x36f2, 0x9804, 0x8422, 0x3e11, 0xf812, 0x3e10, 0x7802, 0x3e10,
    0xf804, 0x3e11, 0x7806, 0x0006, 0x01d2, 0xbc82, 0x380a, 0x3a10,
    0x3888, 0x2900, 0xe9c0, 0x3af0, 0x4024, 0x2900, 0x1880, 0x0000,
    0x0d84, 0x0010, 0x5184, 0x000c, 0x5505, 0x6ce2, 0x18cc, 0x0000,
    0x0024, 0x2801, 0x0f05, 0x000c, 0xd505, 0x2900, 0x1880, 0x0000,
    0x1484, 0x0010, 0x5184, 0x6ce2, 0x184c, 0x0000, 0x0024, 0x2801,
    0x0f05, 0x0000, 0x7184, 0x2900, 0x1880, 0x3613, 0x0024, 0x3a10,
    0x0024, 0x2900, 0xe9c0, 0x3a50, 0x4024, 0x2900, 0x19c0, 0x0000,
    0x0e44, 0x3af0, 0x0024, 0x2900, 0x19c0, 0x0000, 0x0444, 0x408e,
    0x2a40, 0x0000, 0x02c4, 0x2801, 0x1245, 0x6892, 0x0acc, 0xb882,
    0x0024, 0x2900, 0x19c0, 0x3a70, 0x584c, 0x0000, 0x2001, 0xff82,
    0x090c, 0x48b2, 0x184c, 0x2900, 0x0540, 0x0000, 0x0344, 0xff90,
    0x4046, 0x48b6, 0x984c, 0x3ac0, 0x8024, 0x2900, 0x19c0, 0x0000,
    0x0384, 0x3211, 0x0024, 0xffe0, 0x0a45, 0x4eb2, 0x184c, 0x3a10,
    0x0024, 0xb182, 0x2841, 0x2900, 0x19c0, 0x0000, 0x0584, 0x4080,
    0x2840, 0x3ac0, 0x584c, 0x2801, 0x1a15, 0x3230, 0x0024, 0x4080,
    0x1bcc, 0x0000, 0x0904, 0x2801, 0x1e45, 0x0000, 0x02c0, 0x2900,
    0x1880, 0x3613, 0x0024, 0x3a10, 0x184c, 0x3af0, 0x4024, 0x2900,
    0x0540, 0x0000, 0x0404, 0xffe0, 0x0842, 0x48ba, 0x0b43, 0xffb8,
    0x4103, 0x48b2, 0x0844, 0xffa6, 0x09c5, 0x40b2, 0x888c, 0x4cea,
    0x0a42, 0xb182, 0x41c0, 0x0fff, 0xff07, 0xac72, 0x4043, 0x4ce2,
    0x0bcc, 0x4224, 0x2844, 0x6cd2, 0x2845, 0xb880, 0x2840, 0x3a00,
    0x4024, 0x36f2, 0x9808, 0x36f1, 0x5806, 0x36f0, 0xd804, 0x36f0,
    0x5802, 0x2000, 0x0000, 0x36f1, 0xd812, 0x847f, 0x3e10, 0x7802,
    0x3e12, 0x3810, 0x3e10, 0xf812, 0x0006, 0x0012, 0x3230, 0x0024,
    0x4080, 0xb851, 0x0006, 0x01d1, 0x2801, 0x2305, 0x0020, 0x0003,
    0x0000, 0x0082, 0xb886, 0x4452, 0x2900, 0xd340, 0x0001, 0x25c8,
    0x3210, 0x1bcc, 0x3260, 0x4024, 0xc132, 0x088c, 0x3200, 0x8024,
    0xf224, 0xa440, 0xb182, 0xa7c1, 0xf224, 0x4450, 0xf224, 0x00cc,
    0xf224, 0xa3c1, 0x3009, 0x2082, 0xf400, 0x4400, 0x0006, 0x05d5,
    0xf400, 0x4452, 0xb884, 0x3444, 0x3d00, 0x8024, 0x2900, 0x21c0,
    0x3e10, 0x0024, 0x3009, 0x1bd1, 0x36f0, 0xd812, 0x36f2, 0x1810,
    0x2000, 0x0000, 0x36f0, 0x5802
};  */

/* Writing to DSP control registers follow these steps:
    CS_Low();
    send command
    send register command applies to
    send or receive 16 bit value
    CS_High();
*/

/*******DSP_Init()**************
  Initializes the DSP with application code and also
  sets internal registers to enable MP3 output
  input: none
  output: none
********************************/
void DSP_Init() {
  static unsigned char garbage = 0;  //for garbage reads and writes
  static unsigned long i = 0;
  static unsigned short data_in = 0;

  SPI_Init(1);

  // hw reset for initial turn on
  DDR_DSP_RESET = 1;  //output to xReset
  DSP_RESET = 0; //reset low
  for(i=0; i<10000; i++){}
  DSP_RESET = 1; //reset high;
  for(i=0; i<100000; i++){}

  /*// sw reset
  DSP_Send(0x0004,MMODE);
  for(i=0; i<100000; i++){}*/

  /*// funky mmode stuff
  data_in = DSP_Get(MMODE);
  data_in |= 0x0400;
  DSP_Send(data_in,MMODE);*/

  //Initialize some internal registers
  DSP_Send(0x0000,BASS);
  DSP_Send(0x0000,DECODE);

  //Initialize clock doubler
  DSP_Send(0x4000,CLOCKF);
  //A write to AUDATA causes clock doubler to take effect
  DSP_Send(0x0000,AUDATA);
  for(i = 0; i < 10000; i++);

  //Set VOL (volume)
  data_in = Left_Vol;
  data_in = (data_in<<8) + Right_Vol;
  DSP_Send(data_in,VOL);

  //to test good send
  data_in = DSP_Get(VOL);

  //Load application code
  i = 0;
  do  {
    DSP_Send(dtab[i],atab[i]);
    data_in = DSP_Get(atab[i]);
  } while(i < CODE_SIZE && data_in == dtab[i++]);

  // set the play mode
  data_in = DSP_Get(AICTRL3);
  //data_in &= PLAY_MODE_NORMAL;
  DSP_Send(data_in,AICTRL3);

  //write 0x30 to AIADDR to begin DSP MP3 application
  DSP_Send(0x0030,AIADDR);


}

void DSP_Init_Direct() {

 static unsigned char garbage = 0;  //for garbage reads and writes
  static unsigned long i = 0;
  static unsigned short data_in = 0;

  SPI_Init(1);

  // hw reset for initial turn on
  DDR_DSP_RESET = 1;  //output to xReset
  DSP_RESET = 0; //reset low
  for(i=0; i<10000; i++){}
  DSP_RESET = 1; //reset high;
  for(i=0; i<100000; i++){}

  /*// sw reset
  DSP_Send(0x0004,MMODE);
  for(i=0; i<100000; i++){}*/

  /*// funky mmode stuff
  data_in = DSP_Get(MMODE);
  data_in |= 0x0400;
  DSP_Send(data_in,MMODE);*/

  //Initialize some internal registers
 /* DSP_Send(0x0000,BASS);
  DSP_Send(0x0000,DECODE);
         */

  //Initialize clock doubler
  DSP_Send(0x4000,CLOCKF);
   //A write to AUDATA causes clock doubler to take effect
  DSP_Send(0x0000,AUDATA);

  for(i = 0; i < 10000; i++);

  //Set VOL (volume)
  data_in = Left_Vol;
  data_in = (data_in<<8) + Right_Vol;
  DSP_Send(data_in,VOL);

  //to test good send
  data_in = DSP_Get(VOL);






 }

/*******DSP_Play_Song()**************
  Commands the DSP to play the song indicated by songNum
  input: unsigned short songNum
  output: none
********************************/
void DSP_Play_Song(unsigned short songNum) {
  DSP_Send(songNum+0x8000,AICTRL0);
}


/*******DSP_Play_Pause()**************
  Toggles the play/pause state of the player
  input: none
  output: none
********************************/
void DSP_Play_Pause(void) {
  unsigned short data = DSP_Get(AICTRL3);
  data ^= 0x0010;
  DSP_Send(data,AICTRL3);
}


/*******DSP_Send()**************
// sends 2 bytes of data to the DSP to the specified register
// inputs: unsigned short data, unsigned char register
// outputs: none
********************************/
void DSP_Send(unsigned short data, unsigned char reg) {
  unsigned char garbage;
  unsigned char LB = (unsigned char) data;
  unsigned char HB = (unsigned char) data >>8;

  SPI_CSLow(DSP_DEVICE);
  garbage = SPI_Data(COMMAND_WRITE);
  garbage = SPI_Data(reg);
  garbage = SPI_Data((unsigned char) (data >>8));
  garbage = SPI_Data((unsigned char) data);

  for(garbage = 0; garbage != 50; garbage++);

  SPI_CSHigh(DSP_DEVICE);

  for(garbage = 0; garbage != 100; garbage++);
}


/*******DSP_Get()**************
// Reads the specified two byte register and returns the value
// inputs: unsigned char reg
// outputs: unsigned short contents of reg
********************************/
unsigned short DSP_Get(unsigned char reg) {
  unsigned char garbage;
  unsigned short data;

  SPI_CSLow(DSP_DEVICE);
  garbage = SPI_Data(COMMAND_READ);
  garbage = SPI_Data(reg);
  data = SPI_Data(garbage);
  data = SPI_Data(garbage);
  data  = data<<8;
  data += SPI_Data(garbage);

  for(garbage = 0; garbage != 50; garbage++);

  SPI_CSHigh(DSP_DEVICE);

  return data;
}

/******************************************************
*******************************************************
   manish's test code! below
*******************************************************
*******************************************************/


int DSP_Test2(void) {
  unsigned long i;

  DDR_DSP_CS = 1;
  DSP_CS = 1;

  DDR_DSP_RESET = 1;
  DSP_RESET = 0;
  for(i=0; i<10000; i++);
  DSP_RESET = 1;

  for(i=0; i<100000; i++);
}

//test1 and test2 were analog test
//TEST 3
//dreq should go low then high really fast (PASSED!)
int DSP_Test3(void)
{
  unsigned char dummy;
  // 1) Activiate xCS by setting it to 0;
  //SPI_CSLow(DSP_DEVICE);

  DSP_Send(0x0004,0x02);

  /*PTS_PTS3 = 0;
  // 2) Reset the firmware by writing four SCI bytes: 0x02, 0x00, 0x00, 0x04;
  dummy = SPI_Data((unsigned char)(0x02)); //write function
  dummy = SPI_Data((unsigned char)(0x00)); //to mode register
  dummy = SPI_Data((unsigned char)(0x00)); //msb data
  dummy = SPI_Data((unsigned char)(0x04)); //lsb data
  // 3) Finish SCI cycle by setting xCS to 1;
  //SPI_CSHigh(DSP_DEVICE);  // DSP CS = 1
  PTS_PTS3 = 1;*/
  return 1;
}

//TEST 4
//now that we know sci works, we can try reeding from DSP (PASSED!)
int DSP_Test4(void) {
  unsigned char dummy;
  long i;
  static unsigned short VolReg = 2;
  unsigned short VolReg_Sent = 0xF0F1;

  /*
  // 1) Activiate xCS by setting it to 0;
  //SPI_CSLow(DSP_DEVICE);
  PTS_PTS3 = 0;
                for(i=0; i<100; i++);
  // 2) Set volume by writing four bytes
  //    First two bytes are address for volume register
  //    Next two bytes are data.
  //    volume register is [0x020B]
  //    data sent is "0xA2F5"
  dummy = SPI_Data((unsigned char)(0x02));
  //for(i=0; i<100; i++);
  dummy = SPI_Data((unsigned char)(0x0B));
  //for(i=0; i<100; i++);
  dummy = SPI_Data((unsigned char)(VolRegMSB_sent));
  //for(i=0; i<100; i++);
  dummy = SPI_Data((unsigned char)(VolRegLSB_sent));
  //for(i=0; i<100; i++);
  // 3) Finish Writing to volume register by setting xCS to 1;
  //SPI_CSHigh(DSP_DEVICE);
  PTS_PTS3 = 1;
  //delay loop. hopefully everything is done writing though SCI by then
  for(i=0; i<10000; i++){
    asm nop
  }


  // 4) Activitate xCS by setting it to 0 so we can
  //    start reading from volume register
  //SPI_CSLow(DSP_DEVICE);
  PTS_PTS3 = 0;
     for(i=0; i<100; i++);
  // 5) Write tow bytes (0x03, 0x0B) to SCI
  dummy = SPI_Data((unsigned char)(0x03));
  dummy = SPI_Data((unsigned char)(0x0B));
  dummy = SPI_Data((unsigned char)(VolRegMSB_sent));
  VolRegMSB = SPI_Data((unsigned char)(0x00)); //msb bit recieved from vol register
  VolRegLSB = SPI_Data((unsigned char)(0x00)); //lsb bit recieved from vol register
         for(i=0; i<100; i++);
  // 6) Finish writing and reading volume reister by setting xCS to 1;
  //SPI_CSHigh(DSP_DEVICE);
  PTS_PTS3 = 1;

  //delay loop. hopefully everything is done writing though SCI by then
  for(i=0; i<10000; i++){
    asm nop
  }*/

  DSP_Send(VolReg_Sent,VOL);
  VolReg = DSP_Get(VOL);

  #if DEBUG

    SCI_OutString("VolReg_sent = "); SCI_OutUHex((unsigned long)VolReg_Sent&0xFFFF);SCI_OutString("\n\r");
    SCI_OutString("  VolReg = "); SCI_OutUHex((unsigned long)VolReg&0xFFFF);SCI_OutString("\n\r");

  #endif
/*  return 1;    */
}


//TEST 5
//the sine test, making the mp3 player sing!
int DSP_Test5(void) {
  unsigned char dummy;
  unsigned long i;
  static unsigned short VolReg = 2;
  unsigned short VolReg_Sent = 0x0000;
  unsigned short received_reg;

  // 1) allows test for writing to SCI: 0x02, 0x0, 0x80, 0x20;
  /*SPI_CSLow(DSP_DEVICE);
  dummy = SPI_Data((unsigned char)(0x02)); //write command
  dummy = SPI_Data((unsigned char)(0x00)); //mode register
  dummy = SPI_Data((unsigned char)(0x08)); //msb data
  dummy = SPI_Data((unsigned char)(0x20)); //lsb data
  SPI_CSHigh(DSP_DEVICE);*/
  DSP_Send(0x0C20,MMODE);
  received_reg = DSP_Get(MMODE);

  if(received_reg == 0x0C20)
    PTP_PTP0 = 1;

  //delay loop. hopefully everything is done writing though SCI by then
  for(i=0; i<1000000; i++){
    asm nop
  }

  // 2) Activivate the sine test by writing the folowing eight bytes to SDI:
  //    0x53, 0xEF, 0x6E, 0x30, 0x00, 0x00, 0x00, 0x00
  //    Remember to take care of xDCS/BSYNC(PT3)
//  SPI_CSHigh(DSP_DEVICE);
  for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x53));
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0xEF));
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x6E));
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x7F));
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x00));
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x00));
//  SPI_CSHigh(DSP_DEVICE);
//  for(i=0; i<100; i++);
//  SPI_CSLow(DSP_DEVICE);
  //for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x00));
 // for(i=0; i<5; i++);
  dummy = SPI_Data((unsigned char)(0x00));
  for(i=0; i<10; i++);


  // 3) Wait about 500ms for example
  //    delay loop. hopefully everything is done writing though SCI by then
  for(i=0; i<1000000; i++){
    asm nop
  }

  // 4) Deactivate the siine test by writing to SDI: 0x45, 0x78, 0x69, 0x74
//  SPI_CSHigh(DSP_DEVICE);
  dummy = SPI_Data((unsigned char)(0x45));
  dummy = SPI_Data((unsigned char)(0x78));
  dummy = SPI_Data((unsigned char)(0x69));
  dummy = SPI_Data((unsigned char)(0x74));
  dummy = SPI_Data((unsigned char)(0x00));
  dummy = SPI_Data((unsigned char)(0x00));
  dummy = SPI_Data((unsigned char)(0x00));
  dummy = SPI_Data((unsigned char)(0x00));
//  SPI_CSHigh(DSP_DEVICE);

  SPI_CSLow(DSP_DEVICE);
  for(i=0; i<10000; i++);
  SPI_CSHigh(DSP_DEVICE);

  // 5) Wait about 500ms for example
  //    delay loop. hopefully everything is done writing though SCI by then
  for(i=0; i<1000000; i++){
    asm nop
  }

 /*************************
   REMEBER TO CALL THIS TEST IN A FORLOOP BECAUSE STEP 6...
     6) Repeat these steps indefinitely
  *************************/

}