VOGONS


First post, by ElBrunzy

User metadata
Rank Oldbie
Rank
Oldbie

CAPAMOD v3.13b by Flap of Capacala is by far my favorite module player. It support the most common format of that era and rely entirely on the GUS to play music. Some people argue that amiga modules cannot be chiptune since it's not a chip dump, like an VGM file would be for instance. I think the extend at which those specific modules exploited every quirk of the audio chip might deserve the mention. I also remember someone on the chiptune movie saying they did that style of music first as it's what they knew most, coming from the SID scene. I also like to quote the aminet directory definition of : mods/chip - Mods without samples, which contain my favorite collection.

So, what a .mod chiptune is exactly ? Flap seem to know something precise as his player will blink a yellow "CHiP!" marker on the upper-right corner of the screen when it detect one. What are those condition exactly ? I heard about people using Claude to decompile and debug old program. I though maybe I could try to ask it to debug the program and tell what those conditions are. The result really impressed me much, here is the text :

Claude wrote:
Analyzing a DOS executable's trigger for a CHIP message. […]
Show full quote

Analyzing a DOS executable's trigger for a CHIP message.

I’ll start by inspecting the executable (format, packer, strings), then find the code that prints “CHIP!” and work out the condition behind it.

Not packed (readable strings, Borland C++ 1994, real-mode 16-bit). There’s a CHiP! string with a lowercase “i”. I’ll see what’s around it.

cs:4242 is initialised to 0 at 71A9, then accumulated with add/adc at 757B, 7FD6 and 8930, with a plain store at 7030. That’s a running total. Next: what’s being added, in each loader.

“CHiP!” appears when the module is small: the whole file is at most 32,768 bytes, and every individual sample is at most 4,096 bytes. It’s “CHiP!” with a lowercase i, a chiptune-style flag. I got this from reading the disassembly only. There’s no DOS emulator in this sandbox, so I haven’t watched it run.

How it works

The program is unpacked Borland C++ 1994 real-mode code, so it disassembles cleanly.
The flag is a single byte at DS:212E. Only one routine sets it, the module-loaded handler at image offset 0x1111E.
The handler clears the flag, then sets it only if both of these hold:
Size: the module size (cs:4242, the file position after loading, which the info panel also prints as bytes and “NNk”) is at most 0x8000, tested with cmp eax,8000h / jna.
Samples: for every sample of every instrument, the stored sample length (the dword at +0x1F of each 55-byte sample struct) is at most 0x1000.
The loaders for MOD, S3M and XM all fill those same fields, so the rule is the same for every format. Samples of 4 bytes or less in a MOD are skipped, but they could never trip the limit anyway.
The panel-draw routine (0x10E39) tests the flag at 0x110FC and draws the text at column 48, row 2 with fg=0x0E, bg=8. The attribute is (bg<<4)+fg = 0x8E, which is yellow with the VGA blink bit set. The program never turns blink off (no INT 10h function 1003h), so the blinking is just text-mode blink, not a timer.

Caveats

A packed module in a ZIP is measured after unpacking.
The S3M size comes from the file position after the last sample is loaded. That is normally the end of the file, but it isn’t guaranteed.

To have the file not over 32kb made sense with what I knew, but the 4kb sample maximum is news to me. So I wonder where it could come from. Maybe 4kb was something related to how the memory is arranged on the GUS onboard ram or Paula chip ram ? Would having smaller sample enable some effect used in chiptune style music ? Really I'm at lost about this 4kb max condition and would like to hear about any input you may have.

Reply 1 of 1, by zaphod77

User metadata
Rank Member
Rank
Member

A chiptune module is one with really teeny and basic samples, like an old sound chip could make.

This is in fact the original definition of a chiptune.

Instead of sampling a real instrument, the samples are crafted.

here's a good example of that style of chiptune used in a game.

https://www.youtube.com/watch?v=s0LTOuyBVws

the Konami SCC allows playback of 32 byte 8 bit samples with loop points for envelopes.