??? 09/04/07 20:12 Read: times |
#144026 - tracing and simple stepping... Responding to: ???'s previous message |
... is "biblical" stuff. See 80C51_FAM_HARDWARE_1.pdf page 18, chapter Single-Step Operation.
If an interrupt is pending when reti is executed, the '51 always executes exactly one instruction before branching to the ISR again. So, the trick is, to write the whole monitor as an ISR (quite naturally the serial ISR as the UART is usually given up for the monitor's communication), and keep the interrupt flag set when doing reti. That makes the single step, and trace is only a repetition of these. In this setup you can run a monitor even without any self-writable code space, but you won't have breakpoints during full speed run. For that, you need the writable code space (and this, as there is no single-byte jump/trap/sw interrupt/whatever instruction, it has those "rewriting the neighbours" pitfalls). JW |