Michael J. Mahon
Hobbies and Interests:
Digital Photography, Computers, Electronics, Sailing, and Flying
For many years I designed server systems for Hewlett-Packard—but for fun, Apple II's remain my all-time favorite computers! Some of my projects are described below.
DMS Drummer: A Percussion Sequencer for the Apple II
With inspiration and musical mentoring provided by Seth Sternberger of 8-Bit Weapon, I've impemented a percussion sequencer/synthesizer for the Apple II. It allows a user to create sequences as long as 255 patterns, where each pattern is one of a set of 16 musical measures. Within each of these patterns, any one of 8 percussive voices can be played at any 1/16th note boundary. In addition, the "pitch" for playing back the percussion sample can be specified, which is useful for pitched drums, for example, tom-toms.
Like RT.SYNTH (which Seth also offers as DMS Synthesizer) DMS Drummer uses the DAC522 5-bit 22kHz pulse-width-modulation wavetable synthesizer engine, driven by a sequencer that runs in real time. DAC522 represents "silence" as pairs of 6 cycle pulses spaced 46 cycles apart, regardless of whatever the code is doing--which subroutine it's calling or which branch path it's taking. Doing "general purpose" code while maintaining a constant stream of evenly spaced pulses is pretty tricky, but it must be done if the sequencer is to keep quiet except for the desired sounds.
Seth is offering the full version on his website for $15, but the demo version is free for you to play with! It is limited to 8 distinct programmable patterns and the Save function is disabled.
Listen to this sample, created by Seth, to hear the realistic rhythm line that an 8-bit Apple II can produce! The melody and bass lines are being played on RT.SYNTH, so the only non-Apple II-produced sounds are the "explosions" (which could also have been played by SOUND.EDITOR on an Apple II!).
Apple II Networking and Parallel Computing—NadaNet 3.1
Do you have more than one Apple II computer? Have you ever thought about what you could do if they were networked together? In the early 1990s I began thinking about this, and envisioned being able to send data easily from one machine to another and being able to run programs on other Apples while sitting at my main machine.
I knew that there were networking cards available for the Apple II machines, but they were all some combination of rare, expensive, or unsupported by software—and they were all designed to support the Apple II as a client machine, not as a full peer-to-peer network participant. And none of them was usable from BASIC, the premier Apple II language for experimentation and prototyping. So I considered how one might network Apple II computers using only the I/O capabilities built onto the main board, and wondered what might be done with such a network.
I have worked on this project over the intervening years, and the latest version, NadaNet 3.1, offers a new level of usability, reliability, and performance for experiments in Apple II networking, client-server computing, and parallel computing.
NadaNet 3.1 is now available for the Apple II platform. All related articles on this site have been updated to reflect the changes in version 3.1 if they are affected. Most changes are minor (like using the new &PEEKPOKE command to lock a control block on a remote machine instead of &PEEKINC).
The biggest change for me was updating the boot ROMs on the AppleCrate II to use the NadaNet 3.x message formats—that was like the electronic equivalent of brain surgery. Since it would be quite difficult to disassemble the AppleCrate II, the sixteen ROMs were replaced in situ, about four inches in from the edge of the board, and with the "neighbor" board only 3/4" above—talk about working in close quarters!
Fast Square Root Routine for Applesoft
After spending too long putting up with the terribly slow Applesoft SQR function, I finally decided to write a faster one. USR.SQR installs as a USR function and computes square roots more than nine times faster than SQR. If you have any Applesoft programs that take a lot of square roots, this can really make them fly!
AppleCrate II: A New Apple II-Based Parallel Computer
The 17-board AppleCrate II was first shown publicly at KansasFest 2008, and now it is documented here, along with some examples of what it can do—like play "When I'm 64" in 16-voice glory!
AppleCrate Polyphonic Music Synthesizer
I have developed a 16-voice polyphonic synthesizer
using the AppleCrate and a highly modified version of SOUND.EDITOR's DAC522.
For details, check out SYNTH documentation, the MIDI converter program, and source.
Here's a nice 8-voice example, a rendition of In My Life by The Beatles. It stretches the 8-processor AppleCrate I to its limits, since it actually would like to play ten voices simultaneously. I implemented a "scavenging" algorithm that reassigns the oscillator that has been playing a note the longest when I need an oscillator and all are busy. It usually works, but it occasionally overrides an audible note when a lot of notes are hit together (as you can hear in this piece if you listen closely). When the music is compiled for the AppleCrate II, with 16 oscillators available, no oscillator "stealing" is required.
Here is an earlier rendition of Eric Satie's Gymnopedie for your enjoyment.
NADA.PONG: A Graphic Demo of Apple II Network Gaming
At KansasFest 2007, in response to a challenging lunchtime question, I wrote a graphic demo of the use of NadaNet to support multi-Apple II gaming. It shows a simple Pong-like game animation with the "ball" (a bouncing Apple) being passed between machines via NadaNet. This demo won the HackFest contest that year! A short video of the demo is included for your amusement. ;-)
ProDOS File Server for NadaNet
In order to support more complex applications running on the AppleCrate, and to support a shared ProDOS file system for general NadaNet use, I have written a File Server. It can be accessed by any machine on the NadaNet, regardless of whether it is running ProDOS, DOS, or no OS at all. This provides a convenient way to gain access to common files as well as a way to publish large volumes of data to other machines on the network.
The file server handles the ProDOS BSAVE, BLOAD, BRUN, SAVE, RUN, CREATE, DELETE, LOCK, UNLOCK, RENAME, and VERIFY commands, with their parameters. There are also two supervisory commands: MON, to control monitoring of requests on the server’s display, and STATS, to read various statistical counters kept by the file server.
Sudoku Solver for the Apple II
Scott Hemphill and I collaborated to create a Sudoku puzzle solver for Apple II computers. The machine language solver is Scott's, with some adaptations by me, and I wrote the interactive Applesoft front-end.
SUDOKU v2.0 now runs on any 64KB or larger Apple II with lower case and Applesoft BASIC.
It is amazingly fast! Many Sudoku solvers run on modern PCs thousands of times faster than a 1MHz Apple II, and take seconds to solve a puzzle, but Scott's solver is so time- and space-efficient that it solves puzzles in seconds running on an Apple II!
Click here to read about and download the Sudoku Solver.
Apple II Single-Voice Real-Time Synthesizer
Based on SOUND.EDITOR's DAC522 playback routine, I wrote a single-voice wavetable synthesizer for Apple II
machines that can be played in real-time from the Apple keyboard. It can be run on any Apple //e, Apple IIc
(or IIc+), or Apple IIgs, and permits not only real-time performance using user-selected
instrument sounds, but recording and playback of performances.
For all the details, check out RT.SYNTH documentation and downloads.
In 1993, I decided to push the limits to discover what could be done with
sound on an 8-bit Apple II. I was eventually able to achieve excellent sound
quality without the distortion and "screech" typical of SoftDAC sound players.
SOUND.EDITOR uses DAC522 for its conversion, which operates at a sample rate
of 11.025kHz, and converts with 5-bit precision and 22.05kHz oversampling,
so that the "carrier" is ultrasonic (for most people ;-).
If you have any 64KB, lower-case-capable Apple ][ with Applesoft BASIC, you can try it out by downloading my Sound Editor v2.2. I guarantee that you will be amazed at the sound reproduction quality. In fact, you really need headphones or an external speaker to do it justice.
Here is a .zip file containing assembler listings of Sound Editor's 2:1 ADPCM sound compression/decompression routines.
Early (1981) Hex Dump Reader
In the old days, some programs were entered by typing in hex listings from magazines.
Then the problem was verifying that what you typed was what was in the listing. The
obvious way to do this was to display a hex dump of what you had typed, the compare
it, line for line, with the printed listing in the magazine. As you can imagine, this
verification step is very error-prone in itself, and quite mind-numbing.
It is possible to do much better if you can recruit someone else to read either the screen display or the magazine listing, so that you can compare what you hear to what you see, without constantly shifting your attention from one listing to another. This was my approach, with my wife as the "willing" volunteer, until it became clear that after ten minutes or so, it was no longer "quality time" spent together. ;-)
So my solution was to write a program to read back the hex dump of Apple memory, which I could then easily compare to the printed listing.
I first wrote a short machine language program to digitize sound (to 1-bit precision) at the cassette input for later playback through the speaker. I recorded the hex digits: "One, Two, Three,..., Able, Baker, Charlie, Dog, Easy, Fox". I then used an Applesoft program with game paddles to locate the beginning and end of each spoken digit in memory, and used that info to create a table with an entry for each hex digit. The rest was easy.
In the process of going through my old data cassettes, I found this program and am putting it online for nostalgia's sake. The program in unusual in two ways: 1) it is tricky to modify, since its ending address has been extended manually to include the digitized voice table, and 2) it contains all the code that was used in its development, including the voice digitization and exploration. Just RUN the program READ.HEX.DUMP and enjoy a blast from the past!
Click here to download a ShrinkIt archive of the Hex Dump Reader.
A note on "1-bit speech":
1-bit, or "infinitely clipped", or "fuzzed" speech sounds pretty harsh to most people, but it is quite familiar to most amateur radio operators. It is common practice to severely compress a speech signal (and then limit its bandwidth to 3.5kHz) before using it to modulate a transmitter, so that the effective energy of the speech modulation is as high as possible. This effectively clips the speech into a 1-bit audio signal. (A similar but more linear compression is used to increase the volume of commercials in broadcast programs. ;-)
Early (1981) N-Body Gravitational Simulation
Here is another fun program I wrote in my cassette days—an N-body gravitational simulation with hi-res plotting of the orbits. And here is a cheat sheet to its controls. It is unusual in that it allows the user to choose a display "point of view" from any of the bodies or from the system's center of mass.
Apple I Integer BASIC Disassembly
Here is a disassembly of
Apple I Integer BASIC done on an Apple II. I've attempted to correct some of the typos in the
listing, as noted.
Here's a fun source for electronic books!
You can email me by clicking here.
Last updated on May 28, 2014.Page visits since July 12, 2004: