Core 14: SD card support
- Niek
- 3 days ago
- 5 min read
Ok, first some background! When I designed an update to the AppleSqueezer some years ago, I had some space left on the PCB (the "printed circuit board"). I thought, perhaps I can add an SD card slot there, that way, it would be technically possible for AppleSqueezer users not to need any other form of disk storage, as they could boot directly from there. How nice would that be?? I was already dreaming of flipping that power button, and the IIGS magically booting with nothing else attached to it, other than the AppleSqueezer. However, "technically possible" and "reality" are not quite the same thing! 😊 So, I wasn't sure it would be a good idea, since an SD card slot that wouldn't have a driver may frustrate people who buy the AppleSqueezer! Still, I convinced myself that, given the low additional cost and high potential benefit, I should add the hardware and hope for the best. If someone could write a driver for it, then this would benefit everyone who already bought one!

Antoine to the rescue
I considered writing a driver myself, but while I'm very experienced at writing software, I don't have a lot of experience writing software for the IIGS (although I created the CDev and CDA for the AppleSqueezer). A driver like this has to work well with the rest of the OS, it has to perform well (meaning, ideally it's written in Assembly, not a higher level language like C) and I don't have enough detailed knowledge of the IIGS to make this an efficient exercise. However, one person who's particularly knowledgable on the inner software workings of the IIGS is Antoine Vignau of https://www.brutaldeluxe.fr/. He first helped me a few years ago, after I had just mentioned in the Facebook Apple IIGS group that I was working on an accelerator. Somehow, a lot of people were interested in this project, and since Antoine lived "nearby" (well, compared to most IIGS users) - conveniently near Paris, France (I live near Amsterdam myself, so this is fairly close) - I sent him the very first AppleSqueezer to test! It had never been tested outside of my own IIGS before, and didn't immediately work on his machine, because the timings of the circuit were still a little bit too tight. I think I even asked him to put the AppleSqueezer in the freezer before trying to boot it, because that would slightly alter the timings and make it work. An important hint to me so I knew how to fix this. Antoine is super experienced with the IIGS, and he helped me with a few other things after that, such as allowing GS/OS to "see" the full 13MB of RAM.
Fast forward to a year or two ago, when I first added the SD card slot, and Antoine started working on the SD card driver. I remember he mentioned something about how reading from the SD card worked fine, but writing did not. This was strange to me, because I had tested both myself, and both worked fine (I even sent him my program to convince him it worked! 😄), but since nobody was really using the SD card (as there was no driver for it!), I didn't test it super extensively. After that, a year or two went by, and I kind of gave up all hope on ever seeing a driver.
Then suddenly out of the blue, a few days ago, when he told me about his latest developments to his SD card driver (to my happy surprise he had picked up work on the driver again!), he mentioned this same issue again, and I started looking into it in more detail. A block of data on the SD card is 512 bytes. And suddenly a thought came to me, what if the issue is with writing multiple blocks of 512 bytes in a row. Then I looked at my test file: it was 480 bytes large. Hmm, this meant I never tried multiple blocks in quick succession. This turned out to be the problem: after writing the bytes to the card, the card needs a bit of time to flush them to the flash. And since Antoine's driver is written using assembly, it was so quick in starting the next block, that the old block hadn't finished writing yet. You can see the problem described in the official SD Physical Layer Specification, here: https://www.mikrocontroller.net/attachment/520782/Part_1_Physical_Layer_Specification_Ver3.01_Final_100218.pdf, see the screenshots below, where I highlighted the issue.


Once I knew what the issue was, I could fix it quite easily, creating a new core with this fix. Antoine tested it, and now it all worked perfectly! It still needed booting from another drive though, which wasn't ideal, but at least you could mount drives from the SD card into GS/OS! I was super happy.
Booting from the SD card
I thought, we may need a month or two to do the booting part, so you can boot directly from the SD card, without any other storage device attached to the IIGS. But a day or so later, Antoine sent me a message: Oh hey, here's what you need! And he sent some files that I could use, after doing some additional work on a new core (which became Core 14), which would boot directly from the SD card. And so that's the background story behind a really great new feature: the bootable SD card! It's very fast, it reads and writes super quick and boots into GS/OS in 15 seconds from my Sandisk SD card.
The driver can be downloaded here: https://www.brutaldeluxe.fr/products/apple2gs/applesqueezer/
Core 14 can be downloaded here: https://www.applesqueezer.com/downloads
You need both in order to work with SD cards. Please follow the instructions on the driver link for details on how to format the SD card. Note that currently, this functionality only works for the AppleSqueezer GS v2! Do not upgrade your v1 with this Core 14!!
A few words from Antoine Vignau
Antoine added the following information about the thinking behind the driver: If I may, I had a couple of ideas to make it bootable:
patch the read_block routine of the fake Prodos boot file of the system software (the real Prodos 8 lies in the System folder)
=> It booted until it searched for a smartport interface to continue the boot process
use a driver named "boot.driver" to fake the boot process of AppleTalk. That driver allows remote booting.
=> I failed again. Perhaps it could work but I suck at IIgs network stuff.
Add a fake boot device.
In the Slots control panel, the startup process allows Scan/Appletalk/romdisk/ramdisk then slots 7..1
The question was "is there an available smartport interface in the IIgs?"
Yes! The romdisk one. Luckily enough, I wrote one for Пламен Вайсилов's romdisk card and had recently asked him for the source code I was unable to find handy.
=> That was it! Niek van Suchtelen made Core 14 a reality with my romdisk driver in it. We can boot!
The limits:
we cannot browse a fat32, disk image and mount disk images on the fly.
if you have a romdisk card, don't upgrade to Core 14. I wonder which one will be visible. I believe the AppleSqueezer's one will be.
AppleSqueezer GS v1
SD card support for the AppleSqueezer GS v1 will follow at a later date!