By Bill McDonald
Wanna know how to do a MOD player?
This is my first tutorial so i thought an intro would be nice. Please excuse any spelling mistakes and so on.
1.3 Blah Blah Blah get on with it..Disclaimer
2.2 Why Bother?
2.3 Memory Requirements and Programs needed
The programs you will need to run the examples in this tut are
TYPE LENGTH Bits RANGE Basic byte 1 8 0-255 String * 1 word 2 16 0-65,535 Integer dword 4 32 0-4,294,967,295 Long
* This is as close to the actual ones that I could think of.. (anyone that can do better email me).
3.2 Setting up the arrays/variables
3.3 Checking to see if its a valid .mod
Before we load a mod we have to check that it is a mod. Every mod has a signature this is in the form of a 4 letter string that equals "M.K." The signature is stored at offset 1080 (438h) in the file, so it should be checked first.
At offset 1081 there should be "M.K." identifies it as a 4 channel 31 sample mod file. So the check should look something like this..
Open the mod file for binary
Sample information is stored at the start of a MOD file, and contains all the
relevant information for each of the 31 samples. This includes its name,
length, loop points, finetune and what not.
4.2 Data types for the sample headers
4.3 Loading the Sample headers
for i = 1 to 31
The Name, Length, Loopstart and Looplength need to be caclulated with this formula (byte1*100h + byte2) * 2 I will provide my alternate formula in the next issue.
Byte1$ = LEFT$(Length$, 1)
For FINETUNE, if the value is > 7, subtract 16 from it to get the signed value
Thanks for reading
Back to Top