UNCLE BERNIE'S IMPROVED APPLE-1 CASSETTE INTERFACE

4 posts / 0 new
Last post
Offline
Last seen: 6 days 7 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 201
UNCLE BERNIE'S IMPROVED APPLE-1 CASSETTE INTERFACE

You probably expected already that something like this must be coming, after you followed me on the bumpy road that lead to this - at the present time -  "final" result of my work on improving the notorious Apple-1 cassette interface, as documented in this thread spanning many months:

 

https://www.applefritter.com/content/which-aci-improvements-do-exist-and-work

 

This new thread is meant for those of you who are not interested in how all this came about, and was developed, but only in the final result, the recipe on how to modify your ACI to get improved functionality and to activate the hidden page in my new ACI PROMs (which have been sold with my more recent IC Kits since early July 2020).

 

The mod addresses three shortcomings of the the original ACI circuit design and its firmware:

 

1) it fixes the volume indicator LED circuit (which in the original form almost never works).

 

2) it adds Apple-II style checksums to the recordings so you can read / write tapes with either Apple-1 or Apple-II and use the same recordings on both machines.

 

3) it adds an "extended" formatting capability to the recordings to make them less awkward to read back.

 

The latter is based on a proprietary format which I had developed a few months ago in my "improved ACI project".This proprietary format is fully forward and backwards compatible with both Apple-1 and Apple-II even if those are unmodified. But if you use my new ACI PROMs on an ACI card modified for them, you don't need to remember or type in any load address ranges or start addresses. All this information is embedded in the "extended format" recordings. So, for instance, if you have made an extended format recording of a machine language game that consists of one data block and one autostart block, to load it, you just give the commands:

 

C500R <return>

RX RX <return>

 

... and the game loads and starts. There is one RX for each block. The number of blocks is all you need to know. The C500R starts the second page in the PROMs which I have added. The first page still contains the original ACI firmware written by Woz back in 1976 (used with his permission). So with the mod you lose nothing. The original, unmodified firmware can be started with the command C100R as usual. This is a bit different from the 512 Bytes PROMs I had developed a few months ago. They were a complete re-write and also had a CRC (cyclic redundancy check) capability. They also know about the number of blocks in a record - only one RX command needed. But they would not work at all in an unmodified ACI card. Which would mean I could not sell those with my famous 100% tested and burned in IC kits on Ebay. Buyers expect to have the real deal, the real firmware as written by Woz. And I agree with that attitude. So when I ran out of 256x4 PROMs and sought a good use for the 2nd page of 512x4 PROMs, I decided to make a stripped down version of my "extended ACI" firmware PROMs to avoid wasting this 2nd page. A few functions had to be thrown out, but finally I could make it fit. This is not a "crippled" version, though. The "extended" format it makes is the real thing but the CRC fields are marked to be invalid and the block count is not used on readback. Everything else is still there, and everything stays forwards and backwards compatible.

 

In the following I will show you how to modify any ACI card to fix the volume indicator LED circuit and to enable the hidden page in my new ACI PROMs. You can implement both or only one of these two mods. My recent kits also include all the small passive components to fully populate an ACI card (except the IC sockets) so I ordered two ACI cards from "Pinguoso" on Ebay ($10 each, great price !) and used one of my parts bags to build a new ACI with the mods from scratch. This of course also was a test to see if everything would work for builders - my older ACI cards are "lab rats" with so many modifications that they don't qualify for that and could not be used to make nice photos of them.

 

Step 1: One cut on the component side (this is for the volume indicator LED circuit fix):

 

 

The best way to cut these traces is to use one of these diamond tipped, battery driven etching pencils you can find at Harbor Fright (pun intended) and elsewhere. You can also use a X-acto knive to cut out a piece of the PCB trace, but I found the etching pencil works much, much more precisely and never cuts too deep - because it does not cut - it's a grinding process.

 

 

Step 2: Three cuts on the solder side (this is to enable the hidden PROM page):

 

 

Note the read arrow. On some ACI PCBs not based on the Russian Open Source Gerbers there is a trace at that location that duplicates the component side trace we just have cut in Step 1. If such a trace is there, it also needs to be cut.

 

 

Step 3: Populate the PCB as usual. Be aware of the option to hide the added 1nF capacitor for the volume indicator LED circuit fix in the IC socket, if it is the kind with precision machined contacts. This requires good fine motor skills and a very precise soldering technique. If you can't do that, you can always put the capacitor on the solder side of the PCB. It just is an eyesore there, see the photo in the above thread, post #13. But yet another alternative is to use a small 1nF SMD capacitor (the "bird feed" type), if you have those, in lieu of the disk capacitor. I chose to hide the latter in the IC socket: I snipped off the pin#9 of the DIL-14 socket just at the point where it gets skinny (this avoids damaging the internal contact fingers, do not snip any further). Then I soldered one leg of the capacitor to the stump of that pin and then I ground it down, again with this marvelous diamond tipped etching pen (but be careful -- only remove the solder bead, and once copper is visible, stop immediately). This procedure increases the clearance of the stump to the PCB, such that a thin insulated wire can go through the pin #9 pad hole of the PCB location #2 into which the pin would go had we not snipped it off. That thin wire is soldered to the other leg of the capacitor. Just prior to that step the IC socket with the hidden capacitor looks like this:

 

 

 

When the socket is being installed, the thin wire is threaded through the hole and then pulled gently from the other side while placing the socket into the PCB. Only solder two diagonal pins (#1 and #8 recommended) of the socket and then adjust its height over the PCB by alternately re-heating these two solder joints while pulling / pushing on the socket. Make sure there still is some small clearance from the stump to the wire going though the hole of the pad, and make sure the IC socket is not tilted in any ugly way. Do not solder any of the other pins of that socket yet. Then put in all the other parts. The component side of the ACI should look like this:

 

 

 

You might note that I used DIL-16 sockets with built-in 100nF bypass capacitors in locations #3 and #4, where the PROMs go. Bipolar PROMs make nasty current spikes and this may be one reason why the ACI is not such a great performer in terms of readback reliability. So I can recommend this measure (although it's hard to prove how much it really brings).

 

 

Step 4: Add the wires on the solder side like this:

 

 

 

Some of the wires tap into a PCB trace. Scrape a little bit of the solder mask away and then polish the exposed copper with a pencil eraser until smooth and shiny. This helps to make a better solder joint. But don't overdo this, use a corner of the pencil eraser to avoid a dull speck on the solder mask that is too large. If your pencil eraser has no sharp corners anymore, cut a piece off and you have four fresh corners to work with. That should be plenty. Solder the insulated wired that comes out of the pin #9 hole of the IC #2 (the socket with the hidden capacitor) first, because if you botch that and cut it off too short, or if there is a mishap with stripping the insulation, you can still get the IC socket out to install a new insulated wire (rinse and repeat).Remember we only soldered two diagonal pins of the IC in location #2 for a reason. Any mishap with stripping insulation can be avoided by using polyurethane insulated wire used for winding inductors. This thin insulation can be stripped by heating it with the tip of the soldering iron (apply some solder in the process). But do not inhale the fumes - they are toxic. I used this type of wire for the photos seen in post #13 of the beforementioned thread. But for the example here in this new thread, I used blueish wire-wrap wire because I think it looks nicer and I wanted to show you the difference. Alas, I have no such wire with an insulation of a color that matches the green solder mask. That would be ideal for better looks.

Make sure the insulated wire that comes out of the pin #9 hole of the IC #2 is long enough to be bent into the final configuration seen here:

 

 

Which looks neater. In the previous photo I just had bent it away again so you can discern all these wires and where they connect to more easily.So many words for just one wire. But is is the most difficult wire to add and it must be done right and completed as the first one. Then add all the other wires and solder only those pins of IC #2 where a wire must be attached. Do not solder any of the other pins of IC #2 until all wires are in, and have been bent into their final positions. You could still break that difficult to replace wire off in the process and if this happens you want to be able to get the IC socket #2 out again to replace it. After all the wiring work is done, solder the remaining pins of IC socket #2.

 

This is how I built a new ACI card with all the currently known mods. It will work with both 256x4 and 512x4 type PROMs, so you can do these mods even if you don't have the new 512x4 PROMs yet. It would be great to have somebody who has the tool to edit Gerbers so these mods could be put right into the PCB itself. If the extra capacitor would be a SMD hidden under the socket of IC #2, then nobody could tell it apart from any unmodified ACI, except for spotting the 5.1 MEGOhm resistor in lieu of the 100K resistor. Alas, the only tool I know which can edit Gerbers with grace is the "FAB2000 Gerber Edit"(or so, my memory is not 100% certain after all these years). Our PCB wizard in the last company I worked for before retirement had it. But it is heinously expensive. Most likely it can't be found outside the electronics industry. But maybe our Russian friend who made these Open Source Gerbers could make that modified PCB for us ? If you read this, dear Misha, please get in contact with me by a private message here at Applefritter.

 

So far today's post on UNCLE BERNIE'S IMPROVED APPLE-1 CASSETTE INTERFACE.

 

We have covered the hardware side.

 

And that is all I could do in this internet session. If anyone is interested in adopting these mods, please write a comment. If there is enough interest, I will make another post explaining the software side and how my proprietary extended format works on both the Apple-1, the Apple-II and how it can be used on any non-modified ACI (same procedure as with using it to read these recordings on an Apple-II, btw.)

 

Comments invited !

macnoyd's picture
Offline
Last seen: 3 days 8 hours ago
Joined: Oct 15 2012 - 08:59
Posts: 702
Really NICE work UncleBernie !!

Easy to understand write-up too.

I have no comment on the technical parts but I would like to suggest that you consider making up an "UncleBernie's" version of the cassette interface PCB with all the mods included in the traces.

I know I'd buy one! :-D 

If PCB making isn't in your bag, maybe someone here would take it on. (?)

 

Very nice work and thanks for posting !!

You've become an excellent source for mods and technical info to the Apple 1 - which is most appreciated by me and I'm sure many others as well.

Macintosh_nik's picture
Offline
Last seen: 5 hours 8 min ago
Joined: Jan 8 2021 - 05:18
Posts: 87
Hi Uncle Bernie!

There is a free program for creating and editing PCBs.

 

https://easyeda.com/

Offline
Last seen: 6 days 7 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 201
HOW TO USE UNCLE BERNIE'S EXTENDED FORMATTING PROMs

Hi -

 

I have got word that there is one (ONE !) daring soul out there who has these PROMs and did the mod. So I decided to publish the "manual":

 

Start the 2nd page in the PROMs with C500R <return> and then you have the same cassette commands available as in the original Woz ACI code, except that these have extra functionality. However, since I use the command line parser written by Woz, be aware of the quirk of the original ACI firmware that you better enter ALL four hex digits of any address given to these commands. Otherwise, some leftovers of the previous address may become part of the second address and the address range used by the command will be wrong. I think this is not a "bug" in Woz' code - there is simply no way to avoid this within the mere 256 bytes available. And since I also was very, very tight with the added 2nd page - I struggled for weeks to squeeze the extra functionality in - I could not fix this quirk either. So let's call it a "feature" which can be dodged by proper procedure: always enter four hex digits for each address and all is good !

 

If you use the "standard" cassette commands in the form:

<from>,<to><cmd> where:

 

<from> is the address of the first byte in the recording block

<to>   is the address of the last byte in the recording block

<cmd>  is the command: 'R' for tape read, 'W' for tape write

 

 

... in the extended formatting / 2nd ACI page, the firmware will append (and check) an Apple-II style EOR checksum byte, which is so badly missed in the original ACI firmware. If the check fails, a '?' will be output. These recordings are fully Apple-II and Apple-1 compatible: the original Apple-1 firmware (on page $C100) just ignores the checksum.

 

There also are 'extended' formatting commands, WX and RX, the 'X' meaning 'extended'. These use an 8-byte header which contains the <from> and <to> addresses, or, if those two addresses are equal, they are treated as an autostart address. As an example, consider the commands to write a recording of my 'Codebreaker' game you can find here in this forum:

 

C500R <return> ... to start the extended formatting page. Then:

0800.0FFFWX 0800.0800WX <return>

 

... to write a first record block containing the program and then a second record block with the start address.

 

Having these headers in the recording relieves you from writing down or memorizing the load and start addresses. All you need to note / memorize is the number of blocks. To load and run such a program, use the following commands:

 

C500R <return> ... to start the extended formatting page.

RX RX <return> ... load and execute two record blocks.

 

If you want to avoid the autostart, just use one RX less than the number of blocks in a recording (the autostart always must come last for obvious reasons).

 

To read such an extended format recording on an unmodified Apple-1 ACI or on an Apple-II, you just subtract eight bytes from each <from> address and you skip the autostart block as explained above. So in case of the 'Codebreaker' example the read command would be:

 

07F8.0FFFR

 

and all is good. Be aware, however, that the header still is being read into address range $7F8 to $7FF. It does not matter if any memory is there, as both the Apple-1 and the Apple-II just deposit these eight bytes blindly and never look at them again, but you want to avoid overwriting vital data of the operating system, so choose your address ranges accordingly.

If for some reason you must make multi block recordings with continuous addresses (no gap for the eight header bytes there), record them with descending address ranges. Example:

 

0B00.0FFFWX 0800.0AFFWX 0800.0800WX <return>

 

and on unmodified Apple-1 ACI or the Apple-II use the following read commands:

 

0AF8.0FFFR 07F8.0AFFR <return>

 

So with a little bit of evil math in the hexadecimal number system we can load such extended format recordings on any machine, whether it has my 'extended formatting PROMs' or not, and whether it is an Apple-1 or an Apple-II.

 

What these 'extended formatting PROMs' in the current form don't have anymore: my original work was a complete re-write of the ACI code and it supported cyclic redundancy checks ("CRC"), too. But I never could fit everything I wanted into only 512 bytes of PROM space. With more time to spend on it, maybe it would be possible. But when keeping Woz' code in there, in the first page of 256 bytes, there is absolutely no way to have CRCs. So in the current headers there is a flag to disable the CRC check for these recordings. But (inactive) CRC bytes are there to keep everything forwards and backwards compatible for the future.

 

You could now make the point that CRCs are not absolutely necessary anyways, and the EOR checksum would do, as it was all what the Disk-II system ever had. However, there are certain error conditions in tape systems - which I actually have experienced during my work on the new ACI firmware - where the EOR checksum would NOT catch a readback error. This may happen, for instance, with a premature start of the readback before the actual start bit after the header tone comes along. The header tone itself is read as a string of $FF bytes and as long as the premature start catches an even number of them, the EOR checksum won't notice that fault, despite the read back data is misaligned and wrong. Alas, numerous causations exist which may produce such a premature start. The crappy media player of Windows 7 is one of them. And the cassette readback circuit of the Apple-II tends to treat playbacks with too high a volume setting as a sort of bogus header tone with lots of '1' bits and a few '0' bits sprinked among them, which may cause exactly the dreaded error condition mentioned above.

A CRC would catch that, but even a CRC has weaknesses and I have witnessed a rare case where even the CRC did not catch a fault and the loaded program would hang.

 

But in any case, even a simple EOR checksum is much, much better than having no checksum at all, as is the case with the original Apple-1 ACI.

 

Comments invited !

 

 

Log in or register to post comments