Description
This issue is part of #67 and issue #66.
We (Mirko and I) are thinking about breakpoint and single step support in QNICE and came up with the following idea:
-
We will use one of the two spare bits in the SR to denote a trap-on-instruction-fetch-feature. If set this will effectively cause a software interrupt every time a new instruction is fetched. Since this will be part of the CPU it will take precedence over any other interrupt and can also happen within an ISR. This bit will be called 'S' for single step.
-
When an instruction fetch triggers this feature, the current SR, PC, and SP are copied to a shadow register set as usual with out interrupt processing. After that this bit will automatically be cleared so that the ISR will proceed normally. Exiting the ISR with RTI will automatically restore the aforementioned registers and thus implicitly set this control bit again.
-
We will extend the three existing shadow register for interrupt processing (PC, SR, SP) by a fourth shadow register which will contain the ISR address for this feature.
-
The control instruction group will be extended by two additional instructions: RSR (read shadow register) and WSR (write shadow register). These allow to read/write all of the existing (and future) shadow registers. The number of the shadow register being read/written is specified in the src/dst field while the destination/source register/memory cell is specified in the dst/src field.