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

Support 65C816 in MONITOR #137

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

Support 65C816 in MONITOR #137

tomxp411 opened this issue Jan 24, 2024 · 1 comment

Comments

@tomxp411
Copy link
Contributor

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.
  2. MON needs a way to actively track .a and .i 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 (.i) flags.

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 .i 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
    • 65C816 running in emulation mode (8 bit registers, "B" register, include banks and .e flag.)
    • 65C816 running in native mode (16 bit registers, include banks, and .a .i flags)
@tomxp411
Copy link
Contributor Author

Opened in the wrong place. Derp.

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

No branches or pull requests

1 participant