Playing pt3 files generated by the
Vortex Tracker on an Apple II with Mockingboard.
Details
This is an attempt to play some complex chiptune files on an old Apple II
with a Mockingboard card.
The Mockingboard, introduced around 1981, was a sound card for the Apple II
series of computers. It has dual AY-3-8910 chips on it, providing a total
of 6 channels of square-wave sound, plus noise and envelope effects.
My previous Chiptune Player played YM5 files,
which are raw captures of the AY-3-8910 data stream. These are easy to play,
but the raw data takes up a huge amount of space (hundreds of kilobytes)
when uncompressed. The chiptune player did some clever tricks with LZ4
compression to make things fit, but in the end most of the 48k of RAM on
an Apple II+ was needed to hold the ym5 file and decompressed register
values.
This is coded in 6502 assembly language. And unlike my previous player,
you can drop properly named files onto the disk image and they should
play w/o any additional conversion.
Some technical details on the pt3 file format can be found here:
README_pt3.txt
Some more info on the player itself can be found here:
README.pt3_player
Where did I find these chiptune files? A lot come from
ZX Art
Development Log
28 December 2019
Updated version 1.4 which can auto-detect what slot the Mockingboard is in.
21 December 2019
Updated new version 1.3, think I finally fixed the glitchy audio issue
(was a problem with holding write signal too long).
11 September 2019
Fixed an issue with portamento. Also the four frequency tables are
all properly generated, at run-time. This makes the code a bit larger
but it also runs slightly faster.
Released version 1.2
31 August 2019
Fixed an issue where vibrato was being calculated wrong.
Released version 1.1
9 June 2019
More crazy optimization. qkumba turned many of the vars into self-modified
code, and I moved the player to using a large chunk (120 bytes) of the zero
page. The player now has an overhead of 15% on the benchmark file.
7 June 2019
Released v0.8. Some bugfixes to both the player code and also the sound
output. Many optimizations from qkumba. Should also now run
properly on an Apple IIc.
Also now the code includes a separate "pt3_lib" directory with stripped
down code that can more easily be dropped into your own project.
5 June 2019
Some more optimization, we have the code size down to 2.75k.
2 June 2019
Version 0.7 released. Fixed some minor bugs introduced by qkumba's
optimizations.
30 May 2019
Version 0.5 released. Qkumba went through and made many, many
optimizations.
22 May 2019
Working on auto-generating some of the lookup tables in order to
save some space. Involved trying to figure out what the impressively
dense (and uncommented) z80 code does. I have it working, even though
I only 50% understand what the original code is doing.
Doing this properly involves writing a lot more test harnesses than you
would expect, only to save a few hundred bytes.
17 May 2019
Released v0.4 which has some speedups, supports looping.
17 May 2019 (early am)
Converting sound from 1.7MHz (ZX Spectrum) to 1MHz (Apple II) now.
A bit of a pain, but we can multiply by 9/16th which is doable on the 6502.
Also we uppercase the author/title info on the II/II+ now.
16 May 2019
Wasted some time on visualization, and optimizing said visualization.
Does the
PSX Doom-style
fire effect. You can't easily tell, but the
height of the fire on each 3rd of the screen corresponds to the volume
of that channel in the song.
14 May 2019
Finally got things working. Validated on a few songs.
Have some video of the proof of concept here. It's loading the
player into HGR RAM so you can see the data structures change while
it's playing. The BASIC loader just sets the background to purple
before running, as it looks mildly better that way. Total song time is
added up at the beginning because (as far as I know) there's no way
to tell total song time without stepping through every pattern and
counting.
13 May 2019
Finally have the 6502 assembly version decoding the first 8 frames of
EA.pt3 properly.
Still stops after the first note. Am going to redirect the register dump
out PR#1 (the printer port) to do some more debugging.
As an aside, signed 8-bit compares are a pain on the 6502. It probably
means my 16-bit signed compares are broken too.
11 May 2019
Progressing on the 6502 version. It's not working, but it fails in an
interesting way.