Skip to content

wbcbz7/oplupakuika

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oplupakuika

a "packer" and PC/DOS player for OPL2/3 register dumps, powered by upkr. mainly intended for tiny executable music entries, first used in Crystal Oscillator by Otomata Labs (released at Revision 2025 Oldskool Music competition). totally a partyhack but it works :D

features and limitations:

  • OPL2/3 support, 9/18 channels, no percussion mode, 2-op only

  • 186+ instructions, needs a fair chunk of conventional RAM (depends on source file size)

how to use:

  1. cook a banger OPL2/3 choon in any tool that support export to VGM format. note you can't use 4-op or percussion mode at this moment, and tick rate (i.e. 60hz) must be constant across the tune.

    • make sure all channels are explicitly muted at the end of tune!
    • also i would recommend to use any VGM optimization tool (like vgm_cmp from vgm_tools) to remove redundant register writes and delays.
  2. run compressor [filename.vgm] - it will convert the VGM to a separate filename folder with each stream saved as a separate file, and additionally produce a .opk bundle (not used actually, but you can play it with win32_player).

  3. copy filename folder and filename/music.inc file to dos_player folder

  4. cd dos_player, edit player.inc :

    • CQM_DETECT checks for Creative CQM (one of the worst OPL3 clones in the entire universe) at startup, and displays an error message if found, so anyone having that garbage chip is warned.
    • PRINT_PLAYTIME prints current playing time.
    • EXIT_AFTER_END speaks for itself :)
    • do not touch other fields!
  5. edit text.inc if you want to display custom text during playback.

  6. run !build.bat.

  7. grab the resulting player.com

  8. win the compo :D

how to compile:

the hardest part since I used whatever tools I had at hand - prerequisites are:

  • for the DOS player:

  • for the compressor/Win32 test player:

    • Visual C++ whatever (tested with VS2022) - one day i'll cmake it, maybe

details

not too much to write, but here's some details anyway:

  1. first, the VGM register dump is preprocessed by determining the actual (and most fitting) tick rate, and all delays are requantized.
  2. then, register data is deduplicated (removing redundant register writes) and split to 9*3 or 18*3 streams, depending on chip type:
    • 1st stream encodes instrument data registers, such as ADSR/waveform type/multiplier for each operator, feedback, and also stores key-on and key-off events.
    • 2nd stream stores volume (total level) data for each operator, delta preprocessed to improve compression ratio. volume streams are additionally grouped if their total size does not exceed 64 kb.
    • finally, 3rd stream stores pitch data, namely, FNum (delta preprocessed) and Block registers for each channel.
  3. each stream (and volume stream group) is independently compressed by upkr, then incbined to the player.

As you may (or may not) know, the OPL register space is both pretty sparse and grouped well (since channels are orthogonal for the common 2op no-perc-mode case) so this packer architecture turned out to be quite effective for player-only use cases.

the player itself first checks for 186\V20+ and memory size available, then decompresses each stream to memory and starts playing the tune. pretty simple yet working :)

credits and greetings

much thanks to exoticorn for the excellent upkr - without it this player wouldn't exist in the first place!

additional kudos to pestis and TomCat for the x86 depacker - had to tweak it a bit to make it decompress arbitrary data at any source/destination address - I guess it could be rewritten better for that use case ;)

respect for Abstract and Natt for cooking that banger choon for the Revision 2025 music compo, and the whole Otomata Labs posse for moral (and not only) support =)

oh and tildearrow for furnace (don't be so drunk during coding lol)

license

the compressor and DOS/COM player are fully MIT compliant (see LICENSE.md). the Win32 player is a bit in gray zone as it uses a Nuked-OPL3 emulation core which is GNU LGPL.

--artёmka 26.o4.2o25 - post-revision25 release

About

an extreme OPL2/3 register dump packer and executable player

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors