mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-10 08:54:51 +00:00
pt3: work on generating all tone tables
This commit is contained in:
parent
6589803355
commit
08ccc48686
@ -1,7 +1,33 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// 8*12
|
||||
|
||||
/* Table #0 of Pro Tracker 3.3x - 3.4r */
|
||||
static unsigned short PT3NoteTable_PT_33_34r[]={
|
||||
0xC21,0xB73,0xACE,0xA33,0x9A0,0x916,0x893,0x818,0x7A4,0x736,0x6CE,0x66D,
|
||||
0x610,0x5B9,0x567,0x519,0x4D0,0x48B,0x449,0x40C,0x3D2,0x39B,0x367,0x336,
|
||||
0x308,0x2DC,0x2B3,0x28C,0x268,0x245,0x224,0x206,0x1E9,0x1CD,0x1B3,0x19B,
|
||||
0x184,0x16E,0x159,0x146,0x134,0x122,0x112,0x103,0x0F4,0x0E6,0x0D9,0x0CD,
|
||||
0x0C2,0x0B7,0x0AC,0x0A3,0x09A,0x091,0x089,0x081,0x07A,0x073,0x06C,0x066,
|
||||
0x061,0x05B,0x056,0x051,0x04D,0x048,0x044,0x040,0x03D,0x039,0x036,0x033,
|
||||
0x030,0x02D,0x02B,0x028,0x026,0x024,0x022,0x020,0x01E,0x01C,0x01B,0x019,
|
||||
0x018,0x016,0x015,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,0x00C,
|
||||
};
|
||||
|
||||
/* Table #0 of Pro Tracker 3.4x - 3.5x */
|
||||
static unsigned short PT3NoteTable_PT_34_35[]={
|
||||
0xC22,0xB73,0xACF,0xA33,0x9A1,0x917,0x894,0x819,0x7A4,0x737,0x6CF,0x66D,
|
||||
0x611,0x5BA,0x567,0x51A,0x4D0,0x48B,0x44A,0x40C,0x3D2,0x39B,0x367,0x337,
|
||||
0x308,0x2DD,0x2B4,0x28D,0x268,0x246,0x225,0x206,0x1E9,0x1CE,0x1B4,0x19B,
|
||||
0x184,0x16E,0x15A,0x146,0x134,0x123,0x112,0x103,0x0F5,0x0E7,0x0DA,0x0CE,
|
||||
0x0C2,0x0B7,0x0AD,0x0A3,0x09A,0x091,0x089,0x082,0x07A,0x073,0x06D,0x067,
|
||||
0x061,0x05C,0x056,0x052,0x04D,0x049,0x045,0x041,0x03D,0x03A,0x036,0x033,
|
||||
0x031,0x02E,0x02B,0x029,0x027,0x024,0x022,0x020,0x01F,0x01D,0x01B,0x01A,
|
||||
0x018,0x017,0x016,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,0x00C,
|
||||
};
|
||||
|
||||
|
||||
/* Table #1 for all versions */
|
||||
static unsigned short PT3NoteTable_ST[]={
|
||||
0xEF8,0xE10,0xD60,0xC80,0xBD8,0xB28,0xA88,0x9F0,0x960,0x8E0,0x858,0x7E0,
|
||||
0x77C,0x708,0x6B0,0x640,0x5EC,0x594,0x544,0x4F8,0x4B0,0x470,0x42C,0x3FD,
|
||||
@ -13,47 +39,108 @@ static unsigned short PT3NoteTable_ST[]={
|
||||
0x01D,0x01C,0x01A,0x019,0x017,0x016,0x015,0x013,0x012,0x011,0x010,0x00F,
|
||||
};
|
||||
|
||||
/* Table #2 of Pro Tracker 3.4r */
|
||||
static unsigned short PT3NoteTable_ASM_34r[]={
|
||||
0xD3E,0xC80,0xBCC,0xB22,0xA82,0x9EC,0x95C,0x8D6,0x858,0x7E0,0x76E,0x704,
|
||||
0x69F,0x640,0x5E6,0x591,0x541,0x4F6,0x4AE,0x46B,0x42C,0x3F0,0x3B7,0x382,
|
||||
0x34F,0x320,0x2F3,0x2C8,0x2A1,0x27B,0x257,0x236,0x216,0x1F8,0x1DC,0x1C1,
|
||||
0x1A8,0x190,0x179,0x164,0x150,0x13D,0x12C,0x11B,0x10B,0x0FC,0x0EE,0x0E0,
|
||||
0x0D4,0x0C8,0x0BD,0x0B2,0x0A8,0x09F,0x096,0x08D,0x085,0x07E,0x077,0x070,
|
||||
0x06A,0x064,0x05E,0x059,0x054,0x050,0x04B,0x047,0x043,0x03F,0x03C,0x038,
|
||||
0x035,0x032,0x02F,0x02D,0x02A,0x028,0x026,0x024,0x022,0x020,0x01E,0x01D,
|
||||
0x01B,0x01A,0x019,0x018,0x015,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E
|
||||
};
|
||||
|
||||
/* Table #2 of Pro Tracker 3.4x - 3.5x */
|
||||
static unsigned short PT3NoteTable_ASM_34_35[] = {
|
||||
0xD10,0xC55,0xBA4,0xAFC,0xA5F,0x9CA,0x93D,0x8B8,0x83B,0x7C5,0x755,0x6EC,
|
||||
0x688,0x62A,0x5D2,0x57E,0x52F,0x4E5,0x49E,0x45C,0x41D,0x3E2,0x3AB,0x376,
|
||||
0x344,0x315,0x2E9,0x2BF,0x298,0x272,0x24F,0x22E,0x20F,0x1F1,0x1D5,0x1BB,
|
||||
0x1A2,0x18B,0x174,0x160,0x14C,0x139,0x128,0x117,0x107,0x0F9,0x0EB,0x0DD,
|
||||
0x0D1,0x0C5,0x0BA,0x0B0,0x0A6,0x09D,0x094,0x08C,0x084,0x07C,0x075,0x06F,
|
||||
0x069,0x063,0x05D,0x058,0x053,0x04E,0x04A,0x046,0x042,0x03E,0x03B,0x037,
|
||||
0x034,0x031,0x02F,0x02C,0x029,0x027,0x025,0x023,0x021,0x01F,0x01D,0x01C,
|
||||
0x01A,0x019,0x017,0x016,0x015,0x014,0x012,0x011,0x010,0x00F,0x00E,0x00D,
|
||||
0xD10,0xC55,0xBA4,0xAFC,0xA5F,0x9CA,0x93D,0x8B8,0x83B,0x7C5,0x755,0x6EC,
|
||||
0x688,0x62A,0x5D2,0x57E,0x52F,0x4E5,0x49E,0x45C,0x41D,0x3E2,0x3AB,0x376,
|
||||
0x344,0x315,0x2E9,0x2BF,0x298,0x272,0x24F,0x22E,0x20F,0x1F1,0x1D5,0x1BB,
|
||||
0x1A2,0x18B,0x174,0x160,0x14C,0x139,0x128,0x117,0x107,0x0F9,0x0EB,0x0DD,
|
||||
0x0D1,0x0C5,0x0BA,0x0B0,0x0A6,0x09D,0x094,0x08C,0x084,0x07C,0x075,0x06F,
|
||||
0x069,0x063,0x05D,0x058,0x053,0x04E,0x04A,0x046,0x042,0x03E,0x03B,0x037,
|
||||
0x034,0x031,0x02F,0x02C,0x029,0x027,0x025,0x023,0x021,0x01F,0x01D,0x01C,
|
||||
0x01A,0x019,0x017,0x016,0x015,0x014,0x012,0x011,0x010,0x00F,0x00E,0x00D,
|
||||
};
|
||||
|
||||
/* Table #3 of Pro Tracker 3.4r */
|
||||
static unsigned short PT3NoteTable_REAL_34r[] = {
|
||||
0xCDA,0xC22,0xB73,0xACF,0xA33,0x9A1,0x917,0x894,0x819,0x7A4,0x737,0x6CF,
|
||||
0x66D,0x611,0x5BA,0x567,0x51A,0x4D0,0x48B,0x44A,0x40C,0x3D2,0x39B,0x367,
|
||||
0x337,0x308,0x2DD,0x2B4,0x28D,0x268,0x246,0x225,0x206,0x1E9,0x1CE,0x1B4,
|
||||
0x19B,0x184,0x16E,0x15A,0x146,0x134,0x123,0x113,0x103,0x0F5,0x0E7,0x0DA,
|
||||
0x0CE,0x0C2,0x0B7,0x0AD,0x0A3,0x09A,0x091,0x089,0x082,0x07A,0x073,0x06D,
|
||||
0x067,0x061,0x05C,0x056,0x052,0x04D,0x049,0x045,0x041,0x03D,0x03A,0x036,
|
||||
0x033,0x031,0x02E,0x02B,0x029,0x027,0x024,0x022,0x020,0x01F,0x01D,0x01B,
|
||||
0x01A,0x018,0x017,0x016,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,
|
||||
};
|
||||
|
||||
/* Table #3 of Pro Tracker 3.4x - 3.5x */
|
||||
/* NOTE: ONLY DIFFERENCE IS 0x113 -> 0x112 */
|
||||
static unsigned short PT3NoteTable_REAL_34_35[] = {
|
||||
0xCDA,0xC22,0xB73,0xACF,0xA33,0x9A1,0x917,0x894,0x819,0x7A4,0x737,0x6CF,
|
||||
0x66D,0x611,0x5BA,0x567,0x51A,0x4D0,0x48B,0x44A,0x40C,0x3D2,0x39B,0x367,
|
||||
0x337,0x308,0x2DD,0x2B4,0x28D,0x268,0x246,0x225,0x206,0x1E9,0x1CE,0x1B4,
|
||||
0x19B,0x184,0x16E,0x15A,0x146,0x134,0x123,0x112,0x103,0x0F5,0x0E7,0x0DA,
|
||||
0x0CE,0x0C2,0x0B7,0x0AD,0x0A3,0x09A,0x091,0x089,0x082,0x07A,0x073,0x06D,
|
||||
0x067,0x061,0x05C,0x056,0x052,0x04D,0x049,0x045,0x041,0x03D,0x03A,0x036,
|
||||
0x033,0x031,0x02E,0x02B,0x029,0x027,0x024,0x022,0x020,0x01F,0x01D,0x01B,
|
||||
0x01A,0x018,0x017,0x016,0x014,0x013,0x012,0x011,0x010,0x00F,0x00E,0x00D,
|
||||
};
|
||||
|
||||
|
||||
static unsigned short Tone[256];
|
||||
|
||||
|
||||
// NoteTableCreator (c) Ivan Roshin
|
||||
// A - NoteTableNumber*2+VersionForNoteTable
|
||||
// (xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0)
|
||||
|
||||
#if 0
|
||||
unsigned short base[]={
|
||||
0x0D10*2,(0x0C55*2)+1,0x0BA4*2,0x0AFC*2,0x0A5F*2,0x09CA*2,
|
||||
0x093D*2,0x08B8*2,0x083B*2,0x07C5*2,0x0755*2,0x06EC*2,
|
||||
unsigned short base0_v3[]={
|
||||
0xC21,0xB73,0xACE,0xA33,0x9A0,0x916,0x893,0x818,0x7A4,0x736,0x6CE,0x66D,
|
||||
};
|
||||
#endif
|
||||
unsigned short base[]={
|
||||
0x0D10,0x0C55,0x0BA4,0x0AFC,0x0A5F,0x09CA,
|
||||
0x093D,0x08B8,0x083B,0x07C5,0x0755,0x06EC,
|
||||
|
||||
unsigned short base0_v4[]={
|
||||
0xC22,0xB73,0xACF,0xA33,0x9A1,0x917,0x894,0x819,0x7A4,0x737,0x6CF,0x66D,
|
||||
};
|
||||
|
||||
unsigned short base1[]={
|
||||
0xEF8,0xE10,0xD60,0xC80,0xBD8,0xB28,0xA88,0x9F0,0x960,0x8E0,0x858,0x7E0,
|
||||
};
|
||||
|
||||
unsigned short base2_v4[]={
|
||||
0xD10,0xC55,0xBA4,0xAFC,0xA5F,0x9CA,0x93D,0x8B8,0x83B,0x7C5,0x755,0x6EC,
|
||||
};
|
||||
|
||||
|
||||
unsigned short base2[]={
|
||||
0x0EF8,0x0E10,0x0D60,0x0C80,0x0BD8,0x0B28,0x0A88,0x09F0, // 50
|
||||
0x0960,0x08E0,0x0858,0x07E0,
|
||||
};
|
||||
|
||||
void NoteTableCreate0(void) {
|
||||
/* create table #0 v3.3 "PT3NoteTable_PT_33_34r" */
|
||||
void NoteTableCreate_0_v3(void) {
|
||||
|
||||
int x,y;
|
||||
|
||||
for(y=0;y<12;y++) Tone[y]=base2[y];
|
||||
for(y=0;y<12;y++) Tone[y]=base0_v3[y];
|
||||
|
||||
for(x=0;x<84;x++) {
|
||||
Tone[x+12]=Tone[x]>>1;
|
||||
}
|
||||
}
|
||||
|
||||
/* create table #0 v3.4 "PT3NoteTable_PT_34_35" */
|
||||
void NoteTableCreate_0_v4(void) {
|
||||
|
||||
int x,y;
|
||||
|
||||
for(y=0;y<12;y++) Tone[y]=base0_v4[y];
|
||||
|
||||
for(x=0;x<84;x++) {
|
||||
Tone[x+12]=Tone[x]>>1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* create table #1 "PT3NoteTable_ST" */
|
||||
void NoteTableCreate_1_vX(void) {
|
||||
|
||||
int x,y;
|
||||
|
||||
for(y=0;y<12;y++) Tone[y]=base1[y];
|
||||
|
||||
for(x=0;x<84;x++) {
|
||||
Tone[x+12]=Tone[x]>>1;
|
||||
@ -75,20 +162,21 @@ void NoteTableCreate0(void) {
|
||||
0 1 0 0 1 1 0 0 0 0 0 0
|
||||
*/
|
||||
|
||||
static unsigned char table1_adjust[]={
|
||||
static unsigned char table2_adjust[]={
|
||||
0x20, 0xa8, 0x40, 0x08, 0x84, 0x90, 0x08, 0x10, 0x14, 0x08, 0x2a, 0x50
|
||||
};
|
||||
|
||||
|
||||
void NoteTableCreate1(void) {
|
||||
/* Create Table #2, v4+, "PT3NoteTable_ASM_34_35" */
|
||||
void NoteTableCreate_2_v4(void) {
|
||||
|
||||
int x,y;
|
||||
int extra;
|
||||
|
||||
for(y=0;y<12;y++) Tone[y]=base[y];
|
||||
for(y=0;y<12;y++) Tone[y]=base2_v4[y];
|
||||
|
||||
for(x=0;x<84;x++) {
|
||||
extra=(table1_adjust[x%12]>>((x+12)/12))&1;
|
||||
extra=(table2_adjust[x%12]>>((x+12)/12))&1;
|
||||
|
||||
printf("%d ",extra);
|
||||
if (x%12==11) printf("\n");
|
||||
@ -105,10 +193,99 @@ void NoteTableCreate1(void) {
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int i;
|
||||
int nomatch=0;
|
||||
|
||||
|
||||
/* Test table 0 */
|
||||
NoteTableCreate0();
|
||||
/***********************************/
|
||||
/* Test table #0 Version <=3.3 */
|
||||
/* PT3NoteTable_PT_33_34r */
|
||||
/***********************************/
|
||||
|
||||
printf("\n");
|
||||
printf("*********************\n");
|
||||
printf("Test Table 0 v3\n");
|
||||
printf("*********************\n");
|
||||
|
||||
NoteTableCreate_0_v3();
|
||||
|
||||
nomatch=0;
|
||||
|
||||
for(i=0;i<8*12;i++) {
|
||||
if (i%12==0) printf("\n");
|
||||
printf("%03X",Tone[i]);
|
||||
if (Tone[i]-PT3NoteTable_PT_33_34r[i]) {
|
||||
printf("+%d|",Tone[i]-PT3NoteTable_PT_33_34r[i]);
|
||||
nomatch++;
|
||||
//printf("%03X",PT3NoteTable_ASM_34_35[i]);
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_PT_33_34r,8*12*sizeof(short))) {
|
||||
printf("MATCH Table 0 version 3.3\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH\n");
|
||||
}
|
||||
|
||||
printf("Nomatch count=%d\n",nomatch);
|
||||
|
||||
|
||||
/***********************************/
|
||||
/* Test table #0 Version 3.4+ */
|
||||
/* PT3NoteTable_PT_34_35 */
|
||||
/***********************************/
|
||||
|
||||
printf("\n");
|
||||
printf("*********************\n");
|
||||
printf("Test Table 0 v4+\n");
|
||||
printf("*********************\n");
|
||||
|
||||
NoteTableCreate_0_v4();
|
||||
|
||||
nomatch=0;
|
||||
|
||||
for(i=0;i<8*12;i++) {
|
||||
if (i%12==0) printf("\n");
|
||||
printf("%03X",Tone[i]);
|
||||
if (Tone[i]-PT3NoteTable_PT_34_35[i]) {
|
||||
printf("+%d|",Tone[i]-PT3NoteTable_PT_34_35[i]);
|
||||
nomatch++;
|
||||
//printf("%03X",PT3NoteTable_ASM_34_35[i]);
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_PT_34_35,8*12*sizeof(short))) {
|
||||
printf("MATCH Table 0 version 3.4\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH\n");
|
||||
}
|
||||
|
||||
printf("Nomatch count=%d\n",nomatch);
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************/
|
||||
/* Test table 1 all versions */
|
||||
/* "PT3NoteTable_ST" */
|
||||
/***********************************/
|
||||
|
||||
printf("\n");
|
||||
printf("*********************\n");
|
||||
printf("Test Table 1\n");
|
||||
printf("*********************\n");
|
||||
|
||||
NoteTableCreate_1_vX();
|
||||
|
||||
|
||||
for(i=0;i<8*12;i++) {
|
||||
if (i%12==0) printf("\n");
|
||||
@ -123,25 +300,26 @@ int main(int argc, char **argv) {
|
||||
printf("\n");
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_ST,8*12*sizeof(short))) {
|
||||
printf("MATCH 35\n");
|
||||
printf("MATCH Table 1\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH 35\n");
|
||||
}
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_ASM_34_35,8*12*sizeof(short))) {
|
||||
printf("MATCH 34\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH 34\n");
|
||||
printf("NO MATCH Table 1\n");
|
||||
}
|
||||
|
||||
|
||||
/* Test table 1 */
|
||||
/***********************************/
|
||||
/* Test table #2 Version 3.4 - 3.5 */
|
||||
/* ASM_34_35 */
|
||||
/***********************************/
|
||||
|
||||
NoteTableCreate1();
|
||||
printf("\n");
|
||||
printf("*********************\n");
|
||||
printf("Test Table 2 v4\n");
|
||||
printf("*********************\n");
|
||||
|
||||
int nomatch=0;
|
||||
NoteTableCreate_2_v4();
|
||||
|
||||
nomatch=0;
|
||||
|
||||
for(i=0;i<8*12;i++) {
|
||||
if (i%12==0) printf("\n");
|
||||
@ -157,15 +335,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_ST,8*12*sizeof(short))) {
|
||||
printf("MATCH 35\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH 35\n");
|
||||
}
|
||||
|
||||
if (!memcmp(Tone,PT3NoteTable_ASM_34_35,8*12*sizeof(short))) {
|
||||
printf("MATCH 34\n");
|
||||
printf("MATCH Table 2 v4\n");
|
||||
}
|
||||
else {
|
||||
printf("NO MATCH 34\n");
|
||||
|
Loading…
Reference in New Issue
Block a user