dos33fsprogs/pt3_player
2019-05-16 19:49:26 -04:00
..
docs pt3: update documentation 2019-05-15 12:21:39 -04:00
music pt3: add some music 2019-05-16 19:49:26 -04:00
visual pt3: visualization concepts 2019-05-16 00:58:36 -04:00
dump.bas pt3: add early-pattern end code 2019-05-14 11:52:50 -04:00
empty.dsk pt3: add initial pt3_player 2019-05-06 20:16:45 -04:00
fire.s pt3: more self modifying code 2019-05-16 14:58:13 -04:00
gr_fast_clear.s pt3: start implementing things 2019-05-07 00:28:42 -04:00
gr_offsets.s pt3: some work on visualization 2019-05-16 11:38:57 -04:00
gr_putsprite.s pt3: wasted lots of time on this visualization 2019-05-16 16:37:14 -04:00
gr_setpage.s pt3: some work on visualization 2019-05-16 11:38:57 -04:00
HELLO pt3: start implementing things 2019-05-07 00:28:42 -04:00
hello_debug.bas pt3: split off separate player/debug disk 2019-05-15 15:06:41 -04:00
hello.bas pt3: bump the version and release a disk image 2019-05-16 16:56:14 -04:00
interrupt_handler.s pt3_player: pause stops the flame 2019-05-16 16:42:01 -04:00
keypress_minimal.s pt3: some work on visualization 2019-05-16 11:38:57 -04:00
Makefile pt3: add some music 2019-05-16 19:49:26 -04:00
mockingboard_a.s pt3: add a timer module for tracking overhead 2019-05-15 11:55:43 -04:00
pageflip.s pt3: visualize: we have fire 2019-05-16 13:03:33 -04:00
pt3_dumper.s pt3: add early-pattern end code 2019-05-14 11:52:50 -04:00
pt3_lib.s pt3: player supports multiple songs now 2019-05-15 14:13:54 -04:00
pt3_player.dsk pt3: bump the version and release a disk image 2019-05-16 16:56:14 -04:00
pt3_player.s pt3: add some music 2019-05-16 19:49:26 -04:00
pt3_timer.s pt3: add a timer module for tracking overhead 2019-05-15 11:55:43 -04:00
put_letters.s pt3: wasted lots of time on this visualization 2019-05-16 16:37:14 -04:00
qkumba_rts.s pt3: start implementing things 2019-05-07 00:28:42 -04:00
random16.s pt3: visualize: we have fire 2019-05-16 13:03:33 -04:00
README.pt3_player pt3: update README 2019-05-15 15:25:18 -04:00
song_list.inc pt3: add some music 2019-05-16 19:49:26 -04:00
text_print.s pt3: add initial pt3_player 2019-05-06 20:16:45 -04:00
TODO pt3: more inner loop optimizations 2019-05-16 14:45:25 -04:00
zp.inc pt3: wasted lots of time on this visualization 2019-05-16 16:37:14 -04:00

The PT3_player
~~~~~~~~~~~~~~

	by Vince "Deater" Weaver
	15 May 2019
	http://www.deater.net/weave/vmwprod/pt3_player/

	Plays Vortex Tracker II .pt3 files on the Apple II


Background
~~~~~~~~~~
	Vortex Tracker is commonly used to create AY-3-8910 music for the
	ZX Spectrum and Atari ST systems.  A large number of great pt3 files
	can be found on the internet.

	There are many benefits to using .pt3 format, but until now there
	was no player available for Apple II/6502.  (Though some people
	had been playing the files using a z80-card in their system).
	Part of the challenge was the documentation for the format was
	in Russian, and the only source-code available for .pt3
	players were in uncommented z80 assembly or else Russian-commented
	Pascal.

	Why .pt3?  Why not play YM5 files?
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	There are already many projects (including one of my own) for
	playing the .YM file format, which is much simpler.  It is just a
	series of AY-3-8910 raw-register dumps which can quickly be sent
	to the Mockingboard.

	The issue is uncompressed YM5 files are really huge.  So you have to
	do some sort of decompression on the fly, and even then you are looking
	at 32k+ or more of RAM.  This might be fine on an Apple IIe with
	128k of RAM, but I am targetting a II+ where I don't have that much
	available.

	A PT3 file is a tracker format, meaning a list of notes, patterns, and
	ornaments and can be played in place.  Once you load the music file and
	the player, no additional RAM is needed at all.  It does take more CPU
	than playing a YM5 file.


Using the PT3_PLAYER
~~~~~~~~~~~~~~~~~~~~

	The pt3_player.dsk should boot automatically.

	Use the right/left arrow keys to switch songs.
	Press the space bar to pause playback.

	FUTURE FEATURES:
		Key to disable visualization
		Key to skip ahead/back in pattern list
		L to enable looping in the song

Known Bugs:
~~~~~~~~~~~
	Will try to display lowecase names on a II/II+

	ZX Spectrum songs expect a 1.77MHz AY-3-8910, but
		the Apple II is 1MHz so song are higher(?) pitched

Adding other files
~~~~~~~~~~~~~~~~~~

	Unlike YM5 players which require complicated preparation of files
	(with often complex, or hard-to find tools) the PT3_PLAYER can in
	theory play plain .pt3 files.

	To get the player to play them, just rename them to fit the naming
	scheme (I think it will just be 00.PT3, 01.PT3, 02.PT3) and replace
	the existing files on the disk image with your favorite Apple II
	disk tool.


Code Optimization
~~~~~~~~~~~~~~~~~

	The original working code is about 4k (not counting the pt3 file)
	and has an overhead of roughly 20% when playing a song interrupt-driven
	at 50Hz.

	I'm keeping some stats here as I try to optimize the size and speed.

	Song: "Summer of Rain"
	~~~~~~~~~~~~~~~~~~~~~~
					lz4 compressed
	pt3 size:	raw size:	ym5 size:	pt3.lz4:
	3871		137015		7637		1793

	Decoder Type	size	ZP use	decode	total	CPU overhead
	-------------------------------------------------------------
	Original	4k(?)	22B	28.16s	171s	16%


Random Programming Reminders
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ASR = CMP #$80 / ROR

signed 8-bit comparison
see http://6502.org/tutorials/compare_beyond.html#2.2

          SEC       ; prepare carry for SBC
          SBC NUM   ; A-NUM
          BVC LABEL ; if V is 0, N eor V = N, otherwise N eor V = N eor 1
          EOR #$80  ; A = A eor $80, and N = N eor 1
    LABEL

If the N flag is 1, then A (signed) < NUM (signed) and BMI will branch
If the N flag is 0, then A (signed) >= NUM (signed) and BPL will branch