pt3: messing with tone table generation again

This commit is contained in:
Vince Weaver 2019-09-09 17:10:18 -04:00
parent 0e2a9ecd06
commit ccf75e4be2
3 changed files with 102 additions and 57 deletions

View File

@ -2,7 +2,7 @@ CC = gcc
CFLAGS = -O2 -Wall
LFLASG =
all: 6502_table table_gen z80_volume z80_tone
all: 6502_table table_gen z80_volume c_tone
###
@ -38,6 +38,14 @@ z80_tone.o: z80_tone.c
###
clean:
rm -f *~ *.o z80_volume z80_tone table_gen 6502_table
c_tone: c_tone.o
$(CC) $(LFLAGS) -o c_tone c_tone.o
c_tone.o: c_tone.c
$(CC) $(CFLAGS) -c c_tone.c
###
clean:
rm -f *~ *.o z80_volume z80_tone table_gen 6502_table c_tone

View File

@ -21,28 +21,10 @@ static unsigned short PT3NoteTable_ASM_34_35[] = {
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,
0x034,0x031,0x02F,0x02C,0x029,0x027,0x025,0x023,0x021,0x01F,0x01D,0x01C,
0x01A,0x019,0x017,0x016,0x015,0x014,0x012,0x011,0x010,0x00F,0x00E,0x00D,
};
#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];
@ -67,61 +49,109 @@ unsigned short base2[]={
0x0960,0x08E0,0x0858,0x07E0,
};
void NoteTableCreator(int which) {
void NoteTableCreate0(void) {
int x,y;
for(y=0;y<12;y++) Tone[y]=base2[y];
for(x=0;x<84;x++) {
Tone[x+12]=Tone[x]>>1;
}
Tone[23]+=13;
Tone[46]-=1;
}
void NoteTableCreate1(void) {
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(y=0;y<12;y++) Tone[y]=base[y];
for(x=0;x<84;x++) {
round=0;
// round=Tone[x]&1;
Tone[x+12]=Tone[x]>>1;
if (which==1) Tone[x+12]+=round;
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[32]+=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;
}
}
}
//
Tone[42]+=1;
//
//
Tone[45]+=1;
Tone[46]+=1;
//
//
//
//
Tone[51]+=1;
Tone[52]+=1;
Tone[53]+=1;
Tone[54]+=1;
Tone[55]+=1;
Tone[56]+=1;
//
//
Tone[59]+=1;
Tone[60]+=1;
Tone[61]+=1;
//
Tone[63]+=1;
Tone[64]+=1;
//
Tone[66]+=1;
Tone[67]+=1;
Tone[68]+=1;
//
Tone[70]+=1;
//
//
//
Tone[74]+=1;
Tone[75]+=1;
//
//
Tone[78]+=1;
Tone[79]+=1;
Tone[80]+=1;
//
//
Tone[83]+=1;
//
Tone[85]+=1;
//
Tone[87]+=1;
Tone[88]+=1;
Tone[89]+=1;
#endif
}
int main(int argc, char **argv) {
int i;
NoteTableCreator(0);
/* Test table 0 */
NoteTableCreate0();
for(i=0;i<8*12;i++) {
if (i%12==0) printf("\n");
@ -150,15 +180,19 @@ int main(int argc, char **argv) {
}
/* Test table 1 */
NoteTableCreate1();
NoteTableCreator(1);
int nomatch=0;
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]);
printf("+%d/",Tone[i]-PT3NoteTable_ASM_34_35[i]);
nomatch++;
//printf("%03X",PT3NoteTable_ASM_34_35[i]);
}
else {
printf(" ");
@ -180,7 +214,7 @@ int main(int argc, char **argv) {
printf("NO MATCH 34\n");
}
printf("Nomatch count=%d\n",nomatch);
}

View File

@ -45,6 +45,7 @@ static unsigned short PT3NoteTable_REAL_34r[] = {
0x0014,0x0013,0x0012,0x0011,0x0010,0x000F,0x000E,0x000D,
};
#if 0
nt_data:
@ -80,6 +81,8 @@ 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
#endif
/* first 12 values of tone tables (packed) */
static unsigned char t_pack[]={
0x06EC*2/256,0x06EC*2,