But wait, there’s more.
I wanted to say, “thank you” to all my Patreon patrons. You are the ones who make this blog possible for all of us. By way of thanks, I was inspired to revisit my last blog post and update things a bit. This is a free mini-article for everyone, just to let you know how much I appreciate all the patronage. If you’d like to be as cool as those people, follow this link and sign up to be a Patreon Patron of Blondihacks:
I’m pretty cool, but I wish I was cooler
Now, on with the show!
After my recent adventure in regaining control of the accelerator on the Apple IIc Plus, I was pretty pleased with myself. I had made it so that the machine defaulted to 1Mhz, but could still be sped up to 4MHz by holding Option. This is clearly how the retrogods intended things to be, and they were pleased.
My intrepid readers wouldn’t let me leave it at that, however. My ultimate goal, as you may recall, was to reverse the meaning of the ESC key in the machine’s normal speed selection process. I couldn’t quite achieve that, because the keyboard circuitry is not yet readable at that point in the boot. I could only check keys like Option that bypass the keyboard hardware. However, readers Chris Torrence and Jason Clark pointed out that perhaps I could read the current state of the accelerator and simply reverse it, rather than checking a key. That elegant idea somehow escaped me while I was heads-down in my travails. Sometimes when you’re laser-focused on a problem, you can’t see the forest for the cart before your eggs are hatched. I think that’s how that proverb goes. Anyway, you know what I mean.
I set out to do what Chris & Jason suggested, and I learned a little bit more about the accelerator along the way. The CGGA has a 16-bit status register that can be queried:
So, it should be a simple matter of checking bit three in the lower byte of that register, and acting accordingly. Here’s the modification to my previous patch that I came up with to do that:
You might look at that code and think it’s strangely… inefficient. Why all the duplication of locking and unlocking the accelerator on the two code paths? Well, it seems there are some kind of constraints on the CGGA’s Unlock/Modify/Lock cycle. Any sort of branching or excessive delay between the Lock/Unlock appears to cause the accelerator to ignore commands. Perhaps the CGGA has an internal command buffer that is processing these in a time-sensitive way. In any case, I found through extensive experimentation that anything more complex than the shortest-possible unlock-modify-lock code doesn’t work. Weirdly, there is sample code in the documentation that branches to reuse code, but it doesn’t appear to work either. That’s why my patch “unrolls” the process on each of the two possible code paths for reversing the state. The downside is that this makes the code much larger, and there was a chance that, at a portly 80 bytes, it might no longer fit in the hole in ROM that I had found for it. Remarkably, it fits with one byte to spare. Truly, the retrogods are smiling upon us, fare readers.
There you have it. Now the machine defaults to 1MHz, but can still be booted or reset to 4MHz using the ESC key. I think I finally feel comfortable putting the top back on my IIc Plus.
Thanks again to all my readers, and especially my Patreon patrons. This blog would not exist without you! Now is a great time to become a Patron, because there some awesome hacks coming soon to a blog near you. And by that I mean this blog. This one you are reading. Not sure if that was clear. Please keep reading this blog that you are reading right now. Um.. that’s all.
8 thoughts on “Apple IIc Plus Accelerator Update”
Do you happen know where the decision to boot from the internal floppy drive is made on a IIC? Was wondering if that could ever be changed.
That’s a good question, and I’m afraid I don’t know. I might have suggested it should be possible to compare the IIc with the IIc Plus ROM and simply see where they differ, since the IIc Plus will boot from an external disk first if connected. However, I’m now painfully educated on how different the IIc Plus is from all other Apple IIs. The upper bank of ROM seems as though it was rewritten from scratch for this one.
It should be much more straightforward to figure that out on the IIc, though, because the ROM for that is actually available as source code in the first edition of the Technical Reference Manual.
I picked up a Floppy Emu (Model B) , so I think I would like to add this functionilty to a IIc, as I don’t want to disconnect the internal drive. I usually use my IIe enhanced with a CFFA, which I am happy with. I am not familar with the IIc and IIc Plus. Did not know the IIc plus could boot from an external floppy. Thanks for the pointer to the Technical Reference Manual for the IIc.
It’s a pretty clever solution, honestly. The internal drive on the IIc Plus is mapped to slot 5, instead of the normal slot 6. This means the normal slot scan from the top down works to boot from an external drive of connected. This solves the tricky problem of how to live with an internal 3.5″ drive for a machine where 99.9999% of the software is on 5.25″ and self-booting. In hindsight, putting a 3.5″ drive in it at all is a pretty questionable decision, but they were trying to look to the future, I guess.
I’m not sure that I’d want to change that boot procedure. If there’s no floppy in the internal “slot 5” drive it goes to “slot 6” and boots the external drive if one is connected.
Are you saying you’d want it to default to “slot 6” instead?
If you ever do another hack with this and need more ROM space you could do the above code with
STA $C028 ; Flip main ROM back in
LDA #$61 ; Read accelerator status word (command code 5)
LDA #$03 ; Lock accelerator (command code 4)
AND #8 ; if 0 -> 1, if 1 -> 2
ADC #8 ; if 0 + 8 = 8
LSR A ; if 8 + 8 = 16
LSR A ; >> 3 to move to first two bits
LSR A ; thus 0= 1, 1 = 2
PHA ; push the en/dis accelerator
PHA ; Unlock accelerator (command code 2)
JSR $C7C7 ; perform unlock
JSR $C7C7 ; perform enable/disable
JSR $C7C7 ; perform lock
STA $C028 ; Switch to aux ROM Bank
JMP $C711 ; cont in normal init
Also is there not an emulator you can test the Soft ROMS on first and then burn?
That’s really nice code- thanks for sharing! I’m definitely no 6502 guru.
To answer your question, no, there is no IIc Plus emulator. When I started these ROM hacks back with the beep fix, it wasn’t even clear that the ROM had ever been dumped (though a dump was eventually found that predates mine). The IIc Plus hardware is very different than any other Apple II, so existing emulators would not be much help. The CGGA for example, the heart of the IIc Plus accelerator, is a custom programmable logic device that has never been emulated or documented in any serious way.
I have a list of awesome people who have a Patreon, whom I look forward to supporting on there if and when I get to have actual taxable income… you, Quinn, are on that list.
For the record — 29, disabled, Mom’s disabled too, total income ~$1700/mo from Disability + SSI. I’d much sooner get a dang job, but that’s not in the cards right now. As someone else once put it… “geez you can’t even afford the price of a latte?” That is sadly pathetically absolutely correct. I feel bad about it… but that doesn’t mean there’s anything to be done.
Comments are closed.