Novotrade pattern format (fix for Asle's PW)
Posted: Thu Dec 31, 2009 3:29 am
Hi,
Anyone who tried to use Asle's Prowizard 1.62 to play ntp files must have noticed that it doesn't work. I just noticed that the pattern converter is wrong: it assumes that there's a control word to mark the end of a pattern or to skip empty lines.
Instead, read the 16-bit word and use the four least significant bits as a mask. If a bit is set then there's an event in that voice. A mask of 0000 means an empty line. I used this method to correcly play the UnExoticA Castlevania files with xmp.
Anyone who tried to use Asle's Prowizard 1.62 to play ntp files must have noticed that it doesn't work. I just noticed that the pattern converter is wrong: it assumes that there's a control word to mark the end of a pattern or to skip empty lines.
Code: Select all
if (in_data[Where+1] == 0x80)
{
/*fprintf(DEBUG,"[%-4ld] %2x-%2x <-- end of pattern\n",k,in_data[Where],in_data[Where+1]);/*
/* pattern ends */
Where += 2;
k += 1;
break;
}
if (in_data[Where+1] == 0x01)
{
/*fprintf(DEBUG,"[%-4ld] %2x-%2x <-- ?!? unknown case\n",k,in_data[Where],in_data[Where+1]);*/
/* pattern ends */
Where += 2;
k += 1;
break;
}
if ((in_data[Where] == 0x00) && (in_data[Where+1]<=0x70))
{
/*fprintf(DEBUG,"[%-4ld] %2x-%2x <-- bypass %ld notes\n",k,in_data[Where],in_data[Where+1],in_data[Where+1]+1);*/
/* bypass notes .. guess */
k += (in_data[Where+1]+1)-1;
Where += 2;
continue;
}
Code: Select all
for (i = 0; i < npat; i++) {
fseek(in, body_addr + 4 + pat_addr[i], SEEK_SET);
memset(buf, 0, 1024);
for (j = 0; j < 64; j++) {
int x = read16b(in);
if (x & 0x0008)
fread(buf + j * 16, 1, 4, in);
if (x & 0x0004)
fread(buf + j * 16 + 4, 1, 4, in);
if (x & 0x0002)
fread(buf + j * 16 + 8, 1, 4, in);
if (x & 0x0001)
fread(buf + j * 16 + 12, 1, 4, in);
}
fwrite(buf, 1024, 1, out);
}