2018-06-05 05:12:15 +00:00
|
|
|
Still Alive for the Apple II
|
2018-09-04 16:16:24 +00:00
|
|
|
in roughly 16k
|
2018-06-05 05:12:15 +00:00
|
|
|
|
|
|
|
By Deater (Vince Weaver)
|
2018-09-04 16:16:24 +00:00
|
|
|
vince@deater.net
|
2018-06-05 05:12:15 +00:00
|
|
|
|
|
|
|
BACKGROUND
|
|
|
|
~~~~~~~~~~
|
|
|
|
A few years back I implemented Valve's Portal in Applesoft BASIC.
|
|
|
|
|
|
|
|
At the end it played Still Alive, but in horrible single-channel
|
|
|
|
speaker beeps. I always wanted to have this sound better.
|
|
|
|
|
|
|
|
So here is the end result. Still Alive in 6-Channel Mockingboard
|
|
|
|
Sound in 80 column with cursor effects. Also in 40 column if
|
|
|
|
your display can't handle 80 cols. And if you don't have a
|
|
|
|
Mockingboard, then a simpler version using P. Lutus'
|
|
|
|
Electric Duet 2-channel audio for the stock speaker.
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-24 15:59:07 +00:00
|
|
|
Fun fact:
|
|
|
|
The letter 'Z' does not appear at all in the lyrics to the song.
|
|
|
|
(Noticed when I had to edge comparison for uppercase off by one)
|
|
|
|
|
2018-05-23 15:59:56 +00:00
|
|
|
Challenges:
|
2018-06-05 05:12:15 +00:00
|
|
|
+ 6-channel audio. Really its 4-channel (from a MOD file)
|
|
|
|
but it actually does load and play audio on all 6 channels.
|
2018-05-23 15:59:56 +00:00
|
|
|
+ Fitting it all in 48k (want to avoid disk routines if can)
|
2018-06-05 05:12:15 +00:00
|
|
|
+ Printing the ASCII art (naive implementation takes longer than 50Hz)
|
|
|
|
The ASCII art is roughly 7k. Thought of decompressing
|
|
|
|
on the fly, but the LZ4 code is not re-entrant and
|
|
|
|
the music is already decompressing on the fly.
|
|
|
|
+ Re-using the Lyrics for both the Mockingboard and Electric Duet
|
|
|
|
versions.
|
2018-06-05 19:31:34 +00:00
|
|
|
+ Squeezing the compressed image into memory leaving room for
|
|
|
|
all the code to be decompressed while leaving enough
|
|
|
|
room that DOS still has room to load things. It's
|
|
|
|
an *extremely* tight fit.
|
|
|
|
+ An odd issue where the 80col display would get corrupted
|
|
|
|
if we set HIRES without explicitly setting LORES
|
|
|
|
before doing PR#3
|
2018-05-23 20:09:44 +00:00
|
|
|
|
2018-05-23 15:59:56 +00:00
|
|
|
|
2018-05-23 18:07:19 +00:00
|
|
|
Goal: Binary fits in 16k (16384 bytes)
|
2018-05-23 15:59:56 +00:00
|
|
|
|
2018-05-23 18:07:19 +00:00
|
|
|
note size (bytes)
|
|
|
|
--------------------- ------
|
2018-05-23 16:50:12 +00:00
|
|
|
initial music player: 2078
|
|
|
|
add raw ascii art: 9142
|
|
|
|
add 3-channel music+lyrics,then slim a bit: 18787
|
|
|
|
initial 40 col support: 18864
|
2018-05-23 18:07:19 +00:00
|
|
|
have art loading properly 40col: 18910
|
2018-05-23 20:04:27 +00:00
|
|
|
lz4 encode the ascii art: 15529
|
|
|
|
revert because lz4 code not re-entrant: 18910
|
2018-05-24 03:49:18 +00:00
|
|
|
add 4-channel music (KR4): 20128
|
2018-06-05 17:21:36 +00:00
|
|
|
add cursor (a bit distracting): 20162
|
2018-05-24 16:42:27 +00:00
|
|
|
feature complete 40 col: 20180
|
|
|
|
intial 80 col support: 20191
|
2018-05-24 18:40:21 +00:00
|
|
|
80 col cursor: 20344
|
2018-05-24 18:47:49 +00:00
|
|
|
strip out some unneeded text printing: 19962
|
2018-06-05 17:21:36 +00:00
|
|
|
merge ED and MB code: 24993
|
2018-06-04 19:26:03 +00:00
|
|
|
properly select between versions: 25001
|
2018-06-04 20:46:32 +00:00
|
|
|
merge the ED and MB lyrics: 22828
|
2018-06-05 17:21:36 +00:00
|
|
|
80 column ED, wait for keypress+reboot at end: 22852
|
2018-06-05 19:31:34 +00:00
|
|
|
Crazy compression:
|
|
|
|
Remove mockingboard detection: 16343
|
2018-05-22 03:46:47 +00:00
|
|
|
|
2018-06-05 05:12:15 +00:00
|
|
|
Memory Map:
|
2018-05-22 03:46:47 +00:00
|
|
|
|
|
|
|
|
2018-05-24 21:01:42 +00:00
|
|
|
|
|
|
|
0000: Zero Page
|
|
|
|
0100: Stack
|
|
|
|
0400: Text Page 0 (AUX 0400: 80 column text)
|
|
|
|
|
|
|
|
2000: HGR Page0
|
2018-06-01 04:46:54 +00:00
|
|
|
4000: HGR Page1
|
2018-05-24 21:01:42 +00:00
|
|
|
9600: DOS 37.5k
|
|
|
|
C000: I/O Space
|
|
|
|
D000: ROM
|
|
|
|
FFFF: END
|
|
|
|
|
|
|
|
|
|
|
|
Plan:
|
2018-06-05 19:31:34 +00:00
|
|
|
Load compressed 16k image ($4000) at $5900 - $9900
|
|
|
|
We use MAXFILES 1 to give us some extra room
|
|
|
|
just before DOS
|
|
|
|
|
2018-06-05 05:12:15 +00:00
|
|
|
Decompress ENDING sequence at $1800 - $4000
|
2018-06-05 17:21:36 +00:00
|
|
|
(writes background to HGR graphics automatically)
|
2018-06-05 19:31:34 +00:00
|
|
|
|
|
|
|
STILL_ALIVE:
|
|
|
|
+ $0800 - $5900
|
|
|
|
$2e2d of code
|
|
|
|
$2282 of KR4 music *or*
|
|
|
|
$0842 of ED music
|
2018-06-05 17:21:36 +00:00
|
|
|
+ Sound buffers ($3800, 14k) at $5e00 - $9600
|
2018-06-05 19:31:34 +00:00
|
|
|
|