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..."