Jump to content

SAP TYPE R, recording (Turbo) Basic tunes to SAP


Recommended Posts



I was wondering if there's a SAP player that supports TYPE R (timed Pokey registers dump)? I was thinking about adding 'SAP Recording' to atari800 (the emulator), mostly to record (turbo) basic tunes and maybe songs from games where it is hard to separate the audio player from the actual game. But if there's no player for TYPE R, I have to rethink this.





Link to comment
Share on other sites

@miker, the problem with tunes from basic programs is that there's no such thing as an engine :)


@pirx, I'll look into it. At least a periodic register dump to a file will be a useful feature for an emulator anyway. Perhaps with some simple RLE compression of each channel's values (i.e. consider each register as a separate stream of values) several minutes might fit the memory of a stock 48kB Atari, including a native player. Afterwards, it'll be trivial to convert that to a TYPE B SAP file.

  • Like 2
Link to comment
Share on other sites

Yes, I think RLE should be enough. The problem with Exomizer or LZ4 or any other 'sliding window' method is that you'll have to keep large parts of the already decompressed and played stream of bytes in memory because a back reference might come up later. RLE is simply decompress 9 bytes, play and discard.


This pokey register recorder might also come in handy if a demo screen or game has very limited time left for music. One can compose a song in their favorite tracker, play it and record it and use that recording. A native player will probably take less than one scan line.


BTW recorder is done. I'll post the code to the atari800 mailing list shortly. It also supports recording stereo pokey songs.

  • Like 5
Link to comment
Share on other sites

  • 3 weeks later...

I've some experiments with SAP type R recording that show that just RLE coding isn't enough to bring down music to reasonable size.


Attached is a .zip file with some type R recordings. There wasn't a player available, so I winged it with regard to the format. One problem is that the SAP format doesn't seem to require an identifiable terminator before the binary data, so I used a blank line for that. The files are:

  • test.sap: Archon intro (26.5s)
  • test2.sap: First part of Numen (2:44.9s)
  • test3.sap: Sweet Voice MSX (digital channel lost due to low sampling rate) (2:01.8s)
  • test4.sap: Run for the Money title screen (59.7s)
  • test5.sap: Ray of Hope display list section (59.9s)
  • test.xex: Atari player version of test2.sap

The Numen track was nasty -- it changes at least one POKEY register practically every frame and so the RLE compression was ineffective. Delta compression wasn't quite enough to pull it down to 48K and some additional compact encodings were needed to bring it below that. Unfortunately, this means that the playback is a lot more than just copying 9 values to registers. These are the encoded sizes for all the tracks:


  • test.sap: $1000-1AB6 (2743 bytes) -- 1.72 bytes/frame, or 104 bytes/second
  • test2.sap: $1000-97D3 (34772 bytes) -- 4.23 bytes/frame, or 212 bytes/second
  • test3.sap: $1000-80A9 (28842 bytes) -- 4.75 bytes/frame, or 238 bytes/second
  • test4.sap: $1000-3A0D (10766 bytes) -- 3.01 bytes/frame, or 181 bytes/second
  • test5.sap: $1000-2FB6 (8119 bytes) -- 2.72 bytes/frame, or 136 bytes/second

Pattern-based compression to reuse sections would probably be more effective, but a lot more complex to encode.



  • Like 2
Link to comment
Share on other sites

But as I said. Native TYPE R is very unreliable. Ie, you can't attach raw data compressed without making changes in player itself.


But there is TYPE D present. Made mainly for songs with samples but also for some uncommon players like AMS or AMP.


Ivop made such a player (http://sourceforge.net/p/atari800/mailman/message/34458219/) which I've used to make SAP TYPE D from data obtained from latest beta of Altirra.


Attached two saps in zip. One from Supersynthesizer by KE-Soft ("Das Tor des Monats"), and second one is that Numen tune from compressed xex by Phareon (sorry, nothing "unnecessary" was ripped).


Should work on any of SAP players which support SAPs TYPE D.




Edited by miker
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...