Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONitor utility 65C816 support #260

Open
tomxp411 opened this issue Jan 24, 2024 · 1 comment
Open

MONitor utility 65C816 support #260

tomxp411 opened this issue Jan 24, 2024 · 1 comment
Labels

Comments

@tomxp411
Copy link
Contributor

tomxp411 commented Jan 24, 2024

Discussion of 65C816 support for the built-in MONitor utility.

These changes seem less important if we do not support native mode execution, but the community seems pretty intent on making native mode work, so we have some things to consider:

  1. MON will need a new command to select 65C02, 65C816-emulation and 65C816-native mode, due to the additional register count, wider registers, and changed flag labels. These will be called: C02, 816e, and 816n.
  2. MON needs a way to actively track .a and .x flags (Memory Width and Index Width) during disassembly. This will require a new command, as well, to set the expected state of those flags prior to disassembly.
  3. The new 65C816 instructions will need to be added to the assembly/disassembly table
  4. The new address modes will need to be added
  5. The status line needs to be extended, with 2-byte words for the wider registers, the additional bank registers, and the new labels for the flags (which will vary depending on the emulation flag.) This includes extending the memory space used as a proxy for the register values.
  6. When assembling and disassembling, MONITOR will need to track the expected state of the Accumulator Register Width (.a) and Index Register Width (.x) flags, in addition to the .e flag (which forces .a and .x to 8-bits when in 65C02 emulation mode.)

The toughest nut to crack might be the BRK issue. We can't simply BRK in native mode, which means we lose access to the 16-bit registers. If we add a ROM routine named "brk16", a dev can JSR brk16, which will

  • Set aside a block of memory as a native mode register proxy space, with room for all registers and an extra byte for the register display mode.
  • Push all registers to the stack. Push flags LAST. (because flags affect 8/16 bit mode and so change the number of bytes on the stack)
  • Set .a and .x to 8 bit operation
  • Set emulation mode
  • Pull data from the stack into the register proxy space.
  • Execute the BRK instruction
  • MON inspects the register display flag and displays the CPU state in one of 3 modes:
    • 65C02 mode
    • 65C816e (8 bit registers, "B" register, include banks and .e flag.)
    • 65C816n (16 bit registers, include banks, and .a .i flags)
@tomxp411
Copy link
Contributor Author

I found a 65816 port of Supermon. This might be easier than re-implementing the 65816 changes.

http://forum.6502.org/viewtopic.php?f=2&t=2949&start=15#p34022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant