Re: DEF USR and strings?

Allen Huffman via Coco <coco-uNHYcr1XS/wmlAP/[email protected]>
Newsgroups gmane.comp.hardware.tandy.coco
Message-ID <[email protected]>
> On Oct 29, 2025, at 10:49 PM, Sean Conner via Coco <[email protected]> wrote:
> 
>  Not only that, but the registers upon calling USRn (ECB) are (from my
> notes):
> 
> 	       USRn    Entry point to user-callable machine language subroutine
> 	Entry: A - 0   if paramater in FP0 is a number
> 	         - 255 if parameter in FP0 is a string descriptor
> 	       B - length if string descriptor
> 	       X - FP0EXP if A=0
> 	         - string descriptor if A=255
> 	       Zf - 1 if A = 0
>                  - 0 if A = 255
> 	       Zn - 1 if A = 255
>                  - 0 if A = 0
> 	       FP0 + _STRPTR - string descriptor if A=$FF
> 	       VALTYP - same as A
> 	
> 	Note:  ECB/DECB allow returning a string value.
> 	
> 	       Changing the characters of the string pointer is undefined; changing
> 	       the contents of the string descriptor is allowed.
> 
>  Because the flags reflect the value in A, there's no need to CMPA or TSTA
> before jumping if supporting both a string or numeric input.  Also, INTCVT
> does a type check, so calls to CHKNUM (a name I came up with) isn't required
> if calling INTCVT.
> 
>  USR (from Color BASIC) doesn't set the registers with any meaningful
> values, just FYI.
> 
>  -spc

Thank you for your service!

May I quote some of your messages here in an upcoming blog post?

I want to scan through Rainbow archives and see if this “return a string” was ever addressed in Rainbow. With the references in the Getting Started with Extended BASIC saying you could do it, but no examples of how to make it work, I wonder if someone saw that back then and figured this out.

	— Allen

-- 
Coco mailing list
[email protected]
https://pairlist5.pair.net/mailman/listinfo/coco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.