Page 1 of 1

How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Sun May 04, 2025 5:55 pm
by ql_freak
I think I have already debugged machine code extensions with Computer One Monitor but can't remember how I did it. I've set the job ID in C1MON to a Minverva MultiBASIC with C1MONs job command and then called the extension (in this case a function) with print funcname (it's a function without parameters) but C1MON doesn't stop at the breakpoint I have set.

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Mon May 05, 2025 6:28 pm
by Derek_Stewart
Hi Peter,

I use QMON to step through code.

Also the debugger in Qemulator is worth looking at.

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Mon May 05, 2025 6:34 pm
by tofro
ql_freak wrote: Sun May 04, 2025 5:55 pm I think I have already debugged machine code extensions with Computer One Monitor but can't remember how I did it. I've set the job ID in C1MON to a Minverva MultiBASIC with C1MONs job command and then called the extension (in this case a function) with print funcname (it's a function without parameters) but C1MON doesn't stop at the breakpoint I have set.
How and where did you set the breakpoint? The jobID is relatively irrelevant - Most monitors don't check what job is currently running when the code is running onto a breakpoint - You must have loaded the code to some address - also remember, the first part of an S*basic extension is a table, not code - setting a breakpoint there doesn't help - you must find the offset of he actual code that is called when the extension functions are used, then set the breakpoint there. The listing file (if your assembler produces one) helps to find the offset from the load address.

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Sun May 11, 2025 3:19 pm
by ql_freak
I have finally found the solution:

Load your extension (ideally in a MultiBASIC) with cde=RESPR(size):LBYTES 'filename_cde',cde:CALL cde:JOBS:PRINT HEX$(cde,32)

Switch into C1Mon and enter the command jobs (use a channel with a large window, in my config it is #3)

Find the MultiBASIC job id by comparing with the SuperBASIC JOBS output.

Then enter in C1mon:

job <jobid>

(job 0 for normal SuperBASIC)

Then set a breakpoint (you may dump the memory starting at cde, which we have printed in hex) in the code you have LBYTESed above and in C1MON finally enter:

go

Now you can call the machine code extension from SuperBASIC (e.g. a=REF_GETLNLO%) and C1Mon will stop at the break point (the BASIC job is suspended in this case). Now you can examine the registers, trace, ... finally enter go again so that the code return to BASIC (it should then react normally).

Edith (2025-05-12 Mon): "...shouldn't then..." in last paragraph -> "...should then..."

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Wed Jun 11, 2025 11:35 pm
by ql_freak
 
   I'm (slowly) coming "firm" again with the C1 Monitor :‑D It's IMHO the best monitor for the QL. Is the source code available? If one could add a history device to its channel #0, this would be absolutely great! And even better (Minerva and SMSQ/E) check the ESC key when entering commands (so that this command will not be executed if "executed" with ESC). It's possible with QDOS now (was NOT, when C1Mon has had been written, was the first monitor IMHO).

Unfortunately I have not yet tested symbolic debugging with the Professional C1Mon (only a few people have it, and even less have the documentation which is just an addendum to the original manual).

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Thu Jun 12, 2025 8:18 am
by tofro
ql_freak wrote: Wed Jun 11, 2025 11:35 pm Unfortunately I have not yet tested symbolic debugging with the Professional C1Mon (only a few people have it, and even less have the documentation which is just an addendum to the original manual).
If you happen to have it, it would be good to make it available - Its author has, as far as I know, released it into the public.

Re: How to debug machine code PROCs/FNs with Computer One Monitor (C1MON)?

Posted: Thu Jun 12, 2025 11:22 am
by Derek_Stewart
Hi,

Here is my cleaned version of Computer 1 Assembler, Linker, Monitor.

C1ASM.pdf
(156.32 KiB) Downloaded 6 times
C1LINK.pdf
(27.77 KiB) Downloaded 11 times
C1MON.pdf
(138.07 KiB) Downloaded 6 times

I they need proof reading.