[Coco] DEF USR and strings?

Allen Huffman alsplace at pobox.com
Fri Oct 31 09:49:01 EDT 2025


Now that I now a USR function can detect if there is a number or string parameter there, it breaks something I had been doing.

If I EXEC &H3F00 to run my code, and it uses JMP INTCNV expecting an INT, then D will be seen as zero since (I guess) there is no parameter to parse when you use EXEC.

I made my code default to toggle… EXEC turns on, EXEC turns off.

That way, I would be able to do:

A=USR0(0) ‘TOGGLE

…as an alternative. If you just want the main hook installed, you can load an EXEC and use it. EXEC it again to turn it off.

I then added parameters to USR to specify control:

A=USR(1) ‘ ON
A=USR(-1) ‘ OFF

But, now with the "detect number/string” added, this will no longer work.

Is there a way to tell if a routine was called from USR versus EXEC?

		— A



More information about the Coco mailing list