 //*******************************************************************
// Volver
//
// Code by Todd Polenberg, Jesse Lackey, and Jason Cipriani
// Pattern Data by Image Node and Disorient
// Copyright 2009 Todd Polenberg
// 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 3 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.
//*****************************************************************

#include <inttypes.h>
#include <io.h>
#include <util/delay.h>
#include <interrupt.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
//#include <math.h>


#define PWM_CHANNELS 36
#define BRIGHTNESS_MAX 255
#define BRIGHTNESS_2 32
#define BRIGHTNESS_3 16
#define BRIGHTNESS_4 1


// These are for compatibility with Jason's  code
typedef char atmel_s8;
typedef unsigned char atmel_u8;
typedef int atmel_s16;
typedef unsigned int atmel_u16;

#define	TRUE	1
#define	FALSE	0

//global variables
volatile unsigned char PWM_MAXVAL=255;
volatile unsigned char pwmCount;
volatile unsigned char leds[PWM_CHANNELS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //one byte for each LED, we'll need this for PWM later
volatile unsigned int frame[PWM_CHANNELS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};	// data coming in
volatile unsigned char lastframe[PWM_CHANNELS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};	// data coming in
volatile unsigned char tempframe[PWM_CHANNELS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};	// data coming in
volatile unsigned char newframe[PWM_CHANNELS]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};	// data coming in
volatile int testcounter =0;
volatile unsigned char isframe;
volatile unsigned char brightstate =1;
volatile unsigned char brightmax;
volatile unsigned char mode = 1;
volatile unsigned int masterspeed=300;
volatile unsigned char brightbutton=0;
volatile unsigned char blend_mode=1;

//volatile int g_ser_counter=0;
volatile int fps =1;
volatile int status_led_is_on;
volatile unsigned char g_framecounter=0;
volatile unsigned char g_load_new_led_data= 0;
volatile unsigned char g_max_brightness= 255;
volatile unsigned char interruptcounter =0;
volatile unsigned char interruptcounter2 =0;
volatile unsigned char mode_has_changed=0;
volatile unsigned char pattern_begin=0;


// PATTERN Consts -- this is LED frame data


/* file: dis_eye_cuatro.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_eye_cuatro_inb[] PROGMEM = {
  30
, 0x0000, 0x0000, 0x0000, 0x0800, 0x0082, 0x0042, 0x0000, 0x0810
, 0x8306, 0x0001, 0x0000, 0x0200, 0x0000, 0x0e84, 0x79dd, 0x0018
, 0x0604, 0x000c, 0x8800, 0x4211, 0x0000, 0x003c, 0x0000, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 0xf800, 0x0000, 0xbe00
, 0x76c5, 0x0e79, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff
, 0x0000, 0x3108, 0x1042, 0x0c08, 0x0000, 0xd7ff, 0xff7f, 0x000f
, 0x1000, 0x0000, 0x8104, 0x3000, 0x3030, 0xff19, 0x0400, 0x0081
, 0x1c00, 0x4c8e, 0x0000, 0x0206, 0x0000, 0xbe00, 0xf181, 0xa56a
, 0x6a56, 0x3805, 0x0c04, 0x0000};

/* file: dis_lucky.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_lucky_inb[] PROGMEM = {
  12
, 0xc4a1, 0x5230, 0x30c8, 0xccf3, 0x8030, 0x4927, 0x001e, 0x0c00
, 0x0003, 0x187f, 0xe186, 0xffff, 0xffff, 0x00ff, 0x0000, 0x0000
, 0x0000, 0x0000, 0x5085, 0x10a0, 0x021a, 0x030c, 0xa184, 0x30c4
, 0x0852, 0x0000, 0x0000};

/* file: dis_ninjastar.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_ninjastar_inb[] PROGMEM = {
  30
, 0x2300, 0x0c49, 0x0000, 0x030c, 0x5e00, 0x8618, 0x07a1, 0x9230
, 0x00c4, 0xc000, 0x0030, 0xfff0, 0xffff, 0xff03, 0xffff, 0xffc0
, 0xc0ff, 0xffff, 0xffff, 0xff03, 0x03ff, 0xffff, 0x6aff, 0x56a5
, 0x556a, 0x95a9, 0xa95a, 0x8420, 0x4210, 0xe300, 0x739c, 0x380c
, 0x7fef, 0x01cf, 0x9efb, 0x0df7, 0x104f, 0x2086, 0x867f, 0x1861
, 0x63e2, 0x8618, 0x1c61, 0x61c6, 0x8638, 0x9c60, 0x6396, 0xc200
, 0x3969, 0x2004, 0x168c, 0x0043, 0x08c2, 0x0431, 0x8420, 0x4210
, 0x4000, 0x2108, 0x0000, 0x1080, 0xe000, 0x6185, 0x7a18, 0x2300
, 0x0c49, 0x0000, 0x030c, 0x0000};

/* file: dis_sultan.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_sultan_inb[] PROGMEM = {
  7
, 0xf02d, 0x40ff, 0xfc0b, 0xf000, 0x1203, 0xb6d0, 0x3480, 0x0ccf
, 0xcf33, 0x0000, 0x0000, 0x4a10, 0x2204, 0x0085, 0x0000, 0x0000};

/* file: dis_tejawe1.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_tejawe1_inb[] PROGMEM = {
  30
, 0x0001, 0x0000, 0x0c30, 0x0000, 0x8500, 0x0071, 0x9000, 0xcc28
, 0x0003, 0x4491, 0x1f61, 0x8a10, 0x0a24, 0x80ff, 0x2040, 0x0810
, 0x0400, 0x8102, 0x0000, 0x1020, 0x0008, 0x0000, 0x0081, 0x0000
, 0x0800, 0x0002, 0x0000, 0x0c30, 0x0000, 0x6280, 0x0038, 0x2400
, 0xf0c5, 0x2000, 0x8a4a, 0x03e1, 0x9461, 0xc314, 0x400f, 0x2108
, 0x0004, 0x1080, 0x0042, 0x0000, 0x0421, 0x0000, 0x4200, 0x0000
, 0x0000, 0x0c04, 0x0000, 0xe000, 0x0031, 0x0000, 0xc7bf, 0x0000
, 0xfed0, 0x031e, 0x4c00, 0x7bfb, 0xc00c, 0xed30, 0x31ef, 0xc84c
, 0x4c84, 0x3218, 0x1321, 0x0032};

/* file: dis_tejawe2.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_tejawe2_inb[] PROGMEM = {
  30
, 0x1041, 0x2086, 0x0828, 0x0492, 0x0441, 0x30c1, 0x0208, 0x9421
, 0x0842, 0xe000, 0x0079, 0x1020, 0x850a, 0x0840, 0x30c2, 0x0104
, 0x9241, 0x0824, 0x1820, 0x4186, 0x8400, 0x1861, 0x4102, 0x8610
, 0x2820, 0x9208, 0x4104, 0xc104, 0x0830, 0x2102, 0x4294, 0x0008
, 0x79e0, 0x2000, 0x0a10, 0x4085, 0xc208, 0x0430, 0x4101, 0x2492
, 0x2008, 0x8618, 0x0041, 0x6184, 0x0218, 0x1041, 0x2086, 0x0828
, 0x0492, 0x0441, 0x30c1, 0x0208, 0x9421, 0x0842, 0xe000, 0x0079
, 0x1020, 0x850a, 0x0840, 0x30c2, 0x0104, 0x9241, 0x0824, 0x1820
, 0x4186, 0x8400, 0x1861, 0x0002};

/* file: dis_tejawe3.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_tejawe3_inb[] PROGMEM = {
  24
, 0xd87f, 0xa3b6, 0x87ff, 0x4b6d, 0x7ffe, 0xb2d8, 0xffe9, 0x6c87
, 0xff1b, 0xd83f, 0xe1f6, 0x87ef, 0x1b7d, 0x7dfe, 0xb6dc, 0xbfe1
, 0x6da7, 0xfe1b, 0xd977, 0xe1b6, 0x8eff, 0x1b6d, 0x5ffe, 0xb6f8
, 0xffe1, 0xed07, 0xfe1b, 0xd87f, 0xe3b4, 0x87ff, 0x536d, 0x7ffe
, 0xb6d8, 0xffc9, 0x6d87, 0x7f1b, 0xd87f, 0xe1f6, 0x87fb, 0x1b7d
, 0x7fde, 0xb6dc, 0xfee1, 0x6da7, 0xf61b, 0xd97f, 0xa1b6, 0x8fff
, 0x1a6d, 0x7ffe, 0xb678, 0xffe1, 0xed85, 0xfe1b};

/* file: dis_tejawe4.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 dis_tejawe4_inb[] PROGMEM = {
  30
, 0x0000, 0x5200, 0x000b, 0xd480, 0x0002, 0xb520, 0x0000, 0x2d48
, 0x0200, 0x0b52, 0x1000, 0x03f0, 0x8000, 0xad00, 0x0004, 0x0004
, 0x12b4, 0x0020, 0xd000, 0x014a, 0x0400, 0x2b40, 0x8001, 0x0000
, 0x04ad, 0x0010, 0xfc00, 0x0200, 0x5200, 0x400b, 0xd480, 0x0002
, 0xb528, 0x0000, 0x2d48, 0x0200, 0x0b52, 0x1000, 0x03f0, 0x8000
, 0xad00, 0x0004, 0x0004, 0x12b4, 0x0020, 0xd000, 0x014a, 0x0400
, 0x2b40, 0x8001, 0x0000, 0x04ad, 0x0010, 0xfc00, 0x0200, 0x5200
, 0x400b, 0xd480, 0x0002, 0xb528, 0x0000, 0xff00, 0x000f, 0xf300
, 0x0cff, 0x30c0, 0xcfff, 0x0030};

/* file: dis_text_good.inb */
/* generated on Fri Jul 17 10:40:10 2009 */
const atmel_u16 dis_text_good_inb[] PROGMEM = {
 88
, 0x0820, 0x2082, 0xc308, 0x0c30, 0x38c3, 0x6186, 0xce18, 0x0c33
, 0xf0c3, 0x61be, 0x8618, 0x0fff, 0x30c3, 0x7ffc, 0x0410, 0xffc1
, 0x0003, 0xfc00, 0x083f, 0xe082, 0xc3ff, 0x0c30, 0x1fff, 0x6186
, 0xf7d8, 0x2cb2, 0xbecb, 0x6db7, 0xf6db, 0x6dbd, 0xb6db, 0x6d6d
, 0xb4d3, 0x6b6d, 0xa61b, 0xdb6d, 0x30fb, 0xdbef, 0x07de, 0xdf79
, 0x3ef4, 0xfbc0, 0xff86, 0xfe03, 0xfc3f, 0xf03f, 0xc1ff, 0x03ff
, 0x0fff, 0x3ffc, 0xfff8, 0xffc0, 0xffc3, 0xfc07, 0xf61f, 0xc03d
, 0xb2f7, 0x09ef, 0xb7be, 0xcf7d, 0xbdf0, 0x5b6f, 0xed86, 0xd37d
, 0x4c30, 0x1bef, 0x6186, 0xfff8, 0x0c30, 0xffc3, 0x4107, 0xfc10
, 0x003f, 0xc000, 0x83ff, 0x0820, 0x3ffe, 0xc30c, 0xfff0, 0x1861
, 0x7d86, 0xcb2f, 0xecb2, 0xdb7b, 0x6db6, 0xdbdf, 0x6fbe, 0xdedb
, 0x7df4, 0xf4d3, 0xef86, 0x861b, 0xfc3f, 0x30ff, 0xc1fc, 0x07ff
, 0x0fc1, 0x3ffe, 0xfc00, 0xfff0, 0xe083, 0x7f8f, 0x0c1f, 0xdcff
, 0x60f3, 0xe7d8, 0x279e, 0xbccb, 0x3cf7, 0xc6db, 0x65bd, 0x2699
, 0x2d6c, 0xb6cb, 0x6b61, 0xb6db, 0xdb0d, 0xb6fb, 0xd8ef, 0x37de
, 0xcf7d, 0xbef4, 0xfbe1, 0xff86, 0xff0f, 0xfc3f, 0xf07f, 0xc1ff
, 0x03ff, 0x0fff, 0x3ffc, 0xfff0, 0xffe0, 0xdf01, 0xff0f, 0xf00f
, 0xd87c, 0x8277, 0xcbe7, 0x33be, 0xdf3c, 0x9df6, 0xd961, 0xedb6
, 0xc30c, 0x4d34, 0x186f, 0x6186, 0xc3f8, 0x0c30, 0x1fc3, 0x4104
, 0xfc10, 0x0000, 0xc000, 0x820f, 0x0820, 0x30fe, 0xc30c, 0x8ff0
, 0x1861, 0x7d86, 0xc30c, 0xcc30, 0x186b, 0x6186, 0xc3dc, 0x0c30
, 0x1ec3, 0x4104, 0xf410, 0x0820, 0xa082, 0xc30f, 0x0c30, 0x18ff
, 0x6186, 0xcfd8, 0x0c30, 0xfcc3, 0x6186, 0xc618, 0x0c3f, 0x30c3
, 0x41fc, 0x0410, 0x07c1, 0x0000, 0x3c00, 0x0000, 0xc000, 0x0001
, 0x0000, 0x000c, 0x0000, 0x0040, 0x0000, 0x0000}; 
/* file: leo_arrow_pan.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_arrow_pan_inb[] PROGMEM = {
  8
, 0x0800, 0x0100, 0x4200, 0x2060, 0x1004, 0x0902, 0x8084, 0x0810
, 0x1081, 0x4084, 0x1020, 0x0422, 0x0402, 0x0142, 0x8010, 0x0800
, 0x6000, 0x0000};

/* file: leo_chasesnake.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_chasesnake_inb[] PROGMEM = {
  45
, 0x0000, 0x4000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0100, 0x0000
, 0x2800, 0x0000, 0x0000, 0x0005, 0x0000, 0x00a0, 0x0000, 0x0420
, 0x0000, 0x8008, 0x0000, 0x2002, 0x8000, 0x0800, 0x2000, 0x0200
, 0x0000, 0x0081, 0x0000, 0x0028, 0x0000, 0x0140, 0x0000, 0x0a00
, 0x0000, 0x5000, 0x0000, 0x0000, 0x0042, 0x0000, 0x0010, 0x0001
, 0x4000, 0x0400, 0x0000, 0x0100, 0x0010, 0x0000, 0x0204, 0x0000
, 0x4000, 0x0000, 0x0000, 0x000a, 0x0000, 0x0140, 0x0000, 0x0840
, 0x0000, 0x0010, 0x0001, 0x4004, 0x0000, 0x1020, 0x0000, 0x0500
, 0x0000, 0x2800, 0x0000, 0x0000, 0x0021, 0x0000, 0x8008, 0x0000
, 0x2000, 0x0010, 0x0000, 0x0300, 0x0000, 0x2080, 0x0000, 0x0c00
, 0x0000, 0x4000, 0x0000, 0x0800, 0x0000, 0x0100, 0x0040, 0x0000
, 0x000c, 0x0000, 0x1001, 0x0000, 0x0400, 0x0040, 0x0000, 0x0010
, 0x0001, 0x4000, 0x0400, 0x0000, 0x0000, 0x0000};

/* file: leo_cornerchase.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_cornerchase_inb[] PROGMEM = {
  22
, 0x0000, 0x0000, 0x0200, 0x0000, 0x1000, 0x0008, 0x8000, 0x2040
, 0x0000, 0x0204, 0x0081, 0x1020, 0x0408, 0x8102, 0x2040, 0x0810
, 0x0204, 0x4081, 0x1000, 0x0408, 0x0002, 0x2040, 0x0010, 0x0000
, 0x0081, 0x0000, 0x0400, 0x0000, 0x8100, 0x0000, 0x2040, 0x0010
, 0x0810, 0x0204, 0x0204, 0x4081, 0x4081, 0x1020, 0x1028, 0x0408
, 0x0402, 0x8102, 0x8000, 0x2040, 0x0000, 0x0810, 0x0000, 0x0000
, 0x0000, 0x0000};

/* file: leo_first.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_first_inb[] PROGMEM = {
  17
, 0x0000, 0x0000, 0x0210, 0x0000, 0x8084, 0x0004, 0x0012, 0x0c00
, 0x0003, 0xc480, 0x1230, 0x4a10, 0x230c, 0x0085, 0x30c0, 0x0000
, 0x0048, 0x0120, 0xc000, 0x0030, 0x7800, 0xe79e, 0xff01, 0xffff
, 0x0fff, 0x9278, 0x01e4, 0xc000, 0x0030, 0xfff0, 0xfcf3, 0x7fff
, 0xb6d8, 0x0fe1, 0x9278, 0x01e4, 0x0000, 0x0000, 0x0000};

/* file: leo_fourchase.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_fourchase_inb[] PROGMEM = {
  5
, 0x0021, 0x4000, 0x0508, 0x0000, 0x080a, 0x8010, 0x4100, 0x6000
, 0x2000, 0x0802, 0x0100, 0x0004};

/* file: leo_infinity_bounce.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_infinity_bounce_inb[] PROGMEM = {
  20
, 0x0000, 0x4000, 0x0000, 0x2000, 0x0000, 0x1000, 0x0000, 0x0800
, 0x0000, 0x0400, 0x0000, 0x0200, 0x0000, 0x0000, 0x0008, 0x0000
, 0x2000, 0x0000, 0x0000, 0x0080, 0x0000, 0x0000, 0x0002, 0x0000
, 0x0800, 0x0000, 0x0100, 0x0000, 0x0020, 0x0000, 0x0004, 0x8000
, 0x0000, 0x1000, 0x0000, 0x0000, 0x0040, 0x0000, 0x0000, 0x0001
, 0x0000, 0x0400, 0x0000, 0x0000, 0x0010};

/* file: leo_second.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_second_inb[] PROGMEM = {
  30
, 0x0620, 0x4609, 0x30c0, 0xc000, 0x8130, 0x4021, 0x0818, 0x0800
, 0x0001, 0x4000, 0x0020, 0x0000, 0x0108, 0x0000, 0x2040, 0x0000
, 0x0000, 0x0c00, 0x0000, 0x8000, 0x0001, 0x0000, 0x0030, 0x0000
, 0x0600, 0x0000, 0xc000, 0x0000, 0x2000, 0x0008, 0x0800, 0x0002
, 0x8200, 0x0000, 0x2080, 0x0000, 0x0820, 0x0000, 0x0300, 0x0000
, 0x1800, 0x0000, 0xc000, 0x0000, 0x0000, 0x0006, 0x0000, 0x0030
, 0x0000, 0x4100, 0x0000, 0x0000, 0x0104, 0x0000, 0x1000, 0x0004
, 0x0000, 0x1040, 0x0000, 0x0000, 0xf041, 0xffff, 0xffff, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000};

/* file: leo_sideways.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_sideways_inb[] PROGMEM = {
  10
, 0x1041, 0x4104, 0x0820, 0x2082, 0x0408, 0x1041, 0x8104, 0x0820
, 0x2082, 0x0410, 0x1041, 0x8204, 0x0820, 0x1082, 0x4104, 0x8410
, 0x0820, 0x2082, 0x4104, 0x0410, 0x0821, 0x2082, 0x0008};

/* file: leo_spokechase.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_spokechase_inb[] PROGMEM = {
  6
, 0x8420, 0x4210, 0x2100, 0x4108, 0x0208, 0x2041, 0x1408, 0x0408
, 0x8102, 0x6040, 0x2060, 0x8000, 0x1198, 0x0000};

/* file: leo_third.inb */
/* generated on Tue Jul 14 19:41:20 2009 */

/* file: leo_zigzager.inb */
/* generated on Tue Jul 14 19:41:20 2009 */
const atmel_u16 leo_zigzager_inb[] PROGMEM = {
  26
, 0x0000, 0x4000, 0x0000, 0x2000, 0x0000, 0x0400, 0x0000, 0x0200
, 0x0000, 0x0040, 0x0000, 0x0020, 0x0000, 0x0000, 0x0001, 0x0000
, 0x0200, 0x0000, 0x0000, 0x0010, 0x0000, 0x2000, 0x0000, 0x0000
, 0x0100, 0x0000, 0x0080, 0x0000, 0x0010, 0x0000, 0x0008, 0x0000
, 0x0001, 0x8000, 0x0000, 0x0000, 0x0400, 0x0000, 0x0000, 0x0008
, 0x0000, 0x4000, 0x0000, 0x0000, 0x0080, 0x0000, 0x0000, 0x0004
, 0x0000, 0x0002, 0x4000, 0x0000, 0x2000, 0x0000, 0x0400, 0x0000
, 0x0200, 0x0000, 0x0000};


/* file: allon.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 allon_inb[] PROGMEM = {
  1
, 0xffff, 0xffff, 0x000f};

/* file: bacon1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 bacon1_inb[] PROGMEM = {
  34
, 0xc000, 0x0030, 0x7800, 0xe492, 0x7f01, 0x8618, 0x3fe1, 0x0087
, 0xce10, 0x100c, 0x0086, 0x6003, 0x6090, 0x8000, 0x4021, 0x0018
, 0x0800, 0x0001, 0x4000, 0x0020, 0x0000, 0x0108, 0x0000, 0x2040
, 0xc000, 0x6148, 0x3128, 0x2300, 0x0c49, 0x8730, 0x1000, 0x80ce
, 0x30c4, 0x0012, 0x9230, 0x00c4, 0xc000, 0x0030, 0x4a10, 0x2000
, 0x5085, 0x4022, 0x20a4, 0x9090, 0x4090, 0xe200, 0x0470, 0x4a10
, 0x2000, 0x5085, 0x4022, 0x20a4, 0x9090, 0x4090, 0x0071, 0xe000
, 0x1088, 0x8891, 0x0010, 0x2646, 0x4006, 0x0089, 0x2910, 0xc480
, 0x1230, 0x3000, 0xc492, 0xa100, 0x0004, 0xe852, 0x6185, 0x7a18
, 0x2780, 0x1e49, 0x0210, 0x030c, 0x0084};

/* file: bacon3.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 bacon3_inb[] PROGMEM = {
  12
, 0xa528, 0x4a50, 0x2851, 0x4294, 0x20a1, 0x56a5, 0x404a, 0x91a9
, 0x2958, 0x056a, 0x6a00, 0xa955, 0x5000, 0x6aa9, 0xa955, 0x056a
, 0x6aa8, 0x0155, 0x5540, 0x2aa9, 0xaaa0, 0x556a, 0x5555, 0xa955
, 0x7aaa, 0x07e0, 0xe07e};

/* file: bacon4.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 bacon4_inb[] PROGMEM = {
  31
, 0x102d, 0x4086, 0x852b, 0x1000, 0x004a, 0x4923, 0x000c, 0x0c00
, 0x0003, 0x0021, 0x4000, 0x4808, 0x2000, 0x0001, 0x30c0, 0x0000
, 0x9230, 0x00c4, 0x100c, 0x0086, 0x8233, 0x1204, 0x58c4, 0x9090
, 0x61a0, 0x6480, 0x6012, 0x8071, 0xe010, 0x00c8, 0x0a65, 0x2330
, 0x1088, 0x8c41, 0x0505, 0x1a0a, 0x8806, 0x0116, 0x0716, 0x0204
, 0x0c8e, 0x9690, 0x2300, 0x0c85, 0x4a13, 0x2300, 0x0c49, 0x8060
, 0x1060, 0x8060, 0x0007, 0x001e, 0x6184, 0x0218, 0x001e, 0x8000
, 0x5007, 0xa294, 0x8000, 0x50a2, 0x0014, 0x0514, 0x028a, 0x8a00
, 0x0516, 0x0180, 0x0c03, 0x6118, 0x0008, 0x0861};

/* file: c6.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 c6_inb[] PROGMEM = {
  144
, 0x00c2, 0x0000, 0x1c20, 0x0006, 0xc200, 0x30e1, 0x2000, 0x0e1c
, 0x0187, 0xe1c2, 0x3870, 0x100c, 0x870e, 0x00c3, 0x7080, 0x0c38
, 0x0000, 0xc384, 0x0000, 0xbb40, 0x000c, 0x7180, 0x00ca, 0x38c0
, 0x0087, 0x9c60, 0x0873, 0xce30, 0x8739, 0xe300, 0x439c, 0x3000
, 0x21ce, 0x0000, 0x10e3, 0x4300, 0x0830, 0x3860, 0x0004, 0x870c
, 0x8043, 0x70e1, 0x3438, 0x0e1c, 0x4387, 0xe1c3, 0x0870, 0x1c30
, 0x010e, 0xd300, 0x002d, 0x3000, 0x18e5, 0x0000, 0xce10, 0x0031
, 0xe100, 0x639c, 0x1000, 0x39ce, 0x00c7, 0x9c20, 0x0c73, 0x4000
, 0xc738, 0xc100, 0x7384, 0x100c, 0x080c, 0x00c7, 0x98e1, 0x0c70
, 0xce10, 0xc131, 0xe100, 0x639c, 0x0000, 0x39c2, 0x00c7, 0x8400
, 0x0c73, 0x00c2, 0xc708, 0x1c20, 0x1006, 0xc20c, 0x30e1, 0x2000
, 0x0e1c, 0x0187, 0xe1c2, 0x3870, 0x180c, 0x870e, 0x80c3, 0x70c0
, 0x0c38, 0x0408, 0xc386, 0x4080, 0x3020, 0x0c3c, 0x0204, 0x86c3
, 0x2041, 0xc618, 0x0c30, 0x30c3, 0x8618, 0x8610, 0xc301, 0x3108
, 0x000c, 0x1f8c, 0x0003, 0xfb00, 0x000d, 0x7000, 0x00ef, 0x0c00
, 0x0e07, 0xc303, 0x2040, 0x0c30, 0x070c, 0x030e, 0x7000, 0x00ef
, 0x0000, 0x0dfb, 0x0000, 0x1f8c, 0x0003, 0x08c3, 0x0c31, 0x8c00
, 0x031f, 0x0000, 0x0dfb, 0x0000, 0xef70, 0x0000, 0x070c, 0x030e
, 0x40c3, 0x3020, 0x186c, 0x8204, 0x0c61, 0x2043, 0xc30c, 0x0830
, 0x30c1, 0x8618, 0x8610, 0xc301, 0x3108, 0x180c, 0x1086, 0xc186
, 0x0830, 0x30c1, 0x430c, 0x0c20, 0x1863, 0x8204, 0xc361, 0x2040
, 0x6c30, 0x0418, 0x6182, 0x430c, 0x0c20, 0x30c3, 0xc108, 0x1830
, 0x1086, 0x0186, 0x08c3, 0x0c31, 0x8c00, 0x031f, 0x0000, 0x0dfb
, 0xc000, 0xe070, 0x3030, 0x040c, 0xc302, 0x4186, 0x1820, 0x30c6
, 0xc204, 0x1830, 0x1086, 0x0186, 0x08c3, 0x0c31, 0x8c00, 0x031f
, 0x0000, 0x0dfb, 0xc000, 0xe070, 0x3030, 0x040c, 0xc302, 0x4186
, 0x1820, 0x30c6, 0xc204, 0x1830, 0x1086, 0x0186, 0x08c3, 0x0c31
, 0x8c00, 0x031f, 0x0000, 0x0dfb, 0x0000, 0x59a0, 0x2000, 0x9a08
, 0x4105, 0xa482, 0x1259, 0x4924, 0x259a, 0x9249, 0x79e4, 0xf492
, 0x0c03, 0xfc03, 0xd861, 0x61b6, 0xfc08, 0xf30c, 0xd203, 0x79ef
, 0x24bf, 0x92fd, 0x4bf4, 0x2fd2, 0xbf49, 0xf924, 0xe492, 0x124b
, 0x492f, 0x24bc, 0x92e1, 0x4b84, 0x2c12, 0xb049, 0x8124, 0x0492
, 0x124a, 0x4920, 0x0480, 0x9e00, 0x0007, 0xe300, 0x0c79, 0x30c0
, 0xcfff, 0x0c30, 0xcf33, 0xc30c, 0x6100, 0x3008, 0xc000, 0x0030
, 0x3000, 0xc79e, 0x0c00, 0xfff3, 0xc30c, 0xf330, 0x30cc, 0x100c
, 0x0086, 0x0003, 0x030c, 0x0000, 0x4923, 0xc00c, 0xf330, 0x30cc
, 0x100c, 0x0086, 0x0003, 0x030c, 0x0000, 0x79e0, 0x0000, 0xff00
, 0x000f, 0xf000, 0x00ff, 0x0003, 0xc7df, 0x0030, 0x3cf0, 0x030c
, 0xc700, 0x30c3, 0xf300, 0x0c3c, 0x30c3, 0xc34d, 0x0c30, 0x30c3
, 0xc00c, 0x0c30, 0x0000, 0x030c, 0x0000, 0x00c0, 0x0000, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000};

/* file: chex.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 chex_inb[] PROGMEM = {
  25
, 0x4000, 0x0020, 0x0800, 0x0000, 0x0101, 0x0000, 0x0800, 0x0104
, 0x0208, 0x0800, 0x0106, 0x0300, 0x0000, 0x0c0c, 0x0000, 0x3300
, 0x0000, 0xc000, 0x1040, 0x2080, 0x8000, 0x1060, 0x2000, 0x0004
, 0x0042, 0x0c00, 0x0003, 0xc480, 0x1230, 0x4a10, 0x230c, 0x0085
, 0x4923, 0xe00c, 0xf3b5, 0x7adc, 0x3b5e, 0xadcf, 0x78c7, 0xecf3
, 0x8031, 0x30c4, 0x0012, 0x9278, 0x01e4, 0xc000, 0x0030, 0x4800
, 0x230c, 0xa101, 0x30c4, 0x0852, 0x0048, 0x0120, 0xc000, 0x0030
, 0x0000};

/* file: chuck1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 chuck1_inb[] PROGMEM = {
  39
, 0x187f, 0xe186, 0x000f, 0x030c, 0x7f00, 0x8618, 0x0fe1, 0x0c00
, 0x0003, 0x187f, 0xe186, 0x000f, 0x030c, 0x0000, 0x4923, 0xc00c
, 0xf330, 0x30cc, 0xc000, 0x0030, 0x3000, 0xc492, 0x0c00, 0xcf33
, 0xd30c, 0x6d02, 0xb40b, 0xd87f, 0xe1b6, 0xb6df, 0xdfff, 0x61b6
, 0xfffb, 0x186d, 0xff86, 0x861f, 0x3861, 0x61cf, 0x8618, 0x1861
, 0x6186, 0x8618, 0x1b61, 0x6186, 0xfed8, 0x1861, 0x7fb6, 0x8618
, 0x1fed, 0x6186, 0x87fb, 0xd861, 0x61fe, 0x8618, 0x1fed, 0xe186
, 0xfedf, 0xf861, 0xedb7, 0x861f, 0x1b7f, 0xffb6, 0x86df, 0xfb41
, 0x2dff, 0x3418, 0xcfff, 0x4082, 0xfff3, 0x002c, 0xff30, 0x00cf
, 0xe300, 0x0c7f, 0x3000, 0xc79e, 0xff00, 0x861c, 0x0ff3, 0x9e30
, 0x00c7, 0x1cff, 0xf386, 0x300f, 0xc79e, 0xff00, 0x861c, 0x0ff3};

/* file: connie1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 connie1_inb[] PROGMEM = {
  35
, 0x148c, 0x1286, 0x48c3, 0x2a65, 0x8c31, 0xb6d4, 0x2312, 0x92b5
, 0x4ad4, 0x04a1, 0x5200, 0x8528, 0x1000, 0x524a, 0x0008, 0xa4a1
, 0x0085, 0x5a10, 0x085a, 0xa100, 0x95a5, 0x9000, 0x5a5a, 0x0009
, 0xa5a9, 0x0095, 0x5a90, 0x295a, 0xa940, 0x95a5, 0x9402, 0x5a5a
, 0x4029, 0xa5a9, 0x6295, 0x5a94, 0x295a, 0xa946, 0x95a5, 0x9462
, 0x5a5a, 0x4629, 0x95a9, 0x6291, 0x8894, 0x295a, 0xa146, 0x9195
, 0x9062, 0x5a98, 0x4429, 0x95a9, 0x4291, 0x9894, 0x215a, 0xa946
, 0x9095, 0x9462, 0x5298, 0x4629, 0xc5a9, 0x6389, 0x399c, 0x095a
, 0xa946, 0x9195, 0x9422, 0x5a98, 0x4629, 0xc5a8, 0x6399, 0x399c
, 0x2918, 0x8946, 0x6001, 0x639c, 0x0000, 0x1084, 0x0002};

/* file: connie2.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 connie2_inb[] PROGMEM = {
  30
, 0x0001, 0x0000, 0x0408, 0x0000, 0x0202, 0x0000, 0x4400, 0x0000
, 0x2000, 0x0080, 0x1000, 0x0000, 0x0801, 0x0100, 0x0900, 0x0800
, 0x0028, 0x0140, 0x4004, 0x0020, 0x3002, 0xc000, 0x0000, 0x30c0
, 0x0000, 0x0048, 0x0120, 0x0021, 0x4000, 0x85e8, 0x1b6d, 0x5e7a
, 0xb6d8, 0x17a1, 0x927a, 0x85e4, 0x27a1, 0x5e49, 0x85e8, 0x1b6d
, 0x5e7a, 0xb6d8, 0x07a1, 0x02d1, 0x08b4, 0x2700, 0x0e49, 0x3010
, 0xc696, 0x2080, 0x59a3, 0x104c, 0x9638, 0x81c6, 0xa720, 0x4e59
, 0xf910, 0xf492, 0xe289, 0x4927, 0x247e, 0x923c, 0x43c4, 0x21c2
, 0x3840, 0x0c24, 0x0000, 0x0043};

/* file: connie3.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 connie3_inb[] PROGMEM = {
  42
, 0x001e, 0x8000, 0x1027, 0x850a, 0x1e40, 0x0000, 0x2780, 0x0a10
, 0x4085, 0xe000, 0x0079, 0x1080, 0x8402, 0x0010, 0x79e0, 0x8000
, 0x0210, 0x1084, 0x001e, 0x8000, 0x01e7, 0x0000, 0x0278, 0x50a1
, 0x2408, 0x0a10, 0x4085, 0xe000, 0x0079, 0x0000, 0x079e, 0x0800
, 0x4021, 0x8108, 0x0210, 0x1084, 0x0094, 0x9000, 0x0902, 0x0402
, 0x0809, 0x0904, 0xc102, 0x0040, 0x3020, 0xc00e, 0x0030, 0x7877
, 0xe492, 0x43e1, 0x30c0, 0x1c20, 0x937c, 0x83ec, 0xd040, 0x20b6
, 0xf800, 0xfcf3, 0x2001, 0x36c8, 0x0041, 0x92fb, 0x0df4, 0x2fa0
, 0x5f4f, 0xf800, 0xfcf3, 0xc001, 0xcf37, 0x003e, 0x977c, 0x03ee
, 0xe7c0, 0x3e79, 0x7100, 0xe79e, 0x1408, 0x39c5, 0x408a, 0x9c51
, 0x08a3, 0x4514, 0x8a20, 0x5142, 0xa204, 0x1428, 0x1081, 0x4288
, 0x0811, 0x2881, 0x0404, 0x0200, 0x0202, 0x0000, 0x0004};

/* file: dl1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 dl1_inb[] PROGMEM = {
  58
, 0xffff, 0xffff, 0xffff, 0xffff, 0xff7f, 0xffff, 0xf7ff, 0xffff
, 0x3dff, 0xffff, 0xdfff, 0xfff3, 0xf7ff, 0xff1c, 0x7fff, 0xf1cf
, 0xdfff, 0x0c73, 0xf7ff, 0x431c, 0x7ff8, 0x31cf, 0xdf84, 0x0c73
, 0xfc21, 0xc73d, 0xc210, 0x31cf, 0x3084, 0x1cfe, 0x0843, 0xc7e3
, 0xc210, 0x7f38, 0x210c, 0xf38c, 0x0843, 0xbce3, 0x843f, 0xce30
, 0x21fb, 0xf38c, 0x1ffe, 0x38c2, 0xffef, 0xce30, 0xfffb, 0xe30f
, 0xffbc, 0x38ff, 0xffef, 0x8fff, 0xfef3, 0xffff, 0xffbc, 0xffff
, 0xfbcf, 0xffff, 0xfeff, 0xffff, 0xefff, 0xffff, 0xffff, 0xffff
, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffbf, 0xffff, 0xfbff
, 0xffff, 0x3eff, 0xffff, 0xefff, 0xfff3, 0xfbff, 0xfe3c, 0xbfff
, 0xe3cf, 0xefff, 0x38f3, 0xfffc, 0x8f3e, 0xbfc3, 0xe3cf, 0xf870
, 0x3cfb, 0x870e, 0x8f3e, 0xe1c3, 0xf3e0, 0x1c38, 0x3c0e, 0x870e
, 0xc1c3, 0x70e3, 0x1c38, 0x1c38, 0xc70e, 0xc383, 0x70e1, 0x703c
, 0x1c38, 0x07cf, 0xc387, 0x7cf1, 0x70e1, 0xdf3c, 0x1e3f, 0xf7cf
, 0xc7ff, 0xfdf3, 0x7fff, 0xdf3c, 0xffff, 0xf7cf, 0xffff, 0x7cff
, 0xffff, 0xdfff, 0xffff, 0xffff, 0xfffd, 0xffff, 0xffff, 0xffff
, 0xffff, 0xffff, 0x00ff};

/* file: dl3.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 dl3_inb[] PROGMEM = {
  70
, 0x0020, 0x4000, 0x8200, 0x1000, 0x2004, 0x0608, 0x0041, 0x6182
, 0x0418, 0x1860, 0x6186, 0x8610, 0x1861, 0x6386, 0x8618, 0x3c61
, 0x618e, 0xc718, 0x38e3, 0x71c6, 0x8e3c, 0x1cf3, 0xe3c7, 0xcf3c
, 0x3c73, 0xf3cf, 0xcf3c, 0x3cfb, 0xf3cf, 0xefbd, 0x7cf3, 0xfbdf
, 0xdfbe, 0xbdf7, 0xffef, 0xdf7f, 0xfffb, 0xffff, 0xfffd, 0xffff
, 0xdfff, 0xffff, 0xffbf, 0xfffc, 0xf3ff, 0xffc7, 0x3fff, 0xfc3e
, 0xffff, 0xc1c3, 0xffff, 0x083f, 0xfffc, 0x03ff, 0xff80, 0x1fff
, 0xf000, 0xffff, 0x0000, 0xfffe, 0x0007, 0xffc0, 0x003f, 0xf800
, 0x01ff, 0x0000, 0x0fff, 0x0000, 0xf9f0, 0x0000, 0x0f00, 0x000f
, 0x7000, 0x00e0, 0x0000, 0x0c03, 0x0000, 0x8010, 0x0000, 0x6100
, 0x0008, 0x1800, 0x0186, 0x8200, 0x1861, 0x3004, 0x8618, 0x80c1
, 0x6183, 0x1c18, 0x183c, 0xc186, 0x83e3, 0x1861, 0x3f7c, 0x8618
, 0xffc1, 0x6187, 0xfe18, 0x18ff, 0xf186, 0x9fff, 0x9861, 0xffff
, 0x861b, 0xfffd, 0x61ff, 0xfff8, 0x1fff, 0xff8f, 0xffff, 0xfcf3
, 0xffff, 0xef7f, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff, 0xfbe7
, 0xffff, 0xbe7d, 0x7fef, 0xe7df, 0x9efb, 0x7df7, 0xe7be, 0xde79
, 0x79e7, 0xe79e, 0x8e79, 0x79e7, 0xe71e, 0x9e38, 0x71c7, 0xe38e
, 0x1c70, 0x38e7, 0xc30c, 0x0e71, 0x30c3, 0xc70c, 0x0c30, 0x30c3
, 0xc308, 0x0c30, 0x2081, 0x430c, 0x0810, 0x1082, 0x8104, 0x0020
, 0x1040, 0x0008, 0x0000, 0x0001, 0x0000, 0x0000};

/* file: goodpattern.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 goodpattern_inb[] PROGMEM = {
  43
, 0x04a5, 0x5206, 0x350a, 0xc492, 0x080a, 0xb9d1, 0x5108, 0x604a
, 0xa520, 0x2350, 0xac49, 0x4840, 0x236c, 0x8421, 0x36c4, 0x5212
, 0x6848, 0xa121, 0xa540, 0x2a56, 0x4000, 0x2bfd, 0x1000, 0xa95a
, 0x0085, 0xf542, 0x042a, 0x5210, 0x84a9, 0x1080, 0x8b9d, 0x8410
, 0xa950, 0x2210, 0x9704, 0x420e, 0x5085, 0x10a9, 0x140a, 0x8e97
, 0x8002, 0xb6d4, 0x2012, 0x00b5, 0x4ad0, 0x2312, 0x8c49, 0x30c4
, 0xc30c, 0x8c30, 0x30c4, 0x2312, 0x9285, 0x4a14, 0x2252, 0xa449
, 0x14a4, 0x850a, 0xc652, 0x6060, 0x0630, 0x90a0, 0x0050, 0x0e28
, 0x4709, 0x4281, 0x256a, 0x9014, 0xa95a, 0x4095, 0x99ab, 0x2d59
, 0xbd38, 0xcbd0, 0x6781, 0x6666, 0x991e, 0x2f4a, 0x6995, 0x0b56
, 0x66ad, 0x4a99, 0x952f, 0xa999, 0x52f4, 0x1c99, 0xe673, 0x038c
, 0x15ad, 0x4db2, 0xc243, 0x372d, 0x1039, 0xc24b, 0xc0a3, 0x20f0
, 0x0418};

/* file: ilike.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ilike_inb[] PROGMEM = {
  87
, 0x8420, 0x4210, 0x4100, 0x2090, 0x0808, 0x0604, 0x0102, 0x00e0
, 0x0070, 0x1200, 0x0489, 0x2000, 0x430c, 0x0000, 0x2942, 0x0004
, 0x0038, 0x01c0, 0x2108, 0x0840, 0x1041, 0x8204, 0x0220, 0x1081
, 0x0408, 0x0038, 0x01c0, 0x4080, 0x1020, 0x0800, 0x0492, 0x0001
, 0x2942, 0x0004, 0x9c00, 0x0003, 0xa100, 0x0850, 0x2000, 0x430c
, 0x0000, 0x1084, 0x0002, 0x9c00, 0x0003, 0x0204, 0x0409, 0x2082
, 0x4108, 0x1010, 0x2042, 0x0084, 0x0070, 0x00e0, 0x0204, 0x0409
, 0x2082, 0x4108, 0x0810, 0x0604, 0x8102, 0x0003, 0x1c00, 0x0e00
, 0x0700, 0x0000, 0x01f8, 0x0000, 0xe070, 0x0000, 0x001c, 0x0380
, 0x0007, 0x0000, 0x081e, 0x0204, 0x4181, 0x8010, 0x2820, 0x0208
, 0x4104, 0x4104, 0x0820, 0x2082, 0x4108, 0x1010, 0x0904, 0x0082
, 0x6082, 0x0410, 0x0c30, 0xc30f, 0xe380, 0x71f8, 0x3c1c, 0x3fcf
, 0xe3cf, 0xfefb, 0x7df7, 0xffff, 0xffff, 0x7dff, 0xef9f, 0xcffb
, 0xf0f3, 0x7f3c, 0x071c, 0xe38e, 0x30c3, 0x30c0, 0x041c, 0x0801
, 0x8182, 0x2040, 0x7810, 0x0000, 0xe000, 0x01c7, 0x3800, 0x1c7e
, 0x8e07, 0x38e3, 0x1f8e, 0x01c7, 0xffe0, 0x007f, 0xf1c0, 0x38ff
, 0x1c70, 0x8e07, 0x8ee3, 0x70e3, 0xc71c, 0x9c71, 0x38e3, 0x8e38
, 0xc71f, 0xe001, 0x7fff, 0xc000, 0xfff1, 0x0038, 0x9e38, 0x01c7
, 0xe700, 0x0e79, 0x0000, 0x030c, 0x0000, 0x79e3, 0xc00c, 0xff30
, 0x30cf, 0x330c, 0x0ccf, 0x00c3, 0x0861, 0x5830, 0x8010, 0x11a0
, 0x0007, 0x8e00, 0x0823, 0x4100, 0x806c, 0x1060, 0x0c60, 0x8610
, 0x8300, 0x0105, 0x1a08, 0x0071, 0xe000, 0x0218, 0x0000, 0xa184
, 0x0004, 0x1852, 0x0c4a, 0x8523, 0x0fc0, 0x9248, 0x48c4, 0x2861
, 0x9231, 0x0124, 0x103f, 0x0c4a, 0x8523, 0xc480, 0x1230, 0x0000
, 0x030c, 0x0000, 0x0000, 0x0000};

/* file: imagenode.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 imagenode_inb[] PROGMEM = {
  109
, 0x107f, 0xc104, 0x0bff, 0x2082, 0x3ffc, 0x1041, 0xffc4, 0x0c33
, 0xfcc3, 0x0000, 0x0000, 0x33f0, 0xc30c, 0x3ffc, 0x30c3, 0x0fcc
, 0x0000, 0x0000, 0xc33f, 0xcc30, 0x000f, 0x0000, 0x6100, 0x8618
, 0x1ce1, 0x6186, 0x8738, 0x1861, 0x61ce, 0x8618, 0x1b61, 0x6186
, 0xb618, 0x1873, 0x6186, 0x8f5a, 0x1861, 0xf7ae, 0x8e18, 0x7ae3
, 0xe38f, 0xae38, 0x08f7, 0x0000, 0x0000, 0x38e3, 0xf7ae, 0x8e38
, 0x7ae3, 0x008f, 0x0000, 0x3000, 0xe38e, 0x8f7a, 0x0000, 0x0000
, 0x8610, 0x0861, 0x6178, 0x8618, 0x101e, 0xe186, 0x000f, 0xf861
, 0x0087, 0x8610, 0x287f, 0x6101, 0x87f8, 0x3312, 0x7f86, 0x3128
, 0xf8e3, 0x1287, 0x8e33, 0x28ff, 0x0031, 0x0000, 0x3000, 0xff8e
, 0x3128, 0xf8e3, 0x128f, 0x0003, 0x0000, 0xe300, 0x8ff8, 0x0312
, 0x0000, 0x0000, 0x100c, 0x0004, 0x3003, 0xc082, 0x0c00, 0x0c33
, 0xc30c, 0xc30c, 0x3030, 0x30cf, 0xc30c, 0x0ff3, 0x30c3, 0xfffc
, 0x0fbc, 0xffc3, 0xfbcf, 0xfc30, 0x0000, 0x0000, 0xcff0, 0x30fb
, 0xfffc, 0x0fbc, 0x0fc3, 0x0000, 0x0000, 0xbcff, 0xc30f, 0x000f
, 0x0000, 0x3f00, 0x0000, 0xffc0, 0x0003, 0xfff0, 0x003f, 0xc0fc
, 0x07ff, 0x1fc1, 0x7ffc, 0x7c10, 0xffc1, 0xc30f, 0xfc33, 0x0000
, 0x0000, 0x0ff0, 0x33c3, 0xfffc, 0x3c30, 0x0fc3, 0x0000, 0x0000
, 0x30ff, 0xc33c, 0x000f, 0x0000, 0x6100, 0x8618, 0x1861, 0x61c6
, 0x8638, 0x9c61, 0x6396, 0xce38, 0x39eb, 0x0086, 0x0000, 0x3000
, 0xebce, 0x8639, 0xbce3, 0x639e, 0x0008, 0x0000, 0x6100, 0x969c
, 0x1863, 0x61fe, 0x87f8, 0x1fff, 0xff86, 0x87ff, 0x1861, 0xfffe
, 0xcf3c, 0xfff3, 0xf3cf, 0xff3c, 0x0000, 0x0000, 0xcff0, 0x3cf3
, 0xffff, 0xcf3c, 0x0ff3, 0x0000, 0x0000, 0x3cff, 0xf3cf, 0xcfef
, 0x3cf3, 0xfdfb, 0xcf3c, 0xbf73, 0xf3cf, 0xef3c, 0x3cf7, 0xf3cf
, 0x0efd, 0x30c3, 0xdfbc, 0x4d34, 0xf7d3, 0xf34c, 0x3d3c, 0x0000
, 0x0000, 0x4cf0, 0x3cf3, 0xcf3d, 0xcf34, 0x03d3, 0x0000, 0x0000
, 0x34cf, 0xd3cf, 0x4df3, 0x34d3, 0xff7d, 0x0c34, 0xffd3, 0xc30f
, 0xfc30, 0x30ff, 0xc31c, 0x0fff, 0x33c3, 0x00fc, 0x0000, 0xf000
, 0xc30f, 0xfc33, 0x30ff, 0xc33c, 0x000f, 0x0000, 0xff00, 0x3c30
, 0xffc3, 0xc30f, 0xfc33, 0x0000, 0x0000, 0x0000};

/* file: jason_drops.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_drops_inb[] PROGMEM = {
  40
, 0x0080, 0x0000, 0x0800, 0x0000, 0x4200, 0x0021, 0x2000, 0x0214
, 0x0000, 0x5205, 0x0008, 0x2080, 0x01c8, 0x1000, 0x2104, 0x0007
, 0x2082, 0x1c84, 0x0000, 0x1080, 0x0002, 0x0000, 0x0042, 0x0000
, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0000
, 0x2000, 0x0000, 0x0800, 0x0085, 0x8000, 0x0850, 0x2000, 0x4894
, 0x0021, 0x8a27, 0xc722, 0x4189, 0x8810, 0x0062, 0x4000, 0x0010
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0004
, 0x0000, 0x0040, 0x0000, 0x0810, 0x0001, 0x8100, 0x0010, 0x2040
, 0x4210, 0x0c00, 0x4104, 0x0308, 0x2081, 0x4108, 0x1020, 0x2106
, 0x0408, 0x20a2, 0x8104, 0x8508, 0x2080, 0x5080, 0x0008, 0x9420
, 0x2148, 0x2700, 0x228a, 0x89c7, 0x1041, 0x6288, 0x0000, 0x1040
, 0x0000, 0x0000};

/* file: jason_flyby.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_flyby_inb[] PROGMEM = {
  36
, 0x0401, 0x0200, 0x2400, 0x0000, 0x0408, 0x0011, 0x0000, 0x4018
, 0x0000, 0x4040, 0x0100, 0x0000, 0x0100, 0x0406, 0x0000, 0x0014
, 0x0010, 0x1080, 0x4010, 0x0400, 0x4000, 0x2100, 0x0000, 0x0100
, 0x0005, 0x0080, 0x1004, 0x0420, 0x1000, 0xa000, 0x0000, 0x0440
, 0x0201, 0x0000, 0x0018, 0x0008, 0x4040, 0x2000, 0x0000, 0x0900
, 0x0880, 0x4000, 0x0004, 0x0020, 0x1002, 0x8002, 0x0010, 0x0800
, 0x0280, 0x0000, 0x0420, 0x0008, 0x8000, 0xa000, 0x0001, 0x0200
, 0x0404, 0x0000, 0x2028, 0x0010, 0x0100, 0x4080, 0x0800, 0x0000
, 0x4102, 0x0200, 0x0800, 0x1404, 0x0000, 0x8020, 0x0010, 0x8000
, 0x4006, 0x0000, 0x0820, 0x0100, 0x0100, 0x0020, 0x0004, 0x8080
, 0x1000};

/* file: jason_pulse.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_pulse_inb[] PROGMEM = {
  12
, 0x2780, 0x1e49, 0x7800, 0xe492, 0x8001, 0x4927, 0x801e, 0x9158
, 0x11a8, 0x2780, 0x1e49, 0x7800, 0xe492, 0x8001, 0x4927, 0x401e
, 0x6268, 0x2164, 0x2780, 0x1e49, 0x7800, 0xe492, 0x8001, 0x4927
, 0x201e, 0x92b0, 0x40d4};

/* file: jason_short_hv.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_short_hv_inb[] PROGMEM = {
  8
, 0xc000, 0x0030, 0x3000, 0xc30c, 0x0c00, 0x30c3, 0x030c, 0x0c30
, 0x00c3, 0xc000, 0x0030, 0x0000, 0x079e, 0x0000, 0xfff0, 0x0000
, 0x9e00, 0x0007};

/* file: jason_spinner.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_spinner_inb[] PROGMEM = {
  12
, 0xce30, 0xc739, 0xe000, 0x73fc, 0x0000, 0x7fec, 0x0003, 0xff00
, 0x000f, 0xf0c0, 0x30f9, 0x1c00, 0x8f0f, 0xc303, 0x70e1, 0x6c38
, 0x0e18, 0x6187, 0xc386, 0x1c30, 0x30c6, 0xc30c, 0x1830, 0x30c7
, 0x818e, 0x9c61, 0x1863};

/* file: jason_spiral.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jason_spiral_inb[] PROGMEM = {
  60
, 0x0000, 0xc610, 0x0000, 0xc200, 0x0018, 0x0080, 0x0318, 0x0400
, 0x6104, 0x0000, 0x0051, 0x400c, 0x0210, 0x0082, 0x8086, 0x0020
, 0x2430, 0x0008, 0x0980, 0x0012, 0x8a00, 0x0202, 0x3000, 0x08a0
, 0x8000, 0x8401, 0x0020, 0x000c, 0x0610, 0x0060, 0xc200, 0x0300
, 0x0080, 0x1018, 0x0404, 0x0104, 0x1040, 0x0051, 0x4000, 0x0251
, 0x0000, 0x0486, 0x0001, 0x0430, 0x0410, 0x0180, 0xc010, 0x0800
, 0x0202, 0x0018, 0x08a0, 0x0300, 0x8400, 0x6020, 0x0000, 0x0610
, 0x000c, 0xc200, 0x0082, 0x8080, 0x0038, 0x2400, 0x010c, 0x0800
, 0x0053, 0xc200, 0x0210, 0x3000, 0x0086, 0x8000, 0x0431, 0x0000
, 0x018c, 0x0010, 0x0860, 0x0202, 0x0300, 0x08a0, 0x1000, 0x8404
, 0x0020, 0x1040, 0x0610, 0x0000, 0xc241, 0x0000, 0x0480, 0x0019
, 0x0400, 0x0514, 0x0000, 0xc051, 0x4000, 0x0210, 0x0018, 0x0086
, 0x0300, 0x0430, 0x6000, 0x0180, 0x0010, 0x080c, 0x0202, 0x0082
, 0x88a0, 0x0020, 0xa400, 0x0028, 0x0800, 0x0612, 0x8200, 0xc200
, 0x3000, 0x0080, 0x8018, 0x0401, 0x0104, 0x000c, 0x0051, 0x4060
, 0x0210, 0x0300, 0x0086, 0x1000, 0x0434, 0x0000, 0x11c0, 0x0010
, 0x0800, 0x0243, 0x0000, 0x0ca0, 0x0001, 0x8400, 0x0430};


/* file: jensblinkie.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 jensblinkie_inb[] PROGMEM = {
  20
, 0x0780, 0xc000, 0x780f, 0x1000, 0x807c, 0x0407, 0x03c1, 0x4338
, 0x1c10, 0x31c0, 0xc10c, 0x0c10, 0x30c3, 0x4304, 0x0c30, 0x7007
, 0xc104, 0x00e0, 0x104f, 0x1e00, 0x05f0, 0xe30c, 0x3f01, 0x30c0
, 0xe01e, 0x0c83, 0x01e3, 0xc83c, 0x1c72, 0x8380, 0x8f3c, 0x3001
, 0xf3cc, 0x0030, 0x3ce2, 0x820f, 0xcf00, 0x20b3, 0x780c, 0x0b2c
, 0x80e2, 0xb0c7, 0x0f20, 0x0c78, 0xf803};

/* file: krisstina.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 krisstina_inb[] PROGMEM = {
  26
, 0x0333, 0xcc00, 0x000c, 0x030c, 0x3300, 0x0003, 0x0ccc, 0x6186
, 0x0618, 0x003f, 0xc000, 0x0bff, 0x0204, 0xbffd, 0x2048, 0xffd1
, 0x0c4b, 0xfd23, 0x24a1, 0x5249, 0x4208, 0x0820, 0xad81, 0x0004
, 0x1000, 0x4108, 0x0420, 0x0000, 0x5200, 0x873b, 0x1000, 0x0cce
, 0xfff3, 0x330c, 0x0087, 0xce10, 0xccf3, 0xf330, 0x30cc, 0xccf3
, 0xf330, 0x000c, 0x0cf3, 0x0c00, 0x0003, 0xc0c3, 0x3030, 0xc30c
, 0x330c, 0xf30c, 0x30cc, 0xccf3, 0xf330, 0x30cc, 0xccf3, 0xf330
, 0x000c, 0x0000, 0x0000};

/* file: mark1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 mark1_inb[] PROGMEM = {
  6
, 0x0021, 0x4000, 0x8528, 0x1000, 0x8c4a, 0x8614, 0xc312, 0xf330
, 0x30cc, 0xeb52, 0xad79, 0x4a14, 0x230c, 0x0085};

/* file: mark2.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 mark2_inb[] PROGMEM = {
  9
, 0x2b52, 0xad49, 0xb524, 0xd492, 0x524a, 0x492b, 0x24ad, 0x92b5
, 0x4ad4, 0xd48c, 0x12b6, 0x48c3, 0x2b6d, 0x8c31, 0xb6d4, 0xc312
, 0x6d48, 0x312b, 0xd48c, 0x12b6, 0x0003};

/* file: mark_myopic.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 mark_myopic_inb[] PROGMEM = {
  43
, 0x8420, 0x4210, 0xa100, 0x5294, 0x0808, 0x4621, 0x4108, 0x0108
, 0x2108, 0x0042, 0x2000, 0x0014, 0x0000, 0x0180, 0x0000, 0x1800
, 0x0000, 0x8000, 0x0001, 0x0000, 0x0428, 0x0000, 0x8442, 0x8010
, 0x8210, 0x6210, 0x1084, 0x4a10, 0x8529, 0x4200, 0x2108, 0x2004
, 0x1084, 0x0042, 0x0842, 0x0421, 0x0420, 0x4200, 0x4200, 0x2000
, 0x2004, 0x0004, 0x0042, 0x0002, 0x0400, 0x0020, 0x4000, 0x0200
, 0x0000, 0x1004, 0x0008, 0x8081, 0x6040, 0x1020, 0x1204, 0x0489
, 0x0812, 0x0204, 0x4281, 0x50a1, 0x4428, 0x9120, 0x2048, 0x0408
, 0x0206, 0x8101, 0x1000, 0x2008, 0x0000, 0x0040, 0x0002, 0x0400
, 0x0020, 0x4000, 0x0200, 0x0000, 0x2004, 0x0000, 0x0040, 0x0002
, 0x0400, 0x0020, 0x4000, 0x4200, 0x2000, 0x2004, 0x0004, 0x0042
, 0x0042, 0x0420, 0x8420, 0x4210, 0x4200, 0x2108, 0x2004, 0x1084
, 0x0042};

/* file: philseed.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 philseed_inb[] PROGMEM = {
  40
, 0xc000, 0x0030, 0x4800, 0x230c, 0x8001, 0xb6d4, 0x1012, 0x6d7a
, 0x852b, 0xd7a1, 0x527a, 0x4a18, 0x37ad, 0xa1b7, 0x7bf4, 0x1b73
, 0xbf4a, 0xb734, 0xf4bf, 0x734b, 0x4bfb, 0x34ff, 0xbfb7, 0xcff4
, 0xfb73, 0xff4f, 0xb73c, 0xfcff, 0x73cf, 0xdffb, 0x3cff, 0xffb7
, 0xcfff, 0x0b73, 0x0000, 0x48c3, 0x2492, 0x8c31, 0x4924, 0xdb52
, 0xd24a, 0xb52f, 0x34ad, 0x52ff, 0xcedb, 0x2cf3, 0xedb5, 0x30cc
, 0x24ad, 0x0c31, 0x4a13, 0xc312, 0xa100, 0x3124, 0x102d, 0x124a
, 0x02d3, 0x34a1, 0x2db7, 0x7b30, 0xfb73, 0xad33, 0xcd27, 0x2cc0
, 0x2d85, 0xcf33, 0xd852, 0x0c32, 0x7ad3, 0xecd2, 0xbf79, 0xcd27
, 0x0861, 0x2d84, 0x86d3, 0xdfde, 0x9232, 0x0217, 0x2cd2, 0xf379
, 0xfdec, 0xc86d, 0x2130, 0xcff0, 0x379e, 0x007b, 0x8613, 0x084c
, 0x6130, 0xfcc8};

/* file: ray1.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ray1_inb[] PROGMEM = {
  55
, 0x1e31, 0x3221, 0xe32a, 0x8d1a, 0x3402, 0xf3ce, 0x8000, 0x3cf3
, 0x000e, 0x8f3c, 0x00e3, 0xf3c0, 0x0e38, 0x3c00, 0xe38e, 0xc000
, 0x38f3, 0x000e, 0xcf38, 0x00e3, 0xe380, 0x0f3c, 0x3800, 0xf38e
, 0x8004, 0x38e3, 0x104e, 0x8e38, 0x00e3, 0xe381, 0x0e38, 0x0000
, 0xe00e, 0x8000, 0x3803, 0x0000, 0x0e00, 0x00e0, 0x0380, 0x0038
, 0x0000, 0xe00e, 0x8000, 0x3803, 0x0000, 0x0e00, 0x00e0, 0x0380
, 0x0038, 0x0000, 0xe00e, 0x8000, 0x3803, 0x0000, 0x0e00, 0x00e0
, 0x0380, 0x0038, 0x3800, 0x01c0, 0x8000, 0x0e03, 0x0000, 0x7038
, 0x0000, 0x0380, 0x0003, 0x3800, 0x0010, 0x8000, 0x0003, 0x0000
, 0x0230, 0x0000, 0x4200, 0x0008, 0x0000, 0x2108, 0x0000, 0x2000
, 0x0084, 0x0000, 0x1080, 0x0002, 0x4000, 0x0042, 0x0800, 0x0808
, 0x0100, 0x0101, 0x3000, 0x0020, 0x0400, 0x0005, 0xc000, 0x0010
, 0x1000, 0x0104, 0x0000, 0x00c1, 0x0000, 0x0070, 0x0000, 0x0700
, 0x0000, 0x7000, 0x0000, 0x0000, 0x0380, 0x0000, 0x0000, 0x001c
, 0x0000, 0xe000, 0x0000, 0x0000, 0x0300, 0x0000, 0x0000, 0x0008
, 0x0000, 0x0000, 0x0000, 0x0000};

/* file: ray3.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ray3_inb[] PROGMEM = {
  9
, 0x0000, 0x0000, 0x0000, 0x0200, 0x0000, 0x2000, 0x0000, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000
, 0x0000, 0x0002, 0xffff, 0xffdf, 0x000f};



/* file: ray6.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ray6_inb[] PROGMEM = {
  26
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3082, 0x0000, 0x0000
, 0x0000, 0x8200, 0x0030, 0x2000, 0x0308, 0x0000, 0x0000, 0x0000
, 0x0820, 0x0003, 0x0000, 0x0000, 0x2000, 0x0308, 0x0000, 0x2148
, 0x0000, 0x1480, 0x0002, 0x8000, 0x00e0, 0x0000, 0x0e08, 0x0000
, 0x2100, 0x0810, 0x1000, 0x8102, 0x0000, 0x0860, 0x0002, 0x8600
, 0x0020, 0x2000, 0x0094, 0x0000, 0x0942, 0x0000, 0x0838, 0x0000
, 0x8380, 0x8000, 0x2040, 0x0004, 0x0408, 0x0042, 0x8200, 0x0030
, 0x2000, 0x0308, 0x0000};

/* file: ruben3.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ruben3_inb[] PROGMEM = {
  20
, 0x8a28, 0x451f, 0xa281, 0x5f6f, 0xe814, 0xb6db, 0xf17d, 0x6db6
, 0xf6db, 0xdb7f, 0xedb6, 0xb7ff, 0xd492, 0xedfe, 0x79ec, 0x1b73
, 0xf3fe, 0x87fc, 0x3b40, 0x2dcf, 0xb5e0, 0xdcf3, 0x1e7a, 0x4923
, 0xe78c, 0xf3b5, 0x7adc, 0xd021, 0x40b6, 0x4a18, 0x2b6d, 0x8185
, 0xa654, 0x0812, 0x9a4a, 0x0525, 0x4481, 0x1220, 0x7a08, 0xe108
, 0x8105, 0x2047, 0xc81e, 0x084a, 0x3521};

/* file: ruben5.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ruben5_inb[] PROGMEM = {
  26
, 0x0000, 0x0c30, 0x0003, 0x2300, 0x0085, 0xfc00, 0x0000, 0x3f00
, 0x0000, 0xc4a1, 0x0000, 0x8610, 0x0021, 0x8c00, 0x0214, 0x0000
, 0x3f00, 0x0000, 0x1000, 0x0c4a, 0x0000, 0x1861, 0x0002, 0x48c0
, 0x0021, 0x0000, 0x03f0, 0x0000, 0x1284, 0x03f3, 0xc300, 0xc030
, 0x300f, 0x0852, 0xc0fc, 0x000f, 0xc4a1, 0x00fc, 0x30c0, 0x0fcc
, 0x8c00, 0xfe14, 0x0000, 0xff00, 0x000f, 0xf000, 0x3f03, 0x0000
, 0x003f, 0x00fc, 0x03f0, 0x0b52, 0xbf00, 0x02d4, 0xd480, 0x2d4a
, 0x1420, 0x0b52, 0x00a1};



/* file: ruben8.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 ruben8_inb[] PROGMEM = {
  39
, 0xc104, 0x083f, 0x1042, 0xa33c, 0x0424, 0x33c1, 0x430c, 0x3c10
, 0x9143, 0xc104, 0x04f3, 0x5241, 0x4f0c, 0x0c10, 0xf0c3, 0x9104
, 0x0c28, 0x104f, 0xf208, 0x04f0, 0x2891, 0x430c, 0x0c91, 0x30c3
, 0x430c, 0x0c52, 0x24a3, 0xf208, 0x04f0, 0x4a11, 0x230c, 0x0485
, 0x3fc1, 0xc208, 0xe450, 0x2083, 0xc30c, 0x083c, 0x30c2, 0x09cc
, 0x0c21, 0xfcc3, 0xc000, 0x4c30, 0x102e, 0xc30c, 0x04f0, 0x28c1
, 0x4f09, 0x0810, 0xe674, 0x0102, 0xff00, 0x000f, 0x9084, 0x109f
, 0x0412, 0x09f9, 0x4182, 0xc631, 0x1828, 0x0d14, 0x828b, 0x5241
, 0x24a9, 0x2848, 0x4a95, 0x8421, 0x8912, 0x0214, 0x8a38, 0x00e2
, 0x51c0, 0x1c50, 0x1c00, 0x8a05, 0x0003, 0xf6f0, 0x1000, 0x6c08
, 0x8103, 0xc104, 0x0836, 0x1242, 0x830c, 0x0c24, 0x30c1, 0x0308};

/* file: spinnerz.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 spinnerz_inb[] PROGMEM = {
  37
, 0x0021, 0x4000, 0x0508, 0x0000, 0x080a, 0x8010, 0x4100, 0x6000
, 0x2000, 0x0802, 0x0100, 0x0214, 0x0000, 0x5084, 0x0000, 0x80a0
, 0x0100, 0x1008, 0x0004, 0x0006, 0x8022, 0x1000, 0x2140, 0x0000
, 0x0840, 0x0048, 0x0120, 0x2200, 0x0440, 0x1000, 0x8090, 0x8000
, 0x0004, 0x0012, 0x0220, 0x0044, 0x0100, 0x0809, 0x4800, 0x2000
, 0x0001, 0x0901, 0x0008, 0x0220, 0x0044, 0x0480, 0x1200, 0x1000
, 0x8090, 0x0000, 0x4022, 0x0004, 0x0048, 0x0120, 0x0100, 0x0809
, 0x2000, 0x4402, 0x8000, 0x0004, 0x1012, 0x0002, 0x8400, 0x0802
, 0x0100, 0x0044, 0x0060, 0x0820, 0x8010, 0x0100, 0x0005, 0x0a00
, 0x0021, 0x4000, 0x4808, 0x2000, 0x0001, 0x0901, 0x0008, 0x0220
, 0x0044, 0x0480, 0x1200, 0x0000};

/* file: spirally.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 spirally_inb[] PROGMEM = {
  10
, 0x0021, 0x4000, 0x8528, 0x1000, 0x8c4a, 0x8614, 0x0312, 0x9230
, 0x00c4, 0xc000, 0x0030, 0x4800, 0x2000, 0x5001, 0x0000, 0x80a0
, 0x0100, 0x1008, 0x0004, 0x0006, 0x8022, 0x1000, 0x0040};

/* file: staffymix.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 staffymix_inb[] PROGMEM = {
  40
, 0x1861, 0x6186, 0x4a48, 0x2249, 0x0091, 0xfff0, 0x1000, 0x1e2c
, 0x020d, 0x4100, 0x2792, 0x100e, 0x2b64, 0x0093, 0x58c4, 0x0e21
, 0x4100, 0xe397, 0x2100, 0x2496, 0x1c0f, 0xc588, 0x0062, 0x9200
, 0x0124, 0x2000, 0x1249, 0x8000, 0x2244, 0x0001, 0x01f8, 0x6000
, 0x10a4, 0x8000, 0x0c30, 0x0001, 0xa508, 0x0010, 0x0820, 0x0702
, 0x0200, 0x1081, 0xe408, 0x0000, 0x1041, 0x2108, 0x0410, 0x2081
, 0x4108, 0x2810, 0x1086, 0x8146, 0xf862, 0x1461, 0xa668, 0x665f
, 0x5681, 0xa7fe, 0x6816, 0x7fe3, 0x816c, 0xfc76, 0x16e3, 0xa768
, 0x6e5f, 0x2081, 0x41f8, 0x2010, 0x1084, 0x8042, 0xf820, 0x1041
, 0xa142, 0x2850, 0x1424, 0x850a, 0x4e42, 0x8610, 0x4720, 0x6318
, 0x218c, 0x9084, 0x109f, 0x4082, 0x2e67, 0x0810, 0x0604, 0x0102
, 0x6082, 0x0410};

/* file: stoppy.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 stoppy_inb[] PROGMEM = {
  51
, 0x0000, 0x0200, 0x0002, 0x2000, 0x0010, 0x0000, 0x0084, 0x0000
, 0x0480, 0x0000, 0x1100, 0x0000, 0x0040, 0x00c3, 0x0010, 0x0c30
, 0x0004, 0x0100, 0x0001, 0x0040, 0x0020, 0x0010, 0x0400, 0x0004
, 0x8000, 0x0040, 0x0000, 0x0c30, 0x0000, 0xc300, 0x0000, 0x0000
, 0x000a, 0x0000, 0x2010, 0x0000, 0x0080, 0x0080, 0x0800, 0x0000
, 0xc302, 0x0000, 0x3800, 0x000c, 0x4000, 0x2000, 0x0000, 0x0002
, 0x0080, 0x0010, 0x0000, 0x0082, 0x0000, 0x0c30, 0x0020, 0xc300
, 0x8000, 0x2000, 0x0000, 0x0200, 0x0002, 0x0000, 0x0028, 0x0000
, 0x2400, 0x0000, 0x8000, 0x0080, 0x0000, 0x0410, 0x0000, 0x2100
, 0x0000, 0x1000, 0x0001, 0x0000, 0x0009, 0x4000, 0x0040, 0x1000
, 0x0010, 0x0400, 0x0004, 0x4000, 0x0001, 0x4000, 0x0004, 0x1000
, 0x0040, 0x0000, 0x0202, 0x0000, 0x1040, 0x0000, 0x8800, 0x0000
, 0x0000, 0x0009, 0x0000, 0x00a0, 0x0000, 0x8800, 0x0000, 0x0000
, 0x0220, 0x0000, 0x8000, 0x0008, 0x0000, 0x2200, 0x0000, 0x2000
, 0x0080, 0x0000, 0x0402};



/* file: todd_crawley.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 todd_crawley_inb[] PROGMEM = {
  47
, 0x4180, 0x0000, 0x1000, 0x0006, 0x0000, 0x1060, 0x0000, 0x0c00
, 0x0001, 0x8000, 0x0030, 0x0000, 0x0218, 0x0000, 0x6100, 0x0000
, 0x1000, 0x000c, 0x0000, 0x00c2, 0x0000, 0x0c00, 0x0002, 0x8000
, 0x0030, 0x0000, 0x4300, 0x0000, 0x1800, 0x0004, 0x8400, 0x0001
, 0x6000, 0x0010, 0x1000, 0x0006, 0x8000, 0x0021, 0x0000, 0x020c
, 0x0000, 0x3040, 0x0000, 0x0000, 0x0083, 0x0000, 0x0c10, 0x0000
, 0x6100, 0x0000, 0x1800, 0x0002, 0x8200, 0x0001, 0x6000, 0x0010
, 0x1000, 0x0006, 0x8000, 0x0021, 0x4000, 0x0018, 0x0000, 0x0086
, 0x0000, 0x0830, 0x0000, 0xc100, 0x0000, 0x0000, 0x010c, 0x0000
, 0x3080, 0x0000, 0x0800, 0x0006, 0x0000, 0x1060, 0x0000, 0x8200
, 0x0001, 0x2000, 0x000c, 0x0000, 0x20c0, 0x0000, 0x0800, 0x0006
, 0x8000, 0x0041, 0x0000, 0x0430, 0x0000, 0x0308, 0x0000, 0x2180
, 0x0000, 0x1840, 0x0000, 0x8600, 0x0000, 0x3000, 0x0008, 0x0000
, 0x00c1, 0x0000};



/* file: todd_followers.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 todd_followers_inb[] PROGMEM = {
  45
, 0x0080, 0x1000, 0x1000, 0x8000, 0x0000, 0x0002, 0x0004, 0x0040
, 0x0020, 0x0000, 0x0009, 0x0000, 0x0402, 0x8000, 0x0000, 0x0010
, 0x0018, 0x0180, 0x0380, 0x1c00, 0x7800, 0xe000, 0x8001, 0x0907
, 0x001e, 0xf078, 0x01e0, 0x1700, 0x1e8f, 0x7400, 0xe8f1, 0x4102
, 0x8f16, 0x3826, 0xf144, 0xc228, 0x1047, 0x208f, 0x04fe, 0x0861
, 0x4ff2, 0x8010, 0xff20, 0x0004, 0xf200, 0x000f, 0x0000, 0x00ef
, 0x0000, 0x0c70, 0x0000, 0x8300, 0x0000, 0x1000, 0x0018, 0x8000
, 0x0381, 0x0000, 0x381c, 0x0008, 0x81c1, 0x6083, 0x1c10, 0x1838
, 0xc186, 0x8781, 0x1861, 0x711e, 0x8618, 0x38e1, 0x6186, 0xc618
, 0x1847, 0x2186, 0x04fe, 0x0861, 0x5ff2, 0x8010, 0xffa0, 0x0007
, 0xfe00, 0x003f, 0xc000, 0x03ef, 0x0000, 0x3c7c, 0x0000, 0x83c0
, 0x0003, 0x1c00, 0x0030, 0xc000, 0x0200, 0x0000, 0x0004, 0x0004
, 0x0002, 0x9000, 0x0000, 0x2000, 0x0040, 0x0000};

/* file: todd_ping.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 todd_ping_inb[] PROGMEM = {
  40
, 0x0001, 0x0000, 0x0400, 0x0000, 0x0000, 0x0010, 0x0000, 0x4000
, 0x0000, 0x0000, 0x0100, 0x0000, 0x0000, 0x0004, 0x0000, 0x0080
, 0x0000, 0x1000, 0x0000, 0x0000, 0x0002, 0x0000, 0x0040, 0x0000
, 0x0800, 0x0000, 0x4200, 0x0000, 0x08c0, 0x0002, 0x4230, 0x0010
, 0x108c, 0x0082, 0x8423, 0x0410, 0x2108, 0x0004, 0x0840, 0x0001
, 0x4200, 0x0000, 0x1000, 0x0000, 0x0000, 0x0002, 0x0000, 0x0040
, 0x0000, 0x0800, 0x0000, 0x0000, 0x0001, 0x0000, 0x0020, 0x0000
, 0x8000, 0x0000, 0x0000, 0x0200, 0x0000, 0x0000, 0x0008, 0x0000
, 0x2000, 0x0000, 0x0000, 0x0080, 0x0000, 0x0420, 0x0000, 0x2108
, 0x0000, 0x0842, 0x8001, 0x4210, 0x2008, 0x1084, 0x0042, 0x8421
, 0x0010, 0x2108, 0x0004, 0x0840, 0x0001, 0x4200, 0x0000, 0x0000
, 0x0000, 0x0000};


/* file: todd_swingblink.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 todd_swingblink_inb[] PROGMEM = {
  66
, 0x0021, 0x4000, 0x0908, 0x1000, 0x0840, 0x0840, 0x0008, 0x0120
, 0x0042, 0x4440, 0x0200, 0x9010, 0x1000, 0x0200, 0x0602, 0x0000
, 0x1110, 0x0008, 0x0240, 0x2020, 0x4010, 0x0100, 0x0280, 0x0900
, 0x4400, 0x0200, 0x2004, 0x0088, 0x1000, 0x1101, 0x8000, 0x2008
, 0x0002, 0x0044, 0x0880, 0x0011, 0x2000, 0x0046, 0x1000, 0x8801
, 0x4000, 0x0002, 0x1024, 0x9000, 0x8000, 0x4002, 0x0020, 0x1004
, 0x8204, 0x0000, 0x30c0, 0x0000, 0x0c00, 0x0003, 0xc000, 0x0030
, 0x3000, 0xc492, 0x0000, 0x0000, 0x0000, 0x9230, 0x00c4, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000, 0x4923, 0x000c, 0x0000, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4923, 0x000c, 0x0000
, 0x0000, 0x2300, 0x0c49, 0x0000, 0x0000, 0x0c00, 0x8610, 0x0300
, 0x0000, 0x0000, 0x0873, 0xe100, 0x000c, 0x0000, 0x0000, 0x4923
, 0x000c, 0x0000, 0x0000, 0x0000, 0x0000, 0x7800, 0xe492, 0x0001
, 0x0000, 0x0000, 0x0000, 0x0000, 0x187f, 0xe186, 0x000f, 0x0000
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x148c, 0x1286, 0x0003
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0c48, 0x0123, 0x0000, 0x0000
, 0x4a10, 0x2000, 0x0085, 0x0000, 0x1000, 0x004a, 0x8520, 0x0000
, 0x0000, 0x0210, 0x0000, 0x0084, 0x0000, 0x1000, 0x0002, 0x8400
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};

/* file: todd_three_boinger.inb */
/* generated on Tue Jul 14 21:00:57 2009 */
const atmel_u16 todd_three_boinger_inb[] PROGMEM = {
  55
, 0x0100, 0x0002, 0x0002, 0x0802, 0x0001, 0x8400, 0x0020, 0x1000
, 0x8020, 0x0200, 0x0000, 0x0045, 0x8000, 0x8020, 0x0000, 0x0404
, 0x0100, 0x8800, 0x0000, 0x5008, 0x0000, 0x5400, 0x0000, 0x0500
, 0x0200, 0x0120, 0x0100, 0x0140, 0x0080, 0x0010, 0x0022, 0x0200
, 0x0808, 0x4000, 0x0001, 0x0040, 0x0108, 0x0020, 0x1000, 0x0014
, 0x0000, 0x1028, 0x0000, 0x4002, 0x0040, 0x1010, 0x0800, 0x0880
, 0x0000, 0x0401, 0x4000, 0xa000, 0x1000, 0x0000, 0x0401, 0x0000
, 0x8600, 0x0000, 0x3000, 0x0020, 0x8000, 0x8001, 0x0000, 0x000c
, 0x0100, 0x0060, 0x0000, 0x8208, 0x0000, 0x1004, 0x0010, 0x0080
, 0x0240, 0x1000, 0x4000, 0x0801, 0x0000, 0x0700, 0x0000, 0x0840
, 0x0010, 0x4008, 0x4000, 0x1000, 0x0002, 0x0008, 0x0840, 0x0100
, 0x0000, 0x2021, 0x0000, 0x0500, 0x0004, 0x0040, 0x0090, 0x0010
, 0x00a0, 0x0004, 0x0408, 0x0001, 0x0102, 0x8020, 0x0040, 0x2000
, 0x0011, 0x0000, 0x0844, 0x0000, 0x8002, 0x0040, 0x0040, 0x0100
, 0x0802, 0x0000, 0x0802, 0x0040, 0x0500, 0x0000, 0x8041, 0x0000
, 0x0208, 0x0010, 0x0140, 0x0200};



// ________________________________________________________________________
//
unsigned long g_rand_seed;	// for random number get

unsigned long get_rand(unsigned int min, unsigned int max)
{
	unsigned int range;
	unsigned int val;

	range= max-min;
	val= min + ( rand() % (range+1) );
	return val;
}




/* plays one of those patterns 
 *   frame      - frame counter
 *   brightness - brightness
 *   data       - pattern data */


void play_packed_pattern  (atmel_u16 n, atmel_u8 brightness, const atmel_u16 *data) {

    atmel_u16 numframes, startbit, curbit, curled, curword;

	if (brightness > brightmax)
	brightness = brightmax;

    numframes = pgm_read_word(data);
    n %= numframes;

    startbit = n * 36;
    data += 1 + startbit / 16;

    curbit = startbit % 16;
    curword = pgm_read_word(data);

    for (curled = 0; curled < 36; ++ curled) {
        if (curword & (1 << curbit))
            frame[curled] += brightness;

			if (frame[curled]>brightmax)
			{
				if (blend_mode<3)
				frame[curled]=0;
				else
				frame[curled]=brightmax;
			}

        ++ curbit;
        if (curbit == 16) {
            curbit = 0;
            ++ data;
            curword = pgm_read_word(data);
        }
    }

}



void pwm_init()
{
	unsigned char i;
	
	for (i=0;i<PWM_CHANNELS;i++)
	{
		leds[i]=0;
	}
	
	pwmCount=PWM_MAXVAL-1;  // jesse says ' so on first ISR we load counts from settings, since it increments at the beginning of the function
}

// ________________________________________________________________________
//
void init_timers()
{
	
	
	OCR0A=80; //upper register for comparison -- WAS 75, tweaked for maximum fade w/o stuttering
	
	//TCCR0A needs to be set to CTC mode, which is done by setting WGM01 to 1
	TCCR0A = (1<< WGM01); // CTC mode
	TCCR0B = (1<< CS01); // prescale 8
	TIMSK0 = (1<< OCIE0A); // enable Output Compare Match A Interrupt Enable for timer 0 
	TIMSK1 = (1<< OCIE1A); // enable Output Compare Match for timer 1
	
	TCCR1B = (1<<WGM12) | (1<<CS12) | (1<<CS10); //CTC mode, prescaler 1024
	OCR1A =  14400; 

	//enable external interrupts for buttons

	EIMSK = (1<<INT1) | (1<<INT0);
	EICRA = (1<<ISC00)| (1<<ISC10);
	


}

// ________________________________________________________________________
//  SERIAL STUFF FOR DEBUGGING -- COMMENTED OUT AND MAY NOT WORK

// set baud rate:  14400 for now -- 63 comes from the datasheet
//230400 is 3
//115200 is 7	(for 20Mhz xtal, this is about 157Kbaud)
//460800 is 1 
//921600 is 0	(for 20Mhz xtal, this is 1.25Mbaud exact)

// see datasheet page 118
// we are using "normal mode" (not "double speed mode")
// UBRR= (Fosc / (16 * baud) ) - 1
// 20Mhz, 115200: UBRR= (20Mhz / (1843200)) - 1 = 10.85 - 1= 10
// 20Mhz, 1250000: UBRR= (20Mhz / (20M)) -1 = 0, exact
/*
#define	BAUD_SETTING 4

void UARTinit()
{
	
	UBRR0H=(unsigned char)(BAUD_SETTING>>8);
	UBRR0L=(unsigned char)BAUD_SETTING;
	
	// enable transmitter, receiver, and interrupts
	
	UCSR0B = (1<<RXEN0)|(1<<TXEN0);
	
	//set frame format:  8N1
	
	UCSR0C = (3<<UCSZ00);
}


void transmit(unsigned char data)
{

while ( !( UCSR0A & (1<<UDRE0)) )
;
// Put data into buffer, sends the data 
UDR0 = data;
}

*/
// ________________________________________________________________________
//
void set_fps(int fps)
{
	fps=fps/10;
	if (fps<=5)
	fps=5;

	OCR1A=20000/fps; //14400 hz divided by desired hz = target for timer to hit
}


// ________________________________________________________________________
// Wait for frames in an interrupt
//
void wait_for_frames(unsigned int frames)
{
	unsigned int i;
	
//	PORTD |= _BV(PD5);  // turn test pin on
	g_load_new_led_data= 1;
	for (i=0;i<frames;i++)
	{	
		
		isframe=0;
		while(isframe==0){}
	
	}
}


// ________________________________________________________________________
// Frame blending which interpolates over a given # of frames

void makeframe (unsigned char blur)
{

unsigned char i,j,diff;

	for (i=0;i<PWM_CHANNELS;i++)
	{
	tempframe[i]=lastframe[i];
	}

for (i=1;i<=blur;i++)
	{
	for (j=0;j<PWM_CHANNELS;j++)
		{
		if (frame[j]>lastframe[j])
			{
			diff=(frame[j]-lastframe[j])/blur;
			tempframe[j]+=diff;
			newframe[j]=tempframe[j];
			}	
		else if (frame[j]<lastframe[j])
			{
			diff=(lastframe[j]-frame[j])/blur;
			tempframe[j]-=diff;
			newframe[j]=tempframe[j];
			}
		else
			{
			newframe[j]=frame[j];
			}
		}

	wait_for_frames(1);
	}

	for (i=0;i<PWM_CHANNELS;i++)
	{
	lastframe[i]=frame[i];
	}
	
}

//________________________________________________________________________________
// Interrupt which marks when a frame happens


SIGNAL (SIG_OUTPUT_COMPARE1A)
{

	
	isframe=1;

}



// ________________________________________________________________________
//
// Main PWM "slice" ISR, and reloads data when pwm cycle is complete

SIGNAL (SIG_OUTPUT_COMPARE0A)
{
	//check to reload values

	pwmCount++;
	if (pwmCount>=PWM_MAXVAL)
	{
		pwmCount=0;
		if (g_load_new_led_data)
		{
			g_load_new_led_data= 0;
			leds[0]=newframe[0];
			leds[1]=newframe[1];
			leds[2]=newframe[2];
			leds[3]=newframe[3];
			leds[4]=newframe[4];
			leds[5]=newframe[5];
			leds[6]=newframe[6];
			leds[7]=newframe[7];
			leds[8]=newframe[8];
			leds[9]=newframe[9];
			leds[10]=newframe[10];
			leds[11]=newframe[11];
			leds[12]=newframe[12];
			leds[13]=newframe[13];
			leds[14]=newframe[14];
			leds[15]=newframe[15];
			leds[16]=newframe[16];
			leds[17]=newframe[17];
			leds[18]=newframe[18];
			leds[19]=newframe[19];			
			leds[20]=newframe[20];
			leds[21]=newframe[21];
			leds[22]=newframe[22];
			leds[23]=newframe[23];
			leds[24]=newframe[24];
			leds[25]=newframe[25];
			leds[26]=newframe[26];
			leds[27]=newframe[27];	
			leds[28]=newframe[28];
			leds[29]=newframe[29];
			leds[30]=newframe[30];
			leds[31]=newframe[31];
			leds[32]=newframe[32];
			leds[33]=newframe[33];
			leds[34]=newframe[34];
			leds[35]=newframe[35];
		
			}
	}

//bang data into LED drivers -- sorry, we didn't use SPI.

#define OUTPUT_0BIT	{PORTD &= ~(_BV(PD6));	PORTD |= _BV(PD7);	PORTD &= ~(_BV(PD7));	}
#define OUTPUT_1BIT	{PORTD |= _BV(PD6);	PORTD |= _BV(PD7);	PORTD &= ~(_BV(PD7));	}

#define DO_CHANNEL(lednum)	if (pwmCount >= leds[lednum]) OUTPUT_0BIT else OUTPUT_1BIT

//FIRST CLOCK IN CHIP OF 8, THEN TWO CHIPS OF 16, IN REVERSE ORDER

	DO_CHANNEL(35);	
	DO_CHANNEL(34);	
	DO_CHANNEL(33);	
	DO_CHANNEL(32);	
	DO_CHANNEL(26);	
	DO_CHANNEL(27);	
	DO_CHANNEL(28);	
	DO_CHANNEL(29);	 
	DO_CHANNEL(17);
	DO_CHANNEL(23);	
	DO_CHANNEL(22);
	DO_CHANNEL(16);
	DO_CHANNEL(11);	
	DO_CHANNEL(10);	 
	DO_CHANNEL(15);	
	DO_CHANNEL(21);	
	DO_CHANNEL(3);	
	DO_CHANNEL(4);	
	DO_CHANNEL(5);	
	DO_CHANNEL(14);	
	DO_CHANNEL(20);	
	DO_CHANNEL(9);
	OUTPUT_0BIT;
	OUTPUT_0BIT;
	DO_CHANNEL(8);	
	DO_CHANNEL(2);	
	DO_CHANNEL(31);	
	DO_CHANNEL(25);	
	DO_CHANNEL(19);	
	DO_CHANNEL(13);	
	DO_CHANNEL(7);		
	DO_CHANNEL(1);
	DO_CHANNEL(0);
	DO_CHANNEL(6); 
	DO_CHANNEL(12);
	DO_CHANNEL(18);
	DO_CHANNEL(24);
	DO_CHANNEL(30);	
	OUTPUT_0BIT;
	OUTPUT_0BIT;

//latch

	PORTB |= _BV(PB1);
	PORTB &= ~(_BV(PB1));

PORTB &= ~(_BV(PB0));


}

//_________________________________________________________________________________
// Button 1 -- mode

SIGNAL (SIG_INTERRUPT0)
{

interruptcounter2++;
if (interruptcounter2>1)
{
mode_has_changed++;
interruptcounter2=0;
}
	

}

//_________________________________________________________________________________
// Button 2 -- brightness
SIGNAL (SIG_INTERRUPT1)

{
interruptcounter++;
if (interruptcounter>1)
{
	brightbutton++;
	interruptcounter=0;
}

}
//_____________________________________________________________________________
// Deprecated ways of setting LEDs




void setall(unsigned char value)
{
	unsigned char i;
	for (i=0;i<PWM_CHANNELS;i++)
	{
		frame[i]=value;
		if (brightmax<value)
{
frame[i]=brightmax;
}
	}
}

// zero-based





//_____________________________________________________________________________________
// Main routine for playing patterns
// Takes 2 speeds, calculates a delta, plays patterns with random acceleration and brightness
// Also offsets 2 patterns speeds randomly
// Mode changes are implemented here
// Also special case to write Image Node on powerup


void playpatterns(unsigned int beginspeed, unsigned int endspeed, unsigned int frames, unsigned char brightnessa, unsigned char brightnessb, unsigned char fade, unsigned char beginning)
{


unsigned int counter=0;
unsigned int speedbump=0;
unsigned int pattern1=0;
unsigned int pattern2=0;
unsigned int offset=0;
unsigned int offsetcounter=0;
unsigned int counter2=0;
unsigned char brightness1=0;
unsigned char brightness2=0;
unsigned char oneortwo=0;
unsigned char doubletarget=0;

masterspeed=beginspeed;
brightness1=brightnessa;
brightness2=brightnessb;

if (beginspeed>endspeed)
speedbump=(beginspeed-endspeed)/frames;

if (endspeed>beginspeed)
speedbump=(endspeed-beginspeed)/frames;

set_fps(masterspeed);


//pattern1=get_rand(1,52);

pattern1=get_rand(3,60);
pattern2=get_rand(3,60);

oneortwo=get_rand(1,10);
blend_mode=get_rand(1,4);
offset=get_rand(0,4);
if (beginning==1)
{
pattern1=61;
oneortwo=5;
}

if (beginning==2)
{
pattern1=2;
oneortwo=5;
}
//pattern1=1;
//pattern2=2;


for (counter=0;counter<frames;counter++)
	{
	

	setall(0);



	//check offset

	offsetcounter++;
		if (offsetcounter>offset)
		{
			counter2++;
			offsetcounter=0;
		}

//brightness button check	 

	if (brightbutton>0)
	{
	brightstate++;
	brightbutton=0;
	}

	if (brightstate==4)
	{
	brightstate=0;
	}

	if (brightstate==0)
	{
		brightmax=BRIGHTNESS_MAX;
	}
	else if (brightstate==1)
	{
	brightmax=BRIGHTNESS_2;
	}
	else if (brightstate==2)
	{
		brightmax=BRIGHTNESS_3;
	}
	else if (brightstate==3)
	{
		brightmax=BRIGHTNESS_4;
	}
	

//mode check
	
	if (mode_has_changed>0)
	{
	mode_has_changed=0;
	mode++;
	counter=frames;

	if (mode==5)
	mode=1;
	}


	if (pattern1==2)
	play_packed_pattern(counter, brightness1, dis_text_good_inb);
	if (pattern1==3)
	play_packed_pattern(counter, brightness1, dis_lucky_inb);
	if (pattern1==4)
	play_packed_pattern(counter, brightness1, dis_ninjastar_inb);
	if (pattern1==5)
	play_packed_pattern(counter, brightness1, dis_sultan_inb);
	if (pattern1==6)
	play_packed_pattern(counter, brightness1, dis_tejawe1_inb);
	if (pattern1==7)
	play_packed_pattern(counter, brightness1, dis_tejawe2_inb);
	if (pattern1==8)
	play_packed_pattern(counter, brightness1, dis_tejawe3_inb);
	if (pattern1==9)
	play_packed_pattern(counter, brightness1, dis_tejawe4_inb);
	if (pattern1==10)
	play_packed_pattern(counter, brightness1, dis_eye_cuatro_inb);
	if (pattern1==11)
	play_packed_pattern(counter, brightness1, leo_arrow_pan_inb);
	if (pattern1==12)
	play_packed_pattern(counter, brightness1, leo_chasesnake_inb);
	if (pattern1==13)
	play_packed_pattern(counter, brightness1, leo_cornerchase_inb);
	if (pattern1==14)
	play_packed_pattern(counter, brightness1, leo_first_inb);
	if (pattern1==15)
	play_packed_pattern(counter, brightness1, leo_fourchase_inb);
	if (pattern1==16)
	play_packed_pattern(counter, brightness1, leo_infinity_bounce_inb);
	if (pattern1==17)
	play_packed_pattern(counter, brightness1, leo_second_inb);
	if (pattern1==18)
	play_packed_pattern(counter, brightness1, leo_sideways_inb);
	if (pattern1==19)
	play_packed_pattern(counter, brightness1, leo_spokechase_inb);
	if (pattern1==20)
	play_packed_pattern(counter, brightness1, leo_zigzager_inb);
	if (pattern1==21)
	play_packed_pattern(counter, brightness1, bacon1_inb);
	if (pattern1==22)
	play_packed_pattern(counter, brightness1, bacon3_inb);
	if (pattern1==23)
	play_packed_pattern(counter, brightness1, bacon4_inb);
	if (pattern1==24)
	play_packed_pattern(counter, brightness1, c6_inb);
	if (pattern1==25)
	play_packed_pattern(counter, brightness1, chex_inb);
	if (pattern1==26)
	play_packed_pattern(counter, brightness1, chuck1_inb);
	if (pattern1==27)
	play_packed_pattern(counter, brightness1, connie1_inb);
	if (pattern1==28)
	play_packed_pattern(counter, brightness1, connie2_inb);
	if (pattern1==29)
	play_packed_pattern(counter, brightness1, connie3_inb);
	if (pattern1==30)
	play_packed_pattern(counter, brightness1, dl1_inb);
	if (pattern1==31)
	play_packed_pattern(counter, brightness1, dl3_inb);
	if (pattern1==32)
	play_packed_pattern(counter, brightness1, goodpattern_inb);
	if (pattern1==33)
	play_packed_pattern(counter, brightness1, ilike_inb);
	if (pattern1==34)
	play_packed_pattern(counter, brightness1, todd_three_boinger_inb);
	if (pattern1==35)
	play_packed_pattern(counter, brightness1, jason_drops_inb);
	if (pattern1==36)
	play_packed_pattern(counter, brightness1, jason_flyby_inb);
	if (pattern1==37)
	play_packed_pattern(counter, brightness1, jason_pulse_inb);
	if (pattern1==38)
	play_packed_pattern(counter, brightness1, jason_short_hv_inb);
	if (pattern1==39)
	play_packed_pattern(counter, brightness1, jason_spinner_inb);
	if (pattern1==40)
	play_packed_pattern(counter, brightness1, jason_spiral_inb);
	if (pattern1==41)
	play_packed_pattern(counter, brightness1, jensblinkie_inb);
	if (pattern1==42)
	play_packed_pattern(counter, brightness1, krisstina_inb);
	if (pattern1==43)
	play_packed_pattern(counter, brightness1, mark1_inb);
	if (pattern1==44)
	play_packed_pattern(counter, brightness1, mark2_inb);
	if (pattern1==45)
	play_packed_pattern(counter, brightness1, mark_myopic_inb);
	if (pattern1==46)
	play_packed_pattern(counter, brightness1, philseed_inb);
	if (pattern1==47)
	play_packed_pattern(counter, brightness1, ray1_inb);
	if (pattern1==48)
	play_packed_pattern(counter, brightness1, ray3_inb);
	if (pattern1==49)
	play_packed_pattern(counter, brightness1, ray6_inb);
	if (pattern1==50)
	play_packed_pattern(counter, brightness1, ruben3_inb);
	if (pattern1==51)
	play_packed_pattern(counter, brightness1, ruben5_inb);
	if (pattern1==52)
	play_packed_pattern(counter, brightness1, ruben8_inb);
	if (pattern1==53)
	play_packed_pattern(counter, brightness1, spinnerz_inb);
	if (pattern1==54)
	play_packed_pattern(counter, brightness1, spirally_inb);
	if (pattern1==55)
	play_packed_pattern(counter, brightness1, staffymix_inb);
	if (pattern1==56)
	play_packed_pattern(counter, brightness1, stoppy_inb);
	if (pattern1==57)
	play_packed_pattern(counter, brightness1, todd_crawley_inb);
	if (pattern1==58)
	play_packed_pattern(counter, brightness1, todd_followers_inb);
	if (pattern1==59)
	play_packed_pattern(counter, brightness1, todd_ping_inb);
	if (pattern1==60)
	play_packed_pattern(counter, brightness1, todd_swingblink_inb);
	if (pattern1==61)
	play_packed_pattern(counter, brightness1, imagenode_inb);







	offsetcounter++;
	if (offsetcounter>offset)
	{
		counter2++;
		offsetcounter=0;
	}

if (mode==3)
doubletarget=4;
else
doubletarget=2;


if (oneortwo<doubletarget){
	if (pattern2==2)
	play_packed_pattern(counter2, brightness2, dis_text_good_inb);
	if (pattern2==3)
	play_packed_pattern(counter2, brightness2, dis_ninjastar_inb);
	if (pattern2==4)
	play_packed_pattern(counter2, brightness2, dis_sultan_inb);
	if (pattern2==5)
	play_packed_pattern(counter2, brightness2, dis_tejawe1_inb);
	if (pattern2==6)
	play_packed_pattern(counter2, brightness2, dis_tejawe2_inb);
	if (pattern2==7)
	play_packed_pattern(counter2, brightness2, dis_tejawe3_inb);
	if (pattern2==8)
	play_packed_pattern(counter2, brightness2, dis_tejawe4_inb);
	if (pattern2==9)
	play_packed_pattern(counter2, brightness2, dis_eye_cuatro_inb);
	if (pattern2==10)
	play_packed_pattern(counter2, brightness2, leo_arrow_pan_inb);
	if (pattern2==11)
	play_packed_pattern(counter2, brightness2, leo_chasesnake_inb);
	if (pattern2==12)
	play_packed_pattern(counter2, brightness2, leo_cornerchase_inb);
	if (pattern2==13)
	play_packed_pattern(counter2, brightness2, leo_first_inb);
	if (pattern2==14)
	play_packed_pattern(counter2, brightness2, leo_fourchase_inb);
	if (pattern2==15)
	play_packed_pattern(counter2, brightness2, leo_infinity_bounce_inb);
	if (pattern2==16)
	play_packed_pattern(counter2, brightness2, leo_second_inb);
	if (pattern2==17)
	play_packed_pattern(counter2, brightness2, dis_lucky_inb);
	if (pattern2==18)
	play_packed_pattern(counter2, brightness2, leo_sideways_inb);
	if (pattern2==19)
	play_packed_pattern(counter2, brightness2, leo_spokechase_inb);
	if (pattern2==20)
	play_packed_pattern(counter2, brightness2, leo_zigzager_inb);
	if (pattern2==21)
	play_packed_pattern(counter2, brightness2, bacon1_inb);
	if (pattern2==22)
	play_packed_pattern(counter2, brightness2, bacon3_inb);
	if (pattern2==23)
	play_packed_pattern(counter2, brightness2, bacon4_inb);
	if (pattern2==24)
	play_packed_pattern(counter2, brightness2, c6_inb);
	if (pattern2==25)
	play_packed_pattern(counter2, brightness2, chex_inb);
	if (pattern2==26)
	play_packed_pattern(counter2, brightness2, chuck1_inb);
	if (pattern2==27)
	play_packed_pattern(counter2, brightness2, connie1_inb);
	if (pattern2==28)
	play_packed_pattern(counter2, brightness2, connie2_inb);
	if (pattern2==29)
	play_packed_pattern(counter2, brightness2, connie3_inb);
	if (pattern2==30)
	play_packed_pattern(counter2, brightness2, dl1_inb);
	if (pattern2==31)
	play_packed_pattern(counter2, brightness2, dl3_inb);
	if (pattern2==32)
	play_packed_pattern(counter2, brightness2, goodpattern_inb);
	if (pattern2==33)
	play_packed_pattern(counter2, brightness2, ilike_inb);
	if (pattern2==34)
	play_packed_pattern(counter2, brightness2, todd_three_boinger_inb);
	if (pattern2==35)
	play_packed_pattern(counter2, brightness2, jason_drops_inb);
	if (pattern2==36)
	play_packed_pattern(counter2, brightness2, jason_flyby_inb);
	if (pattern2==37)
	play_packed_pattern(counter2, brightness2, jason_pulse_inb);
	if (pattern2==38)
	play_packed_pattern(counter2, brightness2, jason_short_hv_inb);
	if (pattern2==39)
	play_packed_pattern(counter2, brightness2, jason_spinner_inb);
	if (pattern2==40)
	play_packed_pattern(counter2, brightness2, jason_spiral_inb);
	if (pattern2==41)
	play_packed_pattern(counter2, brightness2, jensblinkie_inb);
	if (pattern2==42)
	play_packed_pattern(counter2, brightness2, krisstina_inb);
	if (pattern2==43)
	play_packed_pattern(counter2, brightness2, mark1_inb);
	if (pattern2==44)
	play_packed_pattern(counter2, brightness2, mark2_inb);
	if (pattern2==45)
	play_packed_pattern(counter2, brightness2, mark_myopic_inb);
	if (pattern2==46)
	play_packed_pattern(counter2, brightness2, philseed_inb);
	if (pattern2==47)
	play_packed_pattern(counter2, brightness2, ray1_inb);
	if (pattern2==48)
	play_packed_pattern(counter2, brightness2, ray3_inb);
	if (pattern2==49)
	play_packed_pattern(counter2, brightness2, ray6_inb);
	if (pattern2==50)
	play_packed_pattern(counter2, brightness2, ruben3_inb);
	if (pattern2==51)
	play_packed_pattern(counter2, brightness2, ruben5_inb);
	if (pattern2==52)
	play_packed_pattern(counter2, brightness2, ruben8_inb);
	if (pattern2==53)
	play_packed_pattern(counter2, brightness2, spinnerz_inb);
	if (pattern2==54)
	play_packed_pattern(counter2, brightness2, spirally_inb);
	if (pattern2==55)
	play_packed_pattern(counter2, brightness2, staffymix_inb);
	if (pattern2==56)
	play_packed_pattern(counter2, brightness2, stoppy_inb);
	if (pattern2==57)
	play_packed_pattern(counter2, brightness2, todd_crawley_inb);
	if (pattern2==58)
	play_packed_pattern(counter2, brightness2, todd_followers_inb);
	if (pattern2==59)
	play_packed_pattern(counter2, brightness2, todd_ping_inb);
	if (pattern2==60)
	play_packed_pattern(counter2, brightness2, todd_swingblink_inb);

		
		
		}
//}
	
	if (beginspeed>endspeed)
	masterspeed-=speedbump;
	else if (endspeed>beginspeed)
	masterspeed+=speedbump;
	if (mode==2)
	set_fps(600);
	else if (mode==3)
	set_fps(500);
	else if (mode==4)
	set_fps(masterspeed);
	else
	set_fps(masterspeed);

		//make frame
	if (mode==2)
	makeframe(13);
	else if (mode==3)
	makeframe(1);
	else if (mode==4)
	{
	blend_mode=4;  
	play_packed_pattern(counter, 255, allon_inb);
	makeframe(1);
	}
	else
	makeframe(fade);
	}
	
}





// ________________________________________________________________________
//

int main ()
{

	DDRB=0b11111111;  //B2 and B3 are inputs
	DDRD=0b11110010; //RXD is input, all others are output.
	
	PORTD=0b00001100;  //pullup resistors on D2 and D3

	init_timers();
//	UARTinit();
	sei();

	unsigned char  accel, fade, first_pattern;
	unsigned int beginspeed, endspeed, frames;

	brightmax =255;

	set_fps(masterspeed);	// note: inaccurate with 20mhz xtal


//Random seed code by Jesse Lackey, master of disaster

	      { 
           unsigned int *ptr = 0; 
           int sum= 0; 
           int loop; 
           for (loop=0; loop<32+64+512; loop++)     // 32 regs, 64 i/o mapped, 512 ram (for 861) 
           { 
                sum= sum + *ptr++; 
           } 
           srand(sum); 
      } 

	makeframe(1);
	//play Image Node

//(unsigned int beginspeed, unsigned int endspeed, unsigned int frames, unsigned char brightnessa, unsigned char brightnessb, unsigned char fade, unsigned char beginning)

	first_pattern=get_rand(1,10);

	if (first_pattern<6)
	playpatterns(1000, 1500, 109, 255, 255, 5, 1);
	else
	playpatterns(100, 150, 88, 255, 255, 1, 2);

	// main forever loop
	while(1)
	{
//	for (i=0;i<36;i++)
//	{
//		setall(0);
//		setone(i,255);
//		makeframe(10);
//	}
	
	
	beginspeed=get_rand(200,700);
	fade=get_rand(1,5);

	frames=(get_rand(1,100)+beginspeed)/fade;
	accel=get_rand(1,6);
	if (accel<4)
	{
		if (beginspeed<400)
			{
			endspeed=800;
			fade=1;
			frames+=100;
			}
		else
			{
			endspeed=100;
			fade=1;
			frames+=100;
			}
		}
	else 
	endspeed=get_rand(300,700);
	




	playpatterns(beginspeed, endspeed, frames, get_rand(128,255), get_rand(1,128), fade, 0);

 	}

	return 0;
}


