Effective instruction preview with resolved operands for the 6502 emulator

Maybe of interest, my 6502 emulator now features an instruction preview as an annotation to the next instruction to be executed, showing the effective values, which will be used for operands. This should not only reveal the effects of the more complex address modes (like X-indexed), but also some common errors, like forgetting the # to indicate immediate addressing in assembler code (and, thus, erronously using zeropage absolute mode – the dreaded “LDX $00”).

More on this here: <Now Go Bang!> Shiny New 6502 Thing

The emulator is found at its usual address :slight_smile: :

4 Likes

Nice idea! Especially to show the effect of shifts and rotates.

How confident are you about the various wrapping possibilities? (Wrapping around FFFF in either direction, wrapping within page 0, indexing just outside of page 0?)

(I’d be interested to see a paragraph or two about the BBC Micro mode, and I’d be pleased to see an option of loading Beeb ROMs (OS, Basic).)

The BBC Micro mode is here really just (a) “&” used for the hex prefix, (b) a modification of the character set (using the Pound sign instead of the USD sign), and the value for a fill byte. (It’s a different story with the related assembler, though.)

Address wrapping should be the same as implemented in the CPU emulation (which, conversely, should be correct), even the display for some illegal opcodes changes with page crossings. (These are those with “high-byte of the address + 1” factor.).
Only limitation: The illegal instruction “ARR” shows some complex, BCD-like behavior instead of a simple AND operation, when the decimal flag is set. There is no way that a depiction of this should fit in a short line. So there’s only an asterisk hinting at the display assuming that the D-flag is not set. (Generally, the state of flags isn’t considered for the evalutaion, but some effects on certain flags may be shown, e.g., for comparisons.)

Regarding ROMs, I just don’t know enough about the BBC Micro to make a confident choice on what ROM set to use and any configurations in general. (Advice is welcome.)

BTW, the same goes for the Apple II. (Austria, as a neutral country, was subject to Reagan-era techology transfer regulations and we were not allowed to have one, other than private import through grey channels… So my knowledge on these is somewhat limited. I’d need competent advice regarding a default ROM set and/or DOS to load and any peculiar aspects of the character encoding.)

And, yes, the original idea was about exploring ROM sets. I’m in the process of implementing a debugger for the (somewhat related) PET 2001 emulator and I wanted to come up with some mechanism that gives you a hint at what values may be involved. (I’m somewhat at odds regarding details of the UI for this debugger, regarding editing capabilities, so this may take another week or so…)

Ah, of course, the hex character. I have a feeling PETSCII vs ASCII had rather more surprises, when I tried to use WFDis (online tracing disassembler) on some Beebish code, but I can’t recall the detail now.

And of course, if you’re using the same code for emulation as for the one-instruction preview, you will already have covered all the odd corners.

For the Beeb ROMs, I’d put the OS120 at C000 and the Basic2 at 8000. But I’m not quite sure what the useful consequence might be.

It’s not the same code, but a close replication. (The CPU emulation is agnostic of this, the code is really an add-on located in the GUI.)

As for character sets, this one supports ASCII 7-bit, ASCII 8-bit, PETSCII (both sets) and Commodore 8-bit screen codes (both sets), but this is used only for the memory display.

Regarding OSes: The use of this will always be somewhat limited, as most OSes will rely on an interrupt routine and will be useful only together with certain interfaces for output. However, emulating complex systems is really outside the scope of this CPU emulation.
(Much for the same reason, there was no button for the RESET signal, as I doubted the use of this, especially considering the costs regarding clarity of the UI. But, on popular demand, there’s one, now.)

1 Like