Real-time 65816 debugger -- GSBug

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Real-time 65816 debugger -- GSBug
by on (#82042)
(Preface: the reason I'm posting this in the NESemdev forum is because this primarily revolves around a NES debugger; sure the same thing applies to a SNES debugger, but my main focus these days is on NES stuff...)

In the past I've ranted and raved about how ORCA/M, the software/assembly development environment for the Apple IIGS, had an awesome CDA called GSBug. I haven't been able to actually show anyone what it looks like since it's so old (circa early 90s), but the UI/design made perfect sense and fit all within a 80x25 screen with no nonsense.

After MONTHS of nonsense with Syndicomm not getting me my ORCA/M manuals and disks, I finally got in touch with someone over there who got me such (the company was sold/handed off to another guy who was super responsive; pshew!). So I wanted to show folks a picture of GSBug to give you some idea of just how the layout was and what you could do with the real-time debugger. Again, remember this all fit on 80x25:

http://jdc.parodius.com/lj/gsbug01.png

Now that I have my ORCA/M disks I can get GSBug installed (in a IIGS emulator) and make a video showing how the hell the thing works. I imagine that would interest folks a lot more than just a screen shot. The IIGS (particularly since it's 65816) is a lot more complex than its II (6502) counterpart, but the same design/layout/concept applies to the NES overall.

I realise showing a screenshot doesn't do it much justice. "Uh that's nice koitsu, a bunch of memory and register dumps, every NES emu with a debugger has that". The amount of control/detail you have in this tool is pretty much unmatched by any emulator's debugger though. I'd need to upload the ORCA/M manual PDF somewhere, but as I understand it it's a commercial manual (think: a book), so putting it on the net somewhere would probably upset Syndicomm. With a paper book I could at least loan it to someone and demand it back though... Anyway the GSBug section is almost 70 pages, and it's extremely technically detailed (not "hur derp derp you press Q and you quit, I like hot dogs") but reads easily.

Folks might wonder what the heck "Memory Protection" is as well, I can explain that if asked.

I can't tell you how much time I spent in GSBug when doing IIGS coding. Way, WAY too much time. I'm very opinionated about it because with something from that era I was able to debug pretty much anything on the fly; yet today, with machines that blow the IIGS out of the water in every way, nobody can seem to write anything that's even remotely sane or similar in its functionality. The old SoftICE debugger for x86 was the closest thing, but it was a beast... plus the x86 is a bastard PITA. But SoftICE is the closest comparison I can make, just with a weirder UI.

So when I see NES emulators' debuggers today having the worst UI design ever, and having non-relevant crap on-screen, I get angry. It's as simple as: "we had shit that worked just fine in 1993 yet it's now 2011 and people can't seem to develop something that makes sense?" Old codgers like me judge easily I guess, but ultimately there's no reason this degree of control and capability can't be available. NES-specific stuff could warrant its own window, absolutely (and we have the real estate for it; 24" monitors are the norm, usually 1680x1050 or higher, etc...), but for the CPU and general RAM/ROM, nothing beats this.
Re: Real-time 65816 debugger -- GSBug
by on (#82045)
koitsu wrote:
extremely technically detailed (not "hur derp derp you press Q and you quit, I like hot dogs") but reads easily.

Good God I almost fainted with laughter reading this. My coworkers were about to call in the Emergency Response Team fearing I was having a seizure.

koitsu wrote:
Folks might wonder what the heck "Memory Protection" is as well, I can explain that if asked.

I know absolute zero about the IIGS unfortunately but would *love* to be inundated with technical detail like this. It's the kind of stuff I masturbate to at night. [Can't find that thread right now and am afraid to search for "masturbate" in the NESDev forum while at work! haha]

koitsu wrote:
So when I see NES emulators' debuggers today having the worst UI design ever, and having non-relevant crap on-screen, I get angry. It's as simple as: "we had shit that worked just fine in 1993 yet it's now 2011 and people can't seem to develop something that makes sense?" Old codgers like me judge easily I guess, but ultimately there's no reason this degree of control and capability can't be available. NES-specific stuff could warrant its own window, absolutely (and we have the real estate for it; 24" monitors are the norm, usually 1680x1050 or higher, etc...), but for the CPU and general RAM/ROM, nothing beats this.

I'm interested in your definition of "non relevant crap"? I think there's a divergence of style, for sure. Some like Nintendulator and FCEUX have all the stuff in one gargantuan window. Others like NESICIDE have probably too many individual dockable windows containing singular pieces of debug information [like RAM, registers, etc.] I did it that way, and arguably went too far to the extreme because people were complaining about having a gargantuan debug window with everything in it.

by on (#82061)
I wonder how the disassembler knows about the size of M when executing those two LDA # instructions. Kind of like the loss of $ on every opcode, makes sense for a disassembler that never shows decimal.

> The old SoftICE debugger for x86 was the closest thing

When I had only one PC and always had Winamp going, SoftICE could be quite annoying, but yeah, that was one awesome program.

> plus the x86 is a bastard PITA

Dear god, try writing an assembler for it. The REX extensions to the SIB extensions to the ModR/M extensions are just ... ugh.

> So when I see NES emulators' debuggers today having the worst UI design ever

Debugger design is so amazingly difficult.

I had a console that printed the last immediate statement for all processors to a single window, and you could step anything from the main window.

Then I keep that, but add separate forward/backward disassembly windows, and find it's much less enjoyable to use.

There's something really nice about having a single console where you can type in commands, but novices tend to freak out when they see it, and prefer the multi-window approach.

by on (#82064)
byuu wrote:
I wonder how the disassembler knows about the size of M when executing those two LDA # instructions.

The Apple II monitor (not GSBug, something far more primitive) saves "AXYPS", and the IIGS version also displays the new 65816 regs. The built-in disassembler probably disassembles based on the saved values of M and X bits in P.

by on (#82086)
Oh wow, that's exactly how I do things with my emulator: save M/X/E processor status bits for every address that an opcode executes, and also save whether the address was read/written/executed. Allows full forward and backward disassembly at any point, but requires code be executed at least once for it to work. Map is saved across multiple runs of the emulator, assuming the checksum stays the same.

It falls apart a bit on memory-mapped code, but there's only two of those, and one's been translated anyway, so ... what can you do?

But you've given me a great idea: optionally generate the usage map with my cross-assembler, so that the debugger instantly knows about all opcode sizes and valid code areas.

That along with named labels/registers should make it quite friendly.