1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-27 01:51:35 +00:00
8bitworkshop/presets/astrocade/music.c

98 lines
17 KiB
C

#include <stdlib.h>
#include <string.h>
//#resource "astrocade.inc"
#include "aclib.h"
//#link "aclib.s"
//#link "hdr_autostart.s"
#include "acbios.h"
//#link "acbios.s"
byte soundregs[8];
////////
//
// MUSIC ROUTINES
//
// Namespace(bias=0, freq=6480.0, length=64, maxbits=12, upper=49)
// 430.0 38.11501356252539 49
const int note_table[64] = {
255,241,228,215,203,191,181,170,161,152,143,135,128,121,114,107,101,96,90,85,80,76,72,68,64,60,57,54,51,48,45,43,40,38,36,34,32,30,28,27,25,24,23,21,20,19,18,17,16,15,14,13,13,12,11,11,10,9,9,8,8,8,7,7,};
struct {
byte volume;
} voice[3];
byte music_index = 0;
byte cur_duration = 0;
const byte music1[] = {
0x1e,0x12,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x27,0x86,0x2f,0x86,0x33,0x1e,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x2a,0x36,0x25,0x86,0x2e,0x86,0x31,0x28,0x22,0x86,0x36,0x2a,0x86,0x1e,0x22,0x28,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x27,0x86,0x2f,0x86,0x33,0x1e,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x36,0x2a,0x25,0x86,0x2e,0x86,0x31,0x28,0x22,0x86,0x36,0x2a,0x86,0x28,0x22,0x1e,0x8c,0x12,0x1e,0x86,0x36,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x37,0x2b,0x86,0x1e,0x12,0x86,0x36,0x2a,0x86,0x1e,0x12,0x86,0x2a,0x36,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x37,0x2b,0x86,0x1e,0x12,0x86,0x36,0x2a,0x92,0x0b,0x86,0x17,0x86,0x1a,0x86,0x23,0x86,0x17,0x86,0x23,0x86,0x26,0x86,0x2f,0x86,0x23,0x86,0x2f,0x86,0x32,0x86,0x3b,0x86,0x2f,0x86,0x3b,0x86,0x3e,0x86,0x86,0x3b,0x29,0x2c,0x8c,0x3b,0x32,0x2f,0x8c,0x3b,0x32,0x2f,0x8c,0x3b,0x29,0x2c,0x86,0x3b,0x86,0x33,0x2f,0x2a,0x86,0x86,0x33,0x2f,0x2a,0x86,0x3f,0x86,0x2a,0x2f,0x33,0x86,0x3b,0x86,0x33,0x2f,0x2a,0x86,0x37,0x3b,0x86,0x32,0x2f,0x2b,0x86,0x3d,0x86,0x3e,0x37,0x2b,0x86,0x3b,0x86,0x3d,0x33,0x2f,0x86,0x3f,0x36,0x86,0x33,0x2f,0x2a,0x86,0x3b,0x86,0x3f,0x36,0x33,0x86,0x3b,0x86,0x3d,0x36,0x2a,0x8c,0x3b,0x36,0x33,0x92,0x3b,0x2f,0x86,0x26,0x23,0x20,0x8c,0x3b,0x2f,0x1d,0x8c,0x3b,0x2f,0x26,0x8c,0x3b,0x2f,0x26,0x86,0x3b,0x2f,0x86,0x1e,0x23,0x27,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x38,0x2f,0x86,0x1e,0x23,0x27,0x86,0x2f,0x2b,0x86,0x26,0x23,0x1f,0x86,0x31,0x86,0x32,0x2b,0x26,0x86,0x2f,0x86,0x31,0x27,0x23,0x86,0x33,0x2a,0x86,0x1e,0x23,0x27,0x86,0x2f,0x86,0x2a,0x33,0x27,0x86,0x2f,0x86,0x31,0x2a,0x28,0x8c,0x2f,0x2a,0x27,0x8c,0x12,0x1e,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x27,0x86,0x2f,0x86,0x33,0x27,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x36,0x2a,0x19,0x86,0x2e,0x86,0x31,0x28,0x22,0x86,0x36,0x2a,0x86,0x28,0x22,0x1e,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x1e,0x86,0x2f,0x86,0x33,0x27,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x36,0x2a,0x25,0x86,0x2e,0x86,0x31,0x1e,0x22,0x86,0x36,0x2a,0x86,0x28,0x22,0x1e,0x8c,0x1e,0x12,0x86,0x36,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x2b,0x37,0x86,0x12,0x1e,0x86,0x36,0x2a,0x86,0x1e,0x12,0x86,0x36,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x37,0x2b,0x86,0x1e,0x12,0x86,0x36,0x2a,0x92,0x0b,0x86,0x17,0x86,0x1a,0x86,0x23,0x86,0x17,0x86,0x23,0x86,0x26,0x86,0x2f,0x86,0x23,0x86,0x2f,0x86,0x32,0x86,0x3b,0x86,0x2f,0x86,0x3b,0x86,0x3e,0x86,0x86,0x3b,0x32,0x2f,0x8c,0x3b,0x29,0x2c,0x8c,0x3b,0x32,0x2f,0x8c,0x3b,0x32,0x2f,0x86,0x3b,0x86,0x2a,0x2f,0x33,0x86,0x86,0x33,0x2f,0x2a,0x86,0x3f,0x86,0x33,0x2f,0x2a,0x86,0x3b,0x86,0x2a,0x2f,0x33,0x86,0x3b,0x37,0x86,0x32,0x2f,0x2b,0x86,0x3d,0x86,0x3e,0x37,0x32,0x86,0x3b,0x86,0x3d,0x33,0x2f,0x86,0x3f,0x36,0x86,0x2a,0x2f,0x33,0x86,0x3b,0x86,0x3f,0x36,0x33,0x86,0x3b,0x86,0x3d,0x36,0x34,0x8c,0x36,0x3b,0x33,0x92,0x3b,0x2f,0x86,0x1d,0x20,0x23,0x8c,0x3b,0x2f,0x26,0x8c,0x3b,0x2f,0x1d,0x8c,0x2f,0x3b,0x26,0x86,0x3b,0x2f,0x86,0x27,0x23,0x1e,0x86,0x36,0x86,0x38,0x2f,0x1e,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x2f,0x38,0x86,0x27,0x23,0x1e,0x86,0x2f,0x2b,0x86,0x26,0x23,0x1f,0x86,0x31,0x86,0x32,0x2b,0x1f,0x86,0x2f,0x86,0x31,0x27,0x23,0x86,0x2a,0x33,0x86,0x27,0x23,0x1e,0x86,0x2f,0x86,0x33,0x2a,0x1e,0x86,0x2f,0x86,0x31,0x2a,0x28,0x8c,0x2f,0x2a,0x27,0x8c,0x24,0x18,0x8c,0x25,0x19,0x86,0x3a,0x86,0x36,0x1e,0x22,0x86,0x3a,0x86,0x3d,0x1e,0x12,0x86,0x35,0x86,0x28,0x22,0x1e,0x86,0x3a,0x86,0x34,0x25,0x19,0x86,0x3a,0x86,0x3d,0x1e,0x22,0x86,0x33,0x3f,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x22,0x86,0x36,0x86,0x23,0x17,0x86,0x33,0x86,0x3b,0x2f,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x38,0x2c,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x3b,0x2f,0x23,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x38,0x2c,0x86,0x17,0x23,0x86,0x33,0x86,0x38,0x2c,0x24,0x8c,0x25,0x19,0x86,0x36,0x86,0x3a,0x2e,0x28,0x86,0x31,0x86,0x34,0x1e,0x12,0x86,0x38,0x2c,0x86,0x1e,0x22,0x28,0x86,0x36,0x86,0x3a,0x2e,0x25,0x86,0x31,0x86,0x34,0x28,0x22,0x86,0x38,0x2c,0x86,0x25,0x19,0x86,0x34,0x86,0x2c,0x38,0x26,0x8c,0x1b,0x27,0x86,0x33,0x86,0x3b,0x2f,0x27,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x38,0x2c,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x2f,0x3b,0x17,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x38,0x2c,0x86,0x23,0x17,0x86,0x33,0x86,0x38,0x2c,0x24,0x8c,0x25,0x19,0x86,0x3a,0x86,0x36,0x1e,0x22,0x86,0x3a,0x86,0x3d,0x1e,0x12,0x86,0x35,0x86,0x28,0x22,0x1e,0x86,0x3a,0x86,0x34,0x25,0x19,0x86,0x3a,0x86,0x3d,0x1e,0x22,0x86,0x3f,0x33,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x22,0x86,0x36,0x86,0x23,0x17,0x86,0x33,0x86,0x2f,0x3b,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x38,0x2c,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x3b,0x2f,0x23,0x8c,0x3b,0x2f,0x23,0x8c,0x2e,0x3a,0x22,0x8c,0x39,0x2d,0x15,0x8c,0x20,0x14,0x86,0x2c,0x86,0x30,0x20,0x14,0x86,0x33,0x86,0x38,0x24,0x18,0x86,0x33,0x86,0x30,0x24,0x18,0x86,0x2c,0x86,0x19,0x25,0x86,0x2c,0x86,0x31,0x28,0x25,0x86,0x34,0x86,0x38,0x2c,0x28,0x8c,0x34,0x31,0x2c,0x8c,0x29,0x2c,0x2f,0x8c,0x25,0x20,0x19,0x86,0x33,0x2f,0x2c,0x86,0x1e,0x12,0x86,0x31,0x28,0x86,0x22,0x16,0x86,0x2a,0x86,0x27,0x2f,0x23,0x8c,0x36,0x2a,0x1e,0x8c,0x36,0x2a,0x27,0x8c,0x36,0x2a,0x24,0x8c,0x25,0x19,0x86,0x3a,0x86,0x36,0x1e,0x22,0x86,0x3a,0x86,0x3d,0x1e,0x12,0x86,0x35,0x86,0x28,0x22,0x1e,0x86,0x3a,0x86,0x34,0x25,0x19,0x86,0x3a,0x86,0x3d,0x1e,0x22,0x86,0x3f,0x33,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x22,0x86,0x36,0x86,0x23,0x17,0x86,0x33,0x86,0x3b,0x2f,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x2c,0x38,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x3b,0x2f,0x23,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x38,0x2c,0x86,0x17,0x23,0x86,0x33,0x86,0x38,0x2c,0x24,0x8c,0x25,0x19,0x86,0x36,0x86,0x3a,0x2e,0x28,0x86,0x31,0x86,0x34,0x1e,0x12,0x86,0x38,0x2c,0x86,0x1e,0x22,0x28,0x86,0x36,0x86,0x2e,0x3a,0x25,0x86,0x31,0x86,0x34,0x28,0x22,0x86,0x38,0x2c,0x86,0x25,0x19,0x86,0x34,0x86,0x38,0x2c,0x26,0x8c,0x1b,0x27,0x86,0x33,0x86,0x3b,0x2f,0x27,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x38,0x2c,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x3b,0x2f,0x17,0x86,0x33,0x86,0x36,0x27,0x23,0x86,0x38,0x2c,0x86,0x23,0x17,0x86,0x33,0x86,0x38,0x2c,0x24,0x8c,0x25,0x19,0x86,0x3a,0x86,0x36,0x1e,0x22,0x86,0x3a,0x86,0x3d,0x1e,0x12,0x86,0x35,0x86,0x28,0x22,0x1e,0x86,0x3a,0x86,0x34,0x25,0x19,0x86,0x3a,0x86,0x3d,0x1e,0x22,0x86,0x33,0x3f,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x22,0x86,0x36,0x86,0x23,0x17,0x86,0x33,0x86,0x3b,0x2f,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x38,0x2c,0x86,0x27,0x23,0x1e,0x86,0x33,0x86,0x3b,0x2f,0x23,0x8c,0x3b,0x2f,0x23,0x8c,0x3a,0x2e,0x22,0x8c,0x2d,0x39,0x15,0x8c,0x20,0x14,0x86,0x2c,0x86,0x30,0x20,0x14,0x86,0x33,0x86,0x38,0x24,0x18,0x86,0x33,0x86,0x30,0x24,0x18,0x86,0x2c,0x86,0x19,0x25,0x86,0x2c,0x86,0x31,0x28,0x25,0x86,0x34,0x86,0x38,0x2c,0x28,0x8c,0x34,0x31,0x2c,0x8c,0x33,0x2f,0x2c,0x8c,0x25,0x20,0x19,0x86,0x29,0x2c,0x2f,0x86,0x1e,0x12,0x86,0x31,0x28,0x86,0x22,0x16,0x86,0x2a,0x86,0x23,0x17,0x86,0x2f,0x86,0x33,0x23,0x27,0x86,0x36,0x86,0x2f,0x3b,0x2a,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x1e,0x86,0x2f,0x86,0x33,0x27,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x2a,0x36,0x25,0x86,0x2e,0x86,0x31,0x1e,0x22,0x86,0x36,0x2a,0x86,0x28,0x22,0x1e,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x2f,0x86,0x36,0x2a,0x1e,0x86,0x2f,0x86,0x33,0x27,0x23,0x86,0x36,0x2a,0x86,0x24,0x18,0x86,0x2e,0x86,0x36,0x2a,0x25,0x86,0x2e,0x86,0x31,0x1e,0x22,0x86,0x36,0x2a,0x86,0x28,0x22,0x1e,0x8c,0x1e,0x12,0x86,0x36,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x37,0x2b,0x86,0x1e,0x12,0x86,0x36,0x2a,0x86,0x12,0x1e,0x86,0x36,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x86,0x32,0x86,0x37,0x2b,0x86,0x1e,0x12,0x86,0x36,0x2a,0x92,0x0b,0x86,0x17,0x86,0x1a,0x86,0x23,0x86,0x17,0x86,0x23,0x86,0x26,0x86,0x2f,0x86,0x23,0x86,0x2f,0x86,0x32,0x86,0x3b,0x86,0x2f,0x86,0x3b,0x86,0x3e,0x86,0x86,0x3b,0x32,0x2f,0x8c,0x3b,0x29,0x2c,0x8c,0x3b,0x32,0x2f,0x8c,0x3b,0x32,0x2f,0x86,0x3b,0x86,0x2a,0x2f,0x33,0x86,0x86,0x33,0x2f,0x2a,0x86,0x3f,0x86,0x33,0x2f,0x2a,0x86,0x3b,0x86,0x33,0x2f,0x2a,0x86,0x3b,0x37,0x86,0x2b,0x2f,0x32,0x86,0x3d,0x86,0x3e,0x37,0x32,0x86,0x3b,0x86,0x3d,0x33,0x2f,0x86,0x3f,0x36,0x86,0x2a,0x2f,0x33,0x86,0x3b,0x86,0x36,0x3f,0x33,0x86,0x3b,0x86,0x3d,0x36,0x34,0x8c,0x3b,0x36,0x33,0x92,0x3b,0x2f,0x86,0x1d,0x20,0x23,0x8c,0x2f,0x3b,0x26,0x8c,0x3b,0x2f,0x26,0x8c,0x3b,0x2f,0x1d,0x86,0x3b,0x2f,0x86,0x27,0x23,0x1e,0x86,0x36,0x86,0x2f,0x38,0x27,0x86,0x33,0x86,0x36,0x1e,0x23,0x86,0x38,0x2f,0x86,0x27,0x23,0x1e,0x86,0x2f,0x2b,0x86,0x26,0x23,0x1f,0x86,0x31,0x86,0x2b,0x32,0x1f,0x86,0x2f,0x86,0x31,0x27,0x23,0x86,0x33,0x2a,0x86,0x27,0x23,0x1e,0x86,0x2f,0x86,0x33,0x2a,0x27,0x86,0x2f,0x86,0x2a,0x31,0x1e,0x8c,0x2f,0x2a,0x27,0x8c,0x3b,0x2f,0x8c,0x3b,0x36,0x33,0x8c,0x2d,0x27,0x23,0x86,0x31,0x33,0x36,0x86,0x15,0x21,0x86,0x36,0x33,0x86,0x31,0x2d,0x27,0x8c,0x2f,0x33,0x36,0x8c,0x2d,0x27,0x23,0x86,0x3b,0x36,0x33,0x86,0x12,0x1e,0x86,0x36,0x33,0x86,0x31,0x1b,0x0f,0x86,0x36,0x33,0x86,0x2f,0x1c,0x10,0x86,0x34,0x86,0x31,0x2c,0x28,0x86,0x34,0x86,0x38,0x23,0x17,0x86,0x2f,0x86,0x34,0x23,0x28,0x86,0x38,0x86,0x31,0x20,0x14,0x86,0x34,0x86,0x38,0x2c,0x28,0x86,0x2f,0x86,0x1c,0x10,0x86,0x38,0x86,0x31,0x11,0x1d,0x86,0x38,0x86,0x3b,0x36,0x33,0x8c,0x2d,0x27,0x23,0x86,0x3b,0x36,0x33,0x86,0x21,0x15,0x86,0x36,0x33,0x86,0x31,0x23,0x27,0x8c,0x3b,0x36,0x33,0x8c,0x2d,0x27,0x23,0x86,0x31,0x33,0x36,0x86,0x1e,0x12,0x86,0x36,0x33,0x86,0x31,0x1b,0x0f,0x86,0x33,0x36,0x86,0x2f,0x10,0x1c,0x86,0x34,0x86,0x31,0x2c,0x28,0x86,0x34,0x86,0x38,0x23,0x17,0x86,0x2f,0x86,0x34,0x2c,0x28,0x86,0x38,0x86,0x31,0x14,0x20,0x86,0x34,0x86,0x38,0x2c,0x28,0x86,0x2f,0x86,0x1c,0x10,0x86,0x38,0x86,0x30,0x1b,0x0f,0x86,0x38,0x36,0x86,0x31,0x35,0x38,0x8c,0x25,0x29,0x2f,0x86,0x3d,0x38,0x35,0x86,0x1d,0x11,0x86,0x35,0x38,0x86,0x33,0x2f,0x29,0x8c,0x3d,0x38,0x35,0x8c,0x25,0x29,0x2f,0x86,0x3d,0x38,0x35,0x86,0x25,0x19,0x86,0x38,0x35,0x86,0x33,0x2f,0x29,0x86,0x38,0x35,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x25,0x86,0x36,0x86,0x39,0x21,0x15,0x86,0x3f,0x33,0x86,0x2d,0x2a,0x25,0x86,0x36,0x86,0x3d,0x31,0x1e,0x86,0x36,0x86,0x39,0x25,0x2a,0x86,0x3f,0x33,0x86,0x21,0x15,0x86,0x36,0x86,0x3d,0x31,0x2d,0x8c,0x37,0x34,0x22,0x86,0x25,0x86,0x37,0x34,0x86,0x28,0x86,0x33,0x37,0x3f,0x86,0x28,0x86,0x3d,0x37,0x31,0x86,0x22,0x86,0x38,0x2f,0x23,0x86,0x34,0x86,0x36,0x2c,0x28,0x86,0x31,0x39,0x86,0x19,0x86,0x31,0x86,0x38,0x2f,0x29,0x8c,0x38,0x2e,0x1e,0x86,0x34,0x86,0x36,0x28,0x25,0x86,0x2d,0x38,0x86,0x27,0x23,0x86,0x33,0x86,0x36,0x2d,0x27,0x86,0x34,0x2c,0x86,0x1c,0x28,0x86,0x2f,0x3b,0x86,0x2c,0x28,0x23,0x86,0x38,0x86,0x3b,0x2f,0x2c,0x86,0x38,0x86,0x3b,0x2f,0x1d,0x86,0x38,0x86,0x2f,0x33,0x36,0x8c,0x23,0x27,0x2d,0x86,0x3b,0x36,0x33,0x86,0x21,0x15,0x86,0x36,0x33,0x86,0x31,0x2d,0x27,0x8c,0x3b,0x36,0x33,0x8c,0x23,0x27,0x2d,0x86,0x3b,0x36,0x33,0x86,0x1e,0x12,0x86,0x36,0x33,0x86,0x31,0x1b,0x0f,0x86,0x36,0x33,0x86,0x2f,0x1c,0x10,0x86,0x34,0x86,0x31,0x2c,0x28,0x86,0x34,0x86,0x38,0x17,0x23,0x86,0x2f,0x86,0x34,0x2c,0x28,0x86,0x38,0x86,0x31,0x20,0x14,0x86,0x34,0x86,0x38,0x2c,0x28,0x86,0x2f,0x86,0x10,0x1c,0x86,0x38,0x86,0x31,0x1d,0x11,0x86,0x38,0x86,0x3b,0x36,0x33,0x8c,0x2d,0x27,0x23,0x86,0x3b,0x36,0x33,0x86,0x21,0x15,0x86,0x36,0x33,0x86,0x31,0x23,0x27,0x8c,0x3b,0x36,0x33,0x8c,0x2d,0x27,0x23,0x86,0x31,0x33,0x36,0x86,0x1e,0x12,0x86,0x36,0x33,0x86,0x31,0x0f,0x1b,0x86,0x33,0x36,0x86,0x2f,0x1c,0x10,0x86,0x34,0x86,0x31,0x2c,0x28,0x86,0x34,0x86,0x38,0x23,0x17,0x86,0x2f,0x86,0x34,0x23,0x28,0x86,0x38,0x86,0x31,0x20,0x14,0x86,0x34,0x86,0x38,0x2c,0x28,0x86,0x2f,0x86,0x1c,0x10,0x86,0x38,0x86,0x30,0x1b,0x0f,0x86,0x38,0x36,0x86,0x31,0x35,0x38,0x8c,0x2f,0x29,0x25,0x86,0x3d,0x38,0x35,0x86,0x1d,0x11,0x86,0x35,0x38,0x86,0x33,0x2f,0x29,0x8c,0x3d,0x38,0x35,0x8c,0x25,0x29,0x2f,0x86,0x3d,0x38,0x35,0x86,0x25,0x19,0x86,0x38,0x35,0x86,0x33,0x2f,0x29,0x86,0x38,0x35,0x86,0x1e,0x12,0x86,0x36,0x86,0x3d,0x31,0x25,0x86,0x36,0x86,0x39,0x21,0x15,0x86,0x3f,0x33,0x86,0x2d,0x2a,0x25,0x86,0x36,0x86,0x3d,0x31,0x1e,0x86,0x36,0x86,0x39,0x25,0x2a,0x86,0x33,0x3f,0x86,0x21,0x15,0x86,0x36,0x86,0x3d,0x31,0x2d,0x8c,0x37,0x34,0x22,0x86,0x25,0x86,0x34,0x37,0x86,0x28,0x86,0x3f,0x37,0x33,0x86,0x28,0x86,0x3d,0x37,0x31,0x86,0x22,0x86,0x38,0x2f,0x23,0x86,0x34,0x86,0x36,0x2c,0x28,0x86,0x39,0x31,0x86,0x19,0x86,0x31,0x86,0x38,0x2f,0x29,0x8c,0x38,0x2e,0x1e,0x86,0x34,0x86,0x36,0x28,0x25,0x86,0x38,0x2d,0x86,0x27,0x23,0x86,0x33,0x86,0x36,0x2d,0x27,0x86,0x34,0x2c,0x86,0x1c,0x28,0x86,0x34,0x86,0x38,0x23,0x17,0x86,0x3b,0x86,0x34,0x1c,0x10,0x8c,0x27,0x1b,0x8c,0x3b,0x2f,0x28,0x8c,0x38,0x2f,0x23,0x8c,0x2f,0x3b,0x2c,0x8c,0x38,0x2f,0x27,0x8c,0x3b,0x38,0x28,0x8c,0x3d,0x38,0x23,0x86,0x3f,0x38,0x86,0x25,0x19,0x86,0x3d,0x86,0x3b,0x26,0x1a,0x86,0x38,0x86,0x36,0x27,0x1b,0x86,0x38,0x86,0x2a,0x27,0x23,0x86,0x33,0x2f,0x86,0x23,0x27,0x2a,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x38,0x2f,0x86,0x24,0x18,0x86,0x33,0x86,0x36,0x2e,0x25,0x8c,0x38,0x28,0x22,0x86,0x31,0x2e,0x86,0x1e,0x12,0x8c,0x18,0x24,0x8c,0x25,0x19,0x86,0x34,0x86,0x38,0x2e,0x28,0x86,0x31,0x86,0x34,0x1e,0x12,0x86,0x2e,0x38,0x86,0x22,0x16,0x86,0x33,0x2f,0x86,0x17,0x23,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x2f,0x38,0x86,0x27,0x23,0x1e,0x86,0x33,0x2f,0x86,0x17,0x23,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x25,0x19,0x86,0x2f,0x38,0x86,0x27,0x1b,0x86,0x36,0x86,0x3b,0x2f,0x28,0x8c,0x38,0x2f,0x23,0x8c,0x3b,0x2f,0x2c,0x8c,0x38,0x2f,0x27,0x8c,0x38,0x3b,0x28,0x8c,0x3d,0x38,0x23,0x86,0x3f,0x38,0x86,0x25,0x19,0x86,0x3d,0x86,0x3b,0x26,0x1a,0x86,0x38,0x86,0x3b,0x27,0x1b,0x8c,0x38,0x2a,0x27,0x8c,0x36,0x23,0x27,0x86,0x3b,0x86,0x1e,0x12,0x86,0x33,0x2f,0x86,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x12,0x1e,0x86,0x38,0x2f,0x86,0x27,0x23,0x1e,0x86,0x2f,0x2c,0x86,0x1c,0x10,0x86,0x31,0x86,0x2c,0x2f,0x1c,0x8c,0x2f,0x2b,0x19,0x8c,0x31,0x2b,0x11,0x86,0x2f,0x2a,0x86,0x1e,0x12,0x86,0x31,0x86,0x2a,0x33,0x27,0x86,0x2f,0x86,0x31,0x1e,0x12,0x86,0x33,0x2a,0x86,0x1f,0x13,0x86,0x2f,0x29,0x86,0x14,0x20,0x86,0x31,0x86,0x29,0x33,0x20,0x86,0x2f,0x86,0x22,0x16,0x86,0x31,0x28,0x86,0x22,0x16,0x86,0x2a,0x86,0x2f,0x27,0x23,0x8c,0x36,0x2a,0x1e,0x8c,0x2a,0x36,0x25,0x8c,0x36,0x2a,0x27,0x8c,0x3b,0x2f,0x28,0x8c,0x38,0x2f,0x2c,0x8c,0x3b,0x2f,0x23,0x8c,0x2f,0x38,0x27,0x8c,0x3b,0x38,0x28,0x8c,0x3d,0x38,0x2c,0x86,0x3f,0x38,0x86,0x19,0x25,0x86,0x3d,0x86,0x3b,0x26,0x1a,0x86,0x38,0x86,0x36,0x27,0x1b,0x86,0x38,0x86,0x2a,0x27,0x23,0x86,0x33,0x2f,0x86,0x23,0x27,0x2a,0x8c,0x1e,0x12,0x8c,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x38,0x2f,0x86,0x18,0x24,0x86,0x33,0x86,0x36,0x2e,0x25,0x8c,0x38,0x28,0x22,0x86,0x31,0x2e,0x86,0x1e,0x12,0x8c,0x24,0x18,0x8c,0x19,0x25,0x86,0x34,0x86,0x38,0x2e,0x28,0x86,0x31,0x86,0x34,0x1e,0x12,0x86,0x38,0x2e,0x86,0x22,0x16,0x86,0x33,0x2f,0x86,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x1e,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x38,0x2f,0x86,0x27,0x23,0x1e,0x86,0x33,0x2f,0x86,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x1e,0x86,0x33,0x86,0x36,0x25,0x19,0x86,0x38,0x2f,0x86,0x27,0x1b,0x86,0x36,0x86,0x3b,0x2f,0x28,0x8c,0x2f,0x38,0x2c,0x8c,0x3b,0x2f,0x23,0x8c,0x38,0x2f,0x27,0x8c,0x3b,0x38,0x28,0x8c,0x3d,0x38,0x2c,0x86,0x38,0x3f,0x86,0x25,0x19,0x86,0x3d,0x86,0x3b,0x1a,0x26,0x86,0x38,0x86,0x3b,0x27,0x1b,0x8c,0x38,0x2a,0x27,0x8c,0x36,0x2a,0x27,0x86,0x3b,0x86,0x12,0x1e,0x86,0x2f,0x33,0x86,0x23,0x17,0x86,0x36,0x86,0x38,0x2f,0x27,0x86,0x33,0x86,0x36,0x1e,0x12,0x86,0x2f,0x38,0x86,0x27,0x23,0x1e,0x86,0x2f,0x2c,0x86,0x10,0x1c,0x86,0x31,0x86,0x2f,0x2c,0x1c,0x8c,0x2f,0x2b,0x19,0x8c,0x2b,0x31,0x1d,0x86,0x2f,0x2a,0x86,0x1e,0x12,0x86,0x31,0x86,0x33,0x2a,0x1e,0x86,0x2f,0x86,0x31,0x1e,0x12,0x86,0x2a,0x33,0x86,0x1f,0x13,0x86,0x2f,0x29,0x86,0x20,0x14,0x86,0x31,0x86,0x33,0x29,0x20,0x86,0x2f,0x86,0x16,0x22,0x86,0x28,0x31,0x86,0x22,0x16,0x86,0x2a,0x86,0x2f,0x27,0x23,0x8c,0x36,0x34,0x2e,0x8c,0x3b,0x36,0x33,0xff
};
static const byte* music_ptr = music1;
inline byte next_music_byte() {
return *music_ptr++;
}
void play_music() {
byte ch;
byte freech = 0;
soundregs[1] = voice[0].volume | (voice[1].volume<<4);
soundregs[2] = voice[2].volume;
for (ch=0; ch<3; ch++) {
if (voice[ch].volume) {
voice[ch].volume--;
} else {
freech = ch;
}
}
if (music_ptr) {
ch = freech;
while (cur_duration == 0) {
byte note = next_music_byte();
if ((note & 0x80) == 0) {
if (note >= 12) note - 12;
soundregs[6-ch] = note_table[note & 63];
voice[ch].volume = 15;
ch = ch ? ch-1 : 2;
} else {
if (note == 0xff)
music_ptr = 0;
cur_duration = note & 63;
}
}
cur_duration--;
set_sound_registers(soundregs);
}
}
void start_music(const byte* music) {
memset(voice, 0, sizeof(voice));
music_ptr = music;
cur_duration == 0;
}
const byte SOUND_INIT[8] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40,
};
void init_sound() {
memcpy(soundregs, SOUND_INIT, 8);
set_sound_registers(soundregs);
}
void main() {
init_sound();
activate_interrupts();
while (1) {
if (!music_ptr) start_music(music1);
play_music();
sleep(2);
}
}