Apple II 'card bootable' magic

Programming, for all ages and all languages.
Post Reply
User avatar
jojo
Member
Member
Posts: 138
Joined: Mon Apr 18, 2016 9:50 am
Libera.chat IRC: jojo
Location: New York New York

Apple II 'card bootable' magic

Post by jojo »

One of the projects that's been on my plate for quite a while has been to build an ATA interface card for my IIe. It's been done several times, but I still want to roll my own just for the fun of it and because I haven't done any serious circuit building in a while.

One of the things that I think would be an absolutely awesome bonus feature would be to have the card act like a Disk II in forcing the system to start running code from its option rom at boot so that I could get it to boot a custom DOS on cold reset.

I've been reading a lot of docs on the expansion interface, and the way the cards' memory space is configured is super well documented and easy to understand. But I cannot find out for the life of me what magic the II's boot rom looks for on an expansion card in order to determine that it should execute code from the card's rom (or, if it's not that it's looking for magic, whatever weird thing the Disk II does to hijack the boot process).

So all I'm really asking: Do any of you old fogies out there have any info on this?
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Apple II 'card bootable' magic

Post by Kazinsal »

I'm not an "old fogie", but I've spent an hour or two digging into this and I can safely say I'm now waist deep in Wozniak code and an old Apple II Monitor ROM reverse engineering manual, and only close to figuring it out.

The monitor ROM included on later Apple IIs and Apple IIs with an Applesoft BASIC card plugged in have a slightly different $F8xx ROM that includes a routine to search for a bootable expansion card starting in slot 7 and moving backwards to slot 1. I'm not terribly proficient in 6502 assembly, and this stuff reads like something Wozniak was having a hard time finding space for, so it's pretty complex. I haven't found the magic number it needs.

The routine is at $FAB4 in the "autostart" F8 ROM. I'll keep looking for what you need, but since you're working on Apple II hardware I have a feeling you'll find the magic before I do. :)
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Apple II 'card bootable' magic

Post by onlyonemac »

I'm going to point you to towards what might well be a more appropriate forum here: https://68kmla.org/forums/. They're focussed on vintage Apple/Macintosh computers and have a lot of Apple II owners/users and hardware hackers.

Full disclosure: I used to be a regular member there until a few years ago when they changed their forum software to one that didn't work on my computer at the time; the software works fine on my new computer but I haven't gotten back into their community since going blind (blind accessibility for vintage computers is poor at best and non-existent most of the time :-/ ).
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
jojo
Member
Member
Posts: 138
Joined: Mon Apr 18, 2016 9:50 am
Libera.chat IRC: jojo
Location: New York New York

Re: Apple II 'card bootable' magic

Post by jojo »

Kazinsal: You are a rockstar, seriously. I was going to give the reverse engineering route a go either way, but now that you're already on it this feels a bit like a competition now!

onlyonemac: Thanks for the link, I'll give it a look! We'll see how much luck I have, it took me about a decade of lurking here to start asking questions, let's hope I'm not such a wet noodle with them!

Also, sorry for your situation dude/dudette. That's really rough. Must be tough to be a text-only person in a GUI world.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Apple II 'card bootable' magic

Post by onlyonemac »

jojo wrote:Must be tough to be a text-only person in a GUI world.
Not entirely. A lot of what you find in GUIs is text anyway, like most of the content of webpages and certainly any computer code! What's annoying is when people don't design things properly and they use pictures instead of text or make it impossible to get to a particular control using just the keyboard (that's actually a more common accessibility screw-up than graphical content without a textual alternative). Some interfaces are made really weirdly and don't work properly for some reason, such as VirtualBox (that is annoying). When I first became blind I set up a Linux system with just a talking console and no graphical environment (not even an X server!), but I quickly started missing the GUI and soon set up a system with a GUI. The GUI's still good for blind users - I still prefer the way that GUI text editors work compared to console text editors, and firefox is still easier to use than a text-mode browser such as lynx.

I also have notification sounds and background music, so it's not just text! :-) (Slightly joking with the latter...)
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
jojo
Member
Member
Posts: 138
Joined: Mon Apr 18, 2016 9:50 am
Libera.chat IRC: jojo
Location: New York New York

Re: Apple II 'card bootable' magic

Post by jojo »

I totally dig your positivity. But the poorly designed widgets are exactly the kind of thing I mean, I feel like not being considered in design decisions would make me feel like a second-class citizen.

Anyhow, completely off topic. Gonna get off work in a few minutes and then it's time to head home and get hackin'!
User avatar
jojo
Member
Member
Posts: 138
Joined: Mon Apr 18, 2016 9:50 am
Libera.chat IRC: jojo
Location: New York New York

Re: Apple II 'card bootable' magic

Post by jojo »

Oh, also Kazinsal:

As far as things being faster for me because I have hardware, I have a super minimal system without DOS or even a Disk II (though I do have a controller, so I can dump that which is a help I suppose) and I don't even have one of the ROM revisions that still had the assembler/disassembler built in so I don't have the best resources on that end.

I'm almost thinking the fastest way to go would be to just run an emulator with some breaks set to see when the ROM is making reads from the card rom space and then see if changing any of the locations that uncovers for me stops it booting.

If I figure it out, I'll be sure to post it back here.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Apple II 'card bootable' magic

Post by onlyonemac »

jojo wrote:I feel like not being considered in design decisions would make me feel like a second-class citizen.
I don't like to be too harsh on developers that make these mistakes because I perfectly well understand how it happens, because I've been there. When you're a sighted person writing software, you don't even stop to think about accessibility because it's not something that matters to you. That's why API documentation always has big warnings all over the place about designing your application with accessibility in mind and making sure to test accessibility before publishing it, but again you just think "oh I'm sure that's not such a big problem, it'll probably work well enough". That's exactly what I used to think when I was developing software, and I understand how it happens, so I understand it when other developers do the same thing. (What I don't understand is why applications such as VirtualBox need such weird widgets - there are plenty of cross-platform GUI toolkits that work perfectly well with my screenreader such as GTK, so it's not like they really needed to develop their own widget library (and screw up the accessibility in the process)...)
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Apple II 'card bootable' magic

Post by onlyonemac »

jojo wrote:I'm almost thinking the fastest way to go would be to just run an emulator with some breaks set to see when the ROM is making reads from the card rom space and then see if changing any of the locations that uncovers for me stops it booting.
I don't want to discourage you, but the people on that other forum were very knowledgeable about old Apple hardware and software (often in ways that make you think "how on earth did you know that???") and chances are someone there already knows the answer or could point you towards the relevant documentation.

On the other hand, if you're having fun then by all means go ahead... but something's making me think that figuring out the magic for a bootable card isn't the actual project here but is required before you can get started on the real project. ;-)
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Post Reply