Can the improved ACI load 4KByte Apple BASIC in 2 seconds ?

5 posts / 0 new
Last post
Last seen: 19 hours 30 min ago
Joined: Apr 1 2020 - 16:46
Posts: 885
Can the improved ACI load 4KByte Apple BASIC in 2 seconds ?


Or: Uncle Bernie's Year 2022 April Fool's Day trick (or treat ?)


As the tradition goes, your "Uncle Bernie" takes the opportunity presented by 1st of April to present something dubious which may or may not work. So I pulled an old long dead lab rat out of the garbage pile in my lab and here it is (see the zipped AIFF files, above, at the beginning of this post).


Theoretically, this AIFF file should allow you to load Apple BASIC in only two seconds.


Two seconds to load a 4 kByte BASIC interpreter ?


Well, not quite. There is still more overhead due to the inevitable "header tone" required by the ACI firmware as written by Woz back in the year 1976. After the header there is the so-called "TURBO LOADER". Named as such because we are trying to turbocharge the ACI. This 'turbo' loader is at regular ACI speed, but it is very short. After that there is the BASIC code, which takes just 2 seconds of the AIFF file. You can't hear much of this part except for a high pitched hiss, because most of it is outside of the human hearing range. (I wonder why they make sound cards with such an excessive frequency range, but maybe these sound cards were designed for ... dogs ? Woof ! Woof !)


Now, so far the theory. Why this lab rat died a while ago is because I never was able to make it work on all my machines. Now lacking anything presentable for my April 1st hoax I just pulled out out again, and gave it to you for free to try out how it tastes (Yuck !). I mean: how it works. Or not.


This is what you need:


1. An Apple-1 (of course !)


2. An improved ACI card with activated "extended format PROMs" (I know of three people in the world who have that, despite the "extended format" PROMs were standard issue in my kits since Summer last year)


3. A good media player which can do 96000 samples/second


Theoretically, if the sound card only supports 48000 samples/second (DVD audio speed) then it should be able to downsample the contents of the AIFF to that rate. But who knows what the designers have put in. Part of this experiment is to find out if 96000 samples/sec are OK or if I would need to go back to 48000 samples/sec - which means some more complications with fine tweaking the timing.


A big issue and open question is the nature of the output filter of your media player. All of them have digital and analog filters. These distort the high speed signals and so the whole thing might fail and never work, depending on the nature of these filters, which is unknown to me. Otherwise I could compensate at least for some of the ill effects of the filters on this high speed data. The high speed signals used for the 'turbo' loader are really pushing the limits of the hardware - not of the ancient Apple-1 hardware, mind you ! The old ACI on the Apple-1 could go faster, maybe twice as fast, but actually it's the limits of the 21st Century media player hardware which gets pushed.


This is your chance to bring this project back to life: you just try it out and tell us all how it goes, here in this thread. State type of media player and if it did work or not, and what you saw and what happened.




1. Download the compressed AIFF files at the beginning of this post, the .zip for the Windows world (yuck !) and the .gz for the Linux world.


2. Decompress these files. Make sure they end with ".AIFF". 


3. Get the media player ready to play the AIFF file at the touch of a button (or mouse click). Forget the Windows 7 media player, it is useless. If you listen to it, you can hear the dropouts it should not make. At least this is what I hear on my machine. On Windows 7 I used the free AUDACITY media player/recorder/editor to play the AIFF file, and this worked. 


4. On the Apple-1 equipped with the "improved ACI" enter the following commands:


C500R <return>


RX <return>


5. Count one-two-three (same delay as when "cooking off" a hand grenade) and then start the media player.


Unlike the hand grenade, the ACI won't kill you if you miscount / mistime. But if you don't get the delay right, the load may fail. I have shortened the "header tone" to ~4 seconds (from the usual 10 seconds) so you need to add the 3 seconds ("one-two-three") by using the above procedure. If you did not serve in the military, but learned to play a musical instrument, the "one-two-three" for musicians has the same speed and rhythm as for the soldier, except the latter counts silently. 


If you did not serve in the military, and can't play an instrument, you are handicapped and need to try out how to get 3 seconds of delay right. Hint: you need three arms to do it with a stopwatch, so this method is useless, unless you are an alien from outer space having three arms, don't try that. 


And regardless of your training / background, don't argue with me about the shortened header tone. The 96 kSample/s AIFF file is already excessively large, and I don't want to double it in size, which would happen with a 10 sec header tone, which carries no information and is quite useless with a media player. It did have some merits for the cassette recorders of 50 years ago, but 10 seconds ? Poor design decision, Woz.


This is what to expect:


The recording should load and after ~4 seconds into the load you should get a "!" prompt indicating that the turbo loader has acquired sync and has started to load the BASIC, which takes 2 seconds more.


If you then get a "?" and the Wozmon prompt, then there was a checksum error, and the load did fail.

Otherwise the BASIC will automatically start and you will see the ">" prompt of the BASIC.

If anything hangs, use the RESET key, and try another volume setting (typically, louder).


As far as I'm concerned, I get a successful load each and every time, using the media player of Linux Mint on an old (vintage 2011) Acer Aspire One 722 subnotebook. It also works on the same notebook on Windows 7 if AUDACITY is used to play the AIFF. So the whole concept works for me, for this specific signal source. I dont't have any other media players. Only real cassette recorders which are unfit for these fast signals and recording densities.


I wonder how the expensive iPods and iPhones etc. work with this. If they don't, you paid too much !

Nowadays every premium priced media player should be able to play 96 kSample/sec audio files !


Oh, and don't try to convert the AIFF into some lossy audio file like MP3. This won't work. If you study the signals with the built-in waveform viewer of AUDACITY, or a similar tool, you can see that I'm really pushing the limits and there already are a lot of timing tricks involved. For instance, unlike Woz does it in the original ACI firmware, I correct "extra work" for the 6502 in the audio file timing, and not on the 6502 side.


Good luck !

Comments invited !


In particular, I would like to get feedback which media players puke and can't do the 96000 samples/sec and which can.



Last seen: 9 hours 22 min ago
Joined: Feb 27 2021 - 18:59
Posts: 498

1. The reason for audio dac running at 96k samples/s isn't for dogs' hearing, but because dac output needs to use anti-aliasing filters to remove aliasing above f/2. Pushing up f/2 means that the distortion from this filter can be further from the audible band. Back in 1970s the distortion from brick wall filter at 22kHz was judged to be acceptable, but it causes enough phase error to destroy full stereo imaging. The only way out is to either increase f/2, or use a filter with more gradual roll-off attenuating high pitch sounds.


2. A periodic tone of any length can be encoded in a very small data block using AIFC (AIFF with compression). So the "header tone" of any required duration does not need to bloat the audio file.

Macintosh_nik's picture
Last seen: 14 hours 36 min ago
Joined: Jan 8 2021 - 05:18
Posts: 427
Hi Uncle Bernie!
I tried your "TurboBasic" on my old and faithful 2010 MSI laptop (Windows 7) and VLC media player and it worked almost immediately. But not in 2 seconds, but in 6 (that's how long your audio file lasts. But it's still much faster than normal Basic (33 sec). I downloaded Audacity media player, but for some reason it didn't install, lacking some libraries or something like that. So thanks, great job, I will use it now!
Last seen: 19 hours 30 min ago
Joined: Apr 1 2020 - 16:46
Posts: 885
In post #3, macintosh_nik

In post #3, macintosh_nik wrote:


".... it worked almost immediately. But not in 2 seconds, but in 6 ..."


Uncle Bernie answers:


Thanks for giving it a try ! It was worth your effort because now you can load BASIC much much quicker !

As for the "6 seconds" ... true. This is how long the AIFF file runs. But as I have explained in my post #1, the BASIC itself is only 2 seconds long. The rest is overhead for the header tone, and the turbo loader, but the turbo loader is very small, so the culprit is the header tone. I could shorten the header tone further and make the user count more seconds because the Woz ACI code will not even look at the TAPE IN for the first 4 seconds or so. Which is a waste. But if I shorten the header tone too much then more people will get difficulty with getting a successful load, me included, after a few glasses of Famous Grouse Whisky. So I think the current compromise is OK.


As for Robespierres comment in post #2, of course I know everything about the conundrum of brick wall antiimage filters (on the output side after a DAC we always called them "antiimage" while in front of an ADC they were called "antialiasing" filters).


The thing with the dogs was a joke of mine, of course, it's an April fool's day post, did you really expect I was serious about the dogs ?

It was just a joke !


As far as I am concerned, at my age, I can only hear up to 10 kHz and then ... nothing. When I was young I was able to hear up to 16 kHz because I could hear the annoying whine of the horizontal deflection system of TVs. Now ... silence. So we could make the point that for most people, a 96 kSample/sec soundcard is overkill. But we can use it for Apple-1 turboloads ;-)


Comments invited !

Last seen: 1 year 11 months ago
Joined: May 20 2022 - 07:01
Posts: 1
It worked for me!!!

Hi Uncle Bernie, I tried your "TURBO LOADER" and worked for me at first attempt.

The ACI interface has been assembled with your recommended improvements.

I have been using an Android smartphone Xiaomi Redmi Note 7 and playing AIFF sound file with “Solid Explorer File Manager” application and its built-in media player.


Log in or register to post comments