Play "Binary Time constant" Sound on the Apple II
Go to file
2020-05-09 22:42:52 +02:00
LICENSE Added LICENSE. 2020-05-09 22:42:52 +02:00
play-btc.cfg Initial commit 2018-08-10 01:39:54 +02:00
play-btc.dsk Added sample disk image. 2018-08-10 15:19:53 +02:00
play-btc.s Made player interface more explicit. 2018-08-12 12:21:10 +02:00
README.md Added reference to 'White Christmas - a yuletide log' 2018-12-23 23:31:24 +01:00
sound.btc Initial commit 2018-08-10 01:39:54 +02:00

Play-BTc

Play "Binary Time constant" Sound on the Apple II

The BTc Sound Compression Algorithm is decribed on https://www.romanblack.com/btc_alg.htm. On https://www.romanblack.com/picsound.htm there's the BTc Sound Encoder 3.0.

Play-BTc plays .btc files created by the BTc Sound Encoder on the Apple II. However, certain settings in the BTc Sound Encoder are necessary:

  • The Algorithm needs to be set to 1 bit.
  • The Frequency needs to be 33000Hz (use Resample .WAV if necessary).
  • The number of Samples mustn't exeed 362500 (use Trim .WAV if necessary).

To built Play-BTc:

  • Get cc65
  • Enter cl65 -C play-btc.cfg play-btc.s

To run Play-BTc:

  • Put play-btc on a ProDOS disk as the BIN file PLAY.BTC with start address $800
  • Put path_to_cc65/target/apple2/util/loader.system on the ProDOS disk as the SYS file PLAY.BTC.SYSTEM
  • Run PLAY.BTC.SYSTEM

The player loop is based on cycle counting. The slowest loop variant is when the reader needs to switch from the current memory page to the next. 31 cycles is the fastest I could come up with for that variant. The two other variants (just using the next bit from the current byte, reading the next byte from the current page) are padded with unnecessary operations to use 31 cycles too. Given the CPU freqency of a stock Apple II these 31 cycles lead to the 33kHz.

To play .btc files in your own Apple II program:

  • Generate a .btc with the BTc Sound Encoder with Algorithm set to 1 bit, the Frequency set to 33000Hz and the number of Samples being a multiple of 2048.

  • Place the content of the .btc file in the Apple II memory starting on a page boundary in one way or another.

  • Place the BTc player core in the Apple II memory. The player core source code deliberately doesn't make use of any advanced assembler features and should therefore assemble with any assembler (maybe with trivial adjustments).

  • Replace the visual feedback with two nop operations.

  • Call the BTc player core with:

    • A set to the high byte of the memory address you placed the .btc file content on
    • X set to the number of samples divided by 2048

The BTc player was used for White Christmas - a yuletide log.