Novotrade pattern format (fix for Asle's PW)

Discussion about Amiga / C64 / Demoscene music and the ExoticA music archive. Favourite music, new rips, musicians, demo sounds, audio software. It's all welcome here.

Moderators: XtC, BuZz

Post Reply
claudio
Posts: 13
Joined: Sun Dec 27, 2009 12:12 pm
Contact:

Novotrade pattern format (fix for Asle's PW)

Post by claudio »

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.

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;
      }
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.

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);
        }

User avatar
BuZz
Site Admin
Posts: 569
Joined: Mon Jun 10, 2002 12:52 pm
Location: Didcot, Oxfordshire
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by BuZz »

Thanks for the info!

claudio
Posts: 13
Joined: Sun Dec 27, 2009 12:12 pm
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by claudio »

One more fix, this time in the Titanics Player code:

Code: Select all

273       if ((in_data[Where]&0x7f) != 0x00)
274         k += (in_data[Where]&0x7f);
275       if (k > 1024)
276       {
277         /*printf ("pat %ld too big\n",i);*/
278         break;
279       }
In line 275 variable k is the row number and should be tested against 64 and not 1024.

asle
Posts: 208
Joined: Fri Mar 07, 2003 11:28 pm
Location: France
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by asle »

ouch ... man ..
ok, I'll look into that. Thanks for the report. Wont be before next year I'm afraid ;)
Will keep you updated.

Sylvain
Sylvain "Asle" Chipaux

asle
Posts: 208
Joined: Fri Mar 07, 2003 11:28 pm
Location: France
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by asle »

ok, Novotrade Packer is _NOT_ active, whatever the version you have. I'm fairly confident the depacker doesn't work. I agree the source is there, but it's not used at all.

I'm looking at the Titanics cruncher.
Sylvain "Asle" Chipaux

claudio
Posts: 13
Joined: Sun Dec 27, 2009 12:12 pm
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by claudio »

asle wrote:ok, Novotrade Packer is _NOT_ active, whatever the version you have. I'm fairly confident the depacker doesn't work. I agree the source is there, but it's not used at all.
Hm, it not being active explains why it didn't work in the first place! But it will work if you use the voice mask byte. Thanks for including it even if not functional, it's always good to have some reference on how the format works.

Code: Select all

00 0F          mask 1111
01 AC 3F 06    voice 1 data
01 AC 1E 01    voice 2 data
00 D6 20 00    voice 3 data
00 B4 20 00    voice 4 data
00 02          mask 0010
01 AC 10 00    voice 3 data
00 03          mask 0011
01 AC 30 00    voice 3 data
00 D6 10 00    voice 4 data

asle
Posts: 208
Joined: Fri Mar 07, 2003 11:28 pm
Location: France
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by asle »

Ok, I've updated the Novotrade depacker. While your method sounded quite good, there was still a pb.
The voices are reversed in your example code. You must check the 01, then 02, then 04 and finally 08.

I've attached the new source code for this format.

Tell me if you see any problem. I suspect there may be a problem with speed (vblank vs cia). At least, I'm fairly sure the existing
replayer is vblank.

Thanks for bringing this topic up and giving me the solution around pattern data depacking :).

Now, let me check this Titanic problem you brought up too ;)

Sylvain
Attachments
NovoTrade.rar
(2.13 KiB) Downloaded 137 times
Sylvain "Asle" Chipaux

claudio
Posts: 13
Joined: Sun Dec 27, 2009 12:12 pm
Contact:

Re: Novotrade pattern format (fix for Asle's PW)

Post by claudio »

Thanks! Fixing voice order here as well.

Post Reply