Sorry for the delays reply, I've been wallpapering...
dominicbeesley wrote:I was going to ask about the "current" program thing. Reentering that after a BREAK makes sense when it is a ROM (say BASIC) but not so much sense for a transient *COMMAND...but if that's the way its meant to work...
Yes, to me that seems just so wrong. It's how it does work, but I can't make myself beleive that that's how it's
meant to work.
It would make sense if code with a header (eg a ROM) became the current program, but raw code didn't. That would mean *basic, *run basic, *load basic/*go addr would make it the current program and re-enter it on break, but *proggy, *load proggy/*go addr would not become the current program. As it is, it means that if you press Break while a transient program is running, the transient program is re-entered. Even worse, if the transient program generates an error,
it remains the current program even though the error handler has taken you back to the calling program.
Save this to load to &00000780: BRK:BRK:EQUS "Hello!":BRK and *run it. Press Break. Argh!
This seems to me to be so much a bug that I've really wanted to modify that part of EXECUTE so that raw code does not become the current program. I've accidently propagated this behaviour into the 6809, 6812 and PDP11 clients, though I think I've documented the 6809/6812 clients as saying that raw code does not become the current program.
dominicbeesley wrote:Also I fixed more OS code to make it Emulated / Native agnostic and (mainly OSCLI and OSBGET).
Single character/byte I/O should be the easiest to make agnostic, as you're just passing the 8-bit contents of the A register. The control block calls are likely to be fiddlier.
dominicbeesley wrote:Still to do is the code for handling the COP vector and saving all the regs. Then code for restoring and continuing. I'm not sure how to actually handle the continue so that it will stop again on the next pass. ...
Are you trying to use COP to do single-stepping? Yes, for that you need to calculate how long the instruction you're stepping through is. I think what I'd do is:
Set breakpoint:
copy addr?0, addr?1, addr?2, addr?3 to store
copy COP to addr?0
COP handler:
get return address from stack, subtract two to get COP address
copy store to addr?0, addr?1, addr?2, addr?3
display information to user and wait for response
examine addr?0 to work out instruction length
store COP at addr+length
jump back to addr
Yes, if there's a branch you'll have to decide what to do with it.
All the best to the baby.