• Please review our updated Terms and Rules here

Apple II Extended Debugging Monitor, bug fix, etc.

tetsujin

Experienced Member
Joined
Sep 5, 2025
Messages
90
Hi! I recently got back into Apple II stuff - I initially got into it a few years back with some Apple IIc's I found for sale locally - then when I got my Toshiba T1100+ laptop I switched over to PC stuff for a while (I love that I can take it places!), but a couple months back I found a good deal on an Apple IIe. For a while I wasn't even sure I wanted to get a full-size Apple II - only got so much space for things, you know? But I got into building expansion cards for it, and that's been a lot of fun. I've been working on a Super Serial Card, and I built a VIA+ROM card, mostly for experimentation, but I realized that I could pretty easily turn it into a clock card, so that became my first major project with the IIe (other than things like repairing the keyboard, replacing a missing duodisk cable, etc.)

One thing I want to do with this IIe is make it into a really capable programming/debugging machine - possibly with something like the ProDev DDT (an expansion card with a powerful debugging monitor in its ROM, plus a bit of scratch RAM, a hardware breakpoint, NMI button, etc.) - but for now I'm starting a bit more simply. I built an adaptor for my IIe so I can replace its original ROM chips with a single EPROM, and I installed the Extended Debugging Monitor.

I don't know much about the history of the EDM, but it provides a few good improvements over the machine language monitor in the standard IIe ROM:
  • Memory bank syntax allows the user to read and write all machine RAM regardless of whether it's currently banked in. (For instance 0/F800 to read or write "language card" RAM, or 1/4000 to read or write the "auxiliary bank")
  • Memory listings take advantage of the 80 column display if it's active, with wider listings
  • Memory listings also include ASCII representations of bytes in the ASCII range
  • Disassembler and Mini-assembler support the full set of 65C02 opcodes (apart from Rockwell extensions)
  • "Resume" command restores program memory state and continues execution after a BRK
But that last bit of functionality was where I hit a snag: "resume" after a break didn't seem to work. Every time I tried it, the machine would crash.

So that led to another adventure (someday I'll finish programming my clock card's ROM code, I swear...) - disassembling and debugging the EDM. It took me some time to really understand the code, but when I figured out where the entry point to "resume" was, I found it: At address FEE9 in the "Resume" code was a JMP $C781. (The Apple IIe implements banking which allows ROM to take over most of the address space reserved for I/O devices, so page C7 is part of the ROM...) At address C781 was an invalid opcode, $7B. That by itself wouldn't necessarily be a deal-breaker (the 65C02 ignores invalid opcodes, and it's common on the Apple II to have opcode sequences that use different entry points to set different conditions in the same code) - but there didn't appear to be any code that could lead to the prior byte at C780 being used... And an entry at C780 produced a much more useful-looking disassembly (STA $067B, BIT RDALTZP instead of the invalid DB $7B, then ASL $2C, ASL $C0,X)

So I concluded the JMP instruction at FEE9 was simply pointing at the wrong address, it should be JMP $C780 rather than JMP $C781. I edited the ROM with a hex editor and tried it out, and suddenly the "resume" function worked reliably. I'm not sure why the address was wrong in the first place - as I said I don't know much about the history of the EDM, frankly I just get the impression it was never used much. (And today, of course, a lot of people cross-compile their code and test it on emulators. Personally, that's not what I want to do. Part of the fun of this hobby is spending time working with and on these old machines, and writing and testing code on the machine itself is a great way to do that.)

I also came up with a patch that would let me use the delete key as backspace when interacting with the monitor. Ultimately I'd kind of like to find a way to add Step and Trace back into the EDM, but that requires about a page of ROM space, and the EDM is already pretty much stuffed to the gills unless I introduce ROM banking like the IIc has.

Personally I felt like having free access to all RAM in the EDM was reason enough to start using it. Now that "resume" is working I think I'll be making a lot of use of that as well
 
Back
Top