The design of a "full RAM" 6502 computer has been seen many times, with people interfacing the RAM with another M/CPU that fill in the blank RAM with code and then kickstarting the 6502 to take control from there.
I know that the zero page and first page are used by the processor for its inner workings. What I don't really know is where the Main, Index, Program Counter and Status registers are phisically stored. Are they in the chip itself or in one of the locations of the zero page?
And I make that question because I'm wondering (and again, just theorizing) about how to implement several virtual computers with a single 6502 chip.
My theory of operation would be this:
- First, and external M/CPU would load a 256K RAM chip with 64K of data in a first bank, as the 6502 would need to run (reset, irq, nmi vector values and code that would run).
- This operation would be repeated with the second, third and fourth banks, with the same or different values or code.
- And then, have that first 64K bank mapped to the 6502 and reset it, having it to take control.
The fancy thing would be that that external M/CPU would be able to
- Pause the 6502.
- Save all the Main, Index, Program Counter and Status registers.
- Change the memory mapping by setting registers in external glue logic, so the 6502 would be mapped to the second 64K bank of the same 256K RAM chip.
- Reset the 6502 and have it to take control again, but this time acting as a different computer because all the memory is different (actually in a different location of the same chip) and the CPU registers are different as the ones the computer previously had.
- pausing the 6502
- saving the cpu registers somewhere
- changing the memory mapping
- loading the previously saved cpu registers that would correspond to the desired virtual computer
- make the 6502 run again with that newly loaded, previously saved state
Thanks for replies.