>>>> WARNING: very poor translation!!! <<<<
With new, well optimized MOD-player 3 it is possible to play multichannel trackers at reasonable sampling rates however there is one small problem. There are almost no multichannel trackers in ProTracker format (MOD). Conversion of S3M into MOD is very complicated and not always possible so I've decided to implement S3M loader for my player. ScreamTracker 3 is very similar to ProTracker so it wasn't to complicated but it has several problems. First one is that S3M uses unsigned samples while MOD uses signed. Coversion in realtime needs several more clock cycles in mix loop (some XOR and decision whether signed/unsigned) so this seems to be a bad solution. Preconversion to signed whould take at least 1s/1MB at 20MHz and I can't stand devices that hes response time longer than some 100ms so this is also wrong solution for me. :-) Therefore there left only last possibility: To make some program for PC that will preconvert S3M sample format. Since I had to make it this way it also converts S3M header into something between MOD and S3M. Resulting format is simple as MOD but has all advantages of S3M like compressed patterns, default panning, volume commands, etc.
1. Basic features
All values are for AVR at 20MHz but it's of course possible to overclock.
It's almos identical to previous MOD-player 3. Only difference is that I had to make digital stereo mix instead of analog (because of panning effect) so I've removed mixing resistors from OPAMP outputs.
Core of this player is relatively powerfull MCU AVR ATmega644-PU at 20MHz.
It has 64kiB of FLASH and 4kiB of RAM which is quite enough for all structures and some audio FIFO.
External SRAM is addressed in SW mode using two address buffers IC2 and IC3. It's using only two ports and
few control signals. SRAM should be at least 55ns version.
Same ports are shared with IDE interface in 16-bit mode, with HD44780 LCD in 8-bit mode and with buttons interface.
Used MCU should work at least at 20MHz but while experimenting with mutlichannel trackers I've tried to push it up a bit. At first only for 24MHz but since it seemed to work I've tried 27MHz and still no problem. This is quite interesting because my old ATmega32 had problems even at 18MHz (code worked only if it was aligned from even address :D). Because I haven't found any faster crystal I've tried to use some 32MHz oscillator from table sediments and after few aditional wait cycles for SRAM and IDE interface it works with no problems! It actually worked at 40MHz @ 6V1 but that was a bit much for other components. ;-)
Code it written in pure ASM but this time I've used louds of macros and I've
tried to make comments everywhere. I've also split the code from 7k+ lines long "noodle" into
several modules so it should be easier to undestand it.
At first external SRAM is tested. If there is at least 64kiB program should continue.
If no SRAM is found or there is error detected program should stop.
Next step is detection of IDE device. If something is found and first partition is formated as FAT16
player should enter into folder menu.
If no IDE device is detected or IDE interface is disabled and player should enter into serial port loading mode.
In this mode player waits for MOD data that can be send by any terminal without flow control
(MCU is fast enough). End of file is detected automatically - file loading is finished if there
is no recieved byte for more than 1.5sec. Serial load can be also activated manually with "COM" button.
Most of usefull options are present at beggining of "m644_modplay.asm" module.
Parameters are described in following table.
There are some more parameters in this module but it's usually not neccessary to change them. Only important parameter is audio FIFO size which should be always maximal (it should use entire unused RAM) but it can't be shorter than 1kiB because it's shared with another module as data buffer ("storage.asm").
3.3 Fuse bits
If player is used with crystal CKOPT fuse should be programmed (full swing oscilator amplitude). JTAG should be disabled because it's located at data pins which are therefore in weak-high level mode. This is a bit problematic for fast data transfers. Another solution could be use of external pull-ups but I've didn't tried that.
4. Supported formats and effects
Player should be able to play uncompressed ProTracker files (*.MOD) theoretically with
any channel count but of course with adequate sampling rate.
Implemented effects should sound exactly as in Modplug tracker - I've used it and its sources almost
as a standard. ;-)
5. ProTracker format
Last version of my MOD player was designed without detailed documentation so result was terrible
but this time I've fortunately found some good specifications:
The best "documentation" of all is Modplug tracker source code. Main decoder is taken from some ancient player (and converted into C++) so it actually verty nasty but still it's the best way how to understand how effects works.
6. Some recordings from MOD-player
In this video there are some S3M trackers played (it's mostly from Jazz Jack Rabbit 2 game):
(c) 2011, Stanislav Mašláň - All rights reserved.