pt3: work on tone table

This commit is contained in:
Vince Weaver 2019-06-19 17:14:36 -04:00
parent 9e49a0e0e2
commit 30c95a5165
3 changed files with 230 additions and 13 deletions

View File

@ -2014,6 +2014,7 @@ freq_table_2:
; Table #1 of Pro Tracker 3.3x - 3.5x
PT3NoteTable_ST_high:
; 2*E, 1*D, 1*C, 2*B, 1*A, 2*9, 2*8, 3*7, 2*6, 3*5, 4*4, 5*3, 7*2, 11*1, 49*0
.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09
.byte $09,$08,$08,$07,$07,$07,$06,$06
.byte $05,$05,$05,$04,$04,$04,$04,$03
@ -2071,7 +2072,7 @@ PT3NoteTable_ASM_34_35_low:
.byte $21,$1F,$1D,$1C,$1A,$19,$17,$16
.byte $15,$14,$12,$11,$10,$0F,$0E,$0D
.align $100
VolumeTable:
.res 256,0

View File

@ -0,0 +1,188 @@
#include <stdio.h>
#include <string.h>
// 8*12
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,
0x3BE,0x384,0x358,0x320,0x2F6,0x2CA,0x2A2,0x27C,0x258,0x238,0x216,0x1F8,
0x1DF,0x1C2,0x1AC,0x190,0x17B,0x165,0x151,0x13E,0x12C,0x11C,0x10A,0x0FC,
0x0EF,0x0E1,0x0D6,0x0C8,0x0BD,0x0B2,0x0A8,0x09F,0x096,0x08E,0x085,0x07E,
0x077,0x070,0x06B,0x064,0x05E,0x059,0x054,0x04F,0x04B,0x047,0x042,0x03F,
0x03B,0x038,0x035,0x032,0x02F,0x02C,0x02A,0x027,0x025,0x023,0x021,0x01F,
0x01D,0x01C,0x01A,0x019,0x017,0x016,0x015,0x013,0x012,0x011,0x010,0x00F,
};
/* 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,
0x0034,0x0031,0x002F,0x002C,0x0029,0x0027,0x0025,0x0023,0x0021,0x001F,0x001D,0x001C,
0x001A,0x0019,0x0017,0x0016,0x0015,0x0014,0x0012,0x0011,0x0010,0x000F,0x000E,0x000D,
};
#if 0
/* Table #3 of Pro Tracker 3.4r */
static unsigned short PT3NoteTable_REAL_34r[] = {
0x0CDA,0x0C22,0x0B73,0x0ACF,0x0A33,0x09A1,0x0917,0x0894,
0x0819,0x07A4,0x0737,0x06CF,0x066D,0x0611,0x05BA,0x0567,
0x051A,0x04D0,0x048B,0x044A,0x040C,0x03D2,0x039B,0x0367,
0x0337,0x0308,0x02DD,0x02B4,0x028D,0x0268,0x0246,0x0225,
0x0206,0x01E9,0x01CE,0x01B4,0x019B,0x0184,0x016E,0x015A,
0x0146,0x0134,0x0123,0x0113,0x0103,0x00F5,0x00E7,0x00DA,
0x00CE,0x00C2,0x00B7,0x00AD,0x00A3,0x009A,0x0091,0x0089,
0x0082,0x007A,0x0073,0x006D,0x0067,0x0061,0x005C,0x0056,
0x0052,0x004D,0x0049,0x0045,0x0041,0x003D,0x003A,0x0036,
0x0033,0x0031,0x002E,0x002B,0x0029,0x0027,0x0024,0x0022,
0x0020,0x001F,0x001D,0x001B,0x001A,0x0018,0x0017,0x0016,
0x0014,0x0013,0x0012,0x0011,0x0010,0x000F,0x000E,0x000D,
};
#endif
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,
};
#endif
unsigned short base[]={
0x0D10,0x0C55,0x0BA4,0x0AFC,0x0A5F,0x09CA,
0x093D,0x08B8,0x083B,0x07C5,0x0755,0x06EC,
};
unsigned short base2[]={
0x0EF8,0x0E10,0x0D60,0x0C80,0x0BD8,0x0B28,0x0A88,0x09F0, // 50
0x0960,0x08E0,0x0858,0x07E0,
};
void NoteTableCreator(int which) {
int round;
int x,y;
if (which==0) {
for(y=0;y<12;y++) Tone[y]=base2[y];
}
else {
for(y=0;y<12;y++) Tone[y]=base[y];
}
for(x=0;x<84;x++) {
round=0;
Tone[x+12]=Tone[x]>>1;
if (which==1) Tone[x+12]+=round;
}
if (which==0) {
Tone[23]+=13;
Tone[46]-=1;
}
if (which==1) {
#if 0
Tone[22]+=1;
Tone[28]+=1;
Tone[37]+=1;
Tone[39]+=1;
Tone[40]+=1;
#endif
}
#if 0
}
else {
int i,j;
for(i=0;i<8;i++) {
for(j=0;j<12;j++) {
round=0;
if (i!=0) round=(base[j]>>(i-1)&1);
Tone[j+(i*12)]=(base[j]>>i)+round;
}
}
}
#endif
}
int main(int argc, char **argv) {
int i;
NoteTableCreator(0);
for(i=0;i<8*12;i++) {
if (i%12==0) printf("\n");
printf(" %03X",Tone[i]);
if (Tone[i]-PT3NoteTable_ST[i]) {
printf("+%d",Tone[i]-PT3NoteTable_ST[i]);
}
else {
printf(" ");
}
}
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");
}
else {
printf("NO MATCH 34\n");
}
NoteTableCreator(1);
for(i=0;i<8*12;i++) {
if (i%12==0) printf("\n");
printf("%03X",Tone[i]);
if (Tone[i]-PT3NoteTable_ASM_34_35[i]) {
printf("%03X",PT3NoteTable_ASM_34_35[i]);
}
else {
printf(" ");
}
}
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");
}
else {
printf("NO MATCH 34\n");
}
}

View File

@ -19,18 +19,14 @@ static unsigned short PT3NoteTable_ST[]={
/* Table #2 of Pro Tracker 3.4x - 3.5x */
static unsigned short PT3NoteTable_ASM_34_35[] = {
0x0D10,0x0C55,0x0BA4,0x0AFC,0x0A5F,0x09CA,0x093D,0x08B8,
0x083B,0x07C5,0x0755,0x06EC,0x0688,0x062A,0x05D2,0x057E,
0x052F,0x04E5,0x049E,0x045C,0x041D,0x03E2,0x03AB,0x0376,
0x0344,0x0315,0x02E9,0x02BF,0x0298,0x0272,0x024F,0x022E,
0x020F,0x01F1,0x01D5,0x01BB,0x01A2,0x018B,0x0174,0x0160,
0x014C,0x0139,0x0128,0x0117,0x0107,0x00F9,0x00EB,0x00DD,
0x00D1,0x00C5,0x00BA,0x00B0,0x00A6,0x009D,0x0094,0x008C,
0x0084,0x007C,0x0075,0x006F,0x0069,0x0063,0x005D,0x0058,
0x0053,0x004E,0x004A,0x0046,0x0042,0x003E,0x003B,0x0037,
0x0034,0x0031,0x002F,0x002C,0x0029,0x0027,0x0025,0x0023,
0x0021,0x001F,0x001D,0x001C,0x001A,0x0019,0x0017,0x0016,
0x0015,0x0014,0x0012,0x0011,0x0010,0x000F,0x000E,0x000D,
0x0D10,0x0C55,0x0BA4,0x0AFC,0x0A5F,0x09CA,0x093D,0x08B8,0x083B,0x07C5,0x0755,0x06EC,
0x0688,0x062A,0x05D2,0x057E,0x052F,0x04E5,0x049E,0x045C,0x041D,0x03E2,0x03AB,0x0376,
0x0344,0x0315,0x02E9,0x02BF,0x0298,0x0272,0x024F,0x022E,0x020F,0x01F1,0x01D5,0x01BB,
0x01A2,0x018B,0x0174,0x0160,0x014C,0x0139,0x0128,0x0117,0x0107,0x00F9,0x00EB,0x00DD,
0x00D1,0x00C5,0x00BA,0x00B0,0x00A6,0x009D,0x0094,0x008C,0x0084,0x007C,0x0075,0x006F,
0x0069,0x0063,0x005D,0x0058,0x0053,0x004E,0x004A,0x0046,0x0042,0x003E,0x003B,0x0037,
0x0034,0x0031,0x002F,0x002C,0x0029,0x0027,0x0025,0x0023,0x0021,0x001F,0x001D,0x001C,
0x001A,0x0019,0x0017,0x0016,0x0015,0x0014,0x0012,0x0011,0x0010,0x000F,0x000E,0x000D,
};
/* Table #3 of Pro Tracker 3.4r */
@ -51,8 +47,40 @@ static unsigned short PT3NoteTable_REAL_34r[] = {
nt_data:
DB (T_NEW_0-T1_)*2
DB TCNEW_0-T_
DB (T_OLD_0-T1_)*2+1
DB TCOLD_0-T_
DB (T_NEW_1-T1_)*2+1
DB TCNEW_1-T_
DB (T_OLD_1-T1_)*2+1
DB TCOLD_1-T_
DB (T_NEW_2-T1_)*2
DB TCNEW_2-T_
DB (T_OLD_2-T1_)*2
DB TCOLD_2-T_
DB (T_NEW_3-T1_)*2
DB TCNEW_3-T_
DB (T_OLD_3-T1_)*2
DB TCOLD_3-T_
T_
TCOLD_0 DB #00+1,#04+1,#08+1,#0A+1,#0C+1,#0E+1,#12+1,#14+1
DB #18+1,#24+1,#3C+1,0
TCOLD_1 DB #5C+1,0
TCOLD_2 DB #30+1,#36+1,#4C+1,#52+1,#5E+1,#70+1,#82,#8C,#9C
DB #9E,#A0,#A6,#A8,#AA,#AC,#AE,#AE,0
TCNEW_3 DB #56+1
TCOLD_3 DB #1E+1,#22+1,#24+1,#28+1,#2C+1,#2E+1,#32+1,#BE+1,0
TCNEW_0 DB #1C+1,#20+1,#22+1,#26+1,#2A+1,#2C+1,#30+1,#54+1
DB #BC+1,#BE+1,0
TCNEW_1 EQU TCOLD_1
TCNEW_2 DB #1A+1,#20+1,#24+1,#28+1,#2A+1,#3A+1,#4C+1,#5E+1
DB #BA+1,#BC+1,#BE+1,0
/* first 12 values of tone tables (packed) */
static unsigned char t_pack[]={
0x06EC*2/256,0x06EC*2,
0x0755-0x06EC,