[Coco] USRx() and adding more parameters?
Bill Gunshannon
bill.gunshannon at hotmail.com
Wed Nov 5 14:07:26 EST 2025
On 11/5/2025 1:13 PM, Sean Conner via Coco wrote:
> It was thus said that the Great Allen Huffman via Coco once stated:
>> The BASIC ROM has the USR function:
>>
>> DEF USR0=&H3F00
>>
>> A=USR0(42)
>>
>> It accepts one parameter.
>>
>> Since it jumps from BASIC into the USR assembly, couldn’t that code just
>> parse a “,” and more numbers, allowing it to accept whatever needed to be
>> passed in?
>>
>> A=USR0(1,2,3,4)
>
> Attached is another proof-of-concept. This implements a USRn function
> that draws a pattern (8x8, based on early Mac background patterns) on the
> screen in a given area, and cycles through 38 such patterns when you hit a
> key. It works best in PMODEs 0, 2 or 4. The critical line is:
>
> 110 X=USR0(P),(65,49)-(190,142)
>
> The first parameter is the pattern #, then a comma, then the upper left
> corner, then the lower right corner of the area to draw the pattern, using
> the code BASIC uses to parse the LINE command. Looks weird, but it works.
>
Wouldn't it just be easier to pass an address as that one argument and
have it point to a block containing as many parameters as you want?
bill
More information about the Coco
mailing list