Hello friends, I am too sleepy but:
Here is that OPL2 adlib player for C64 SFX expander...
https://github.com/lgblgblgb/c64-sfx-ca … layer/wiki
Re-pasting from email -> LGB/C64 opl2 player author:
Nothing mystical about my *extremely* stupid player too much, and the source code is open since years, so no problem at all to grab it You can find it here:
The only issue can be, that since it's GPL, if you use it, or part of it, your work must be open source + GPL too, etc, but IANAL ;-P
Well, it sounds an interesting project (yours), but I am not so much a great help here, since I've never even used Atari (unfortunately, but I would love to have one) - but if you speak about 8 bit Atari computers, the CPU is still 65xx class, so maybe some other differences on the hardware should be learnt (Ehmm, I am over-optimistic enough here?). There are several minor points with my "player":
* in its core, it's really two STAs selecting the register number, and write it .... all the other part is the DRO file format "reader", which is simple enough, since it's basically a register dump like file format (of DOSBOX). Thus it's very easy to write a player like this, it's more a challenge if some wants to play a "decent" tracker like format ...
* this source is OLD, AFAIK does not even compile with modern ca65 as it should be (as it would create its own BASIC SYS stub for C64, some modification is needed)
* it cannot "load" anything, the DRO is INCBIN'ed ....
* really, this is good for demonstration only, eg, a DRO file format is also not so nice, as very large file sizes, etc etc
* I've already started a project for C64 (with the same hardware) to be able to play S3Ms instead, well, at least ones with "AdLib instruments" only. that is the mentioned "tracker like format" player, which is probably more close to have a sane player than this DRO thinggy ... Surely, other formats can be found as a good candidate for playing on OPL2/OPL3 not only "S3M with AdLib instruments only".
Some technical background: back in the time when I wrote that, I only read the "Adlib programming FAQ for PCs". There is 388h and 389h (if I remember correctly) ports for selecing OPL2 register, and read/write that register. Other than that there is a timing constraint to wait some time before write/read again. Also, the layout of the actual internal registers of the OPL chip. Then I thought, if SFX Sound Expander cartridge has some kind of similar chip, these theories can be used without _any_ change _but_ the I/O port of course (which is PC notion). And indeed, that seems to work, as expected. So it's just that ...
Sorry for the long mail, maybe too much information already But if you have question just ask ... I can't tell I have too much time recently for coding as well, but at least for writing insane mails, well, it seems I do ;-D
One additional note: I have the yet unfinished work to play S3M "with AdLib instruments only" on C64 + SFX expander cartridge. That code would be able to play S3M directly (ie, on-the fly "interpretation" of the so called "packed pattern format" since ScreamTracker for real decompresses it first, but it uses way too much memory in that way for my taste). However since it's not ready yet to do _anything_ it is not released yet. Also I find myself a bit dumb for implementing stuffs like "commands" in the patterns, but we will see ...