[Coco] A bug in Basic09/RunB
Wayne Campbell
asa.rand at gmail.com
Mon Dec 7 22:51:09 EST 2009
Gene,
I have looked at the structure of the REAL variables in Basic09 and OSK
Basic. I compared them to each other, and to the definition of a float and a
double in OS-9 C. From what I could tell, you can convert a Basic09 REAL to
a C float, or a C double, by writing a subroutine in C. Did you ever try
something like that?
For the parameters, I think it wouldn't be that much to use the same routine
you use to convert a int back to a byte after the operation to either move
the parameter pointer forward one byte, or set the value of the first byte
equal to the second byte. Either way would pass the correct value. Since
this is built-in to Basic09 already, how much extra code does it take to use
it?
In the area of passing arrays, I would look at the way it is exiting
whatever loop it uses to access parameters in the list. I think it's a
simple matter of getting the correct number of parameters to equal the size,
in either direction. Then you can pass 3 ints into 1 array, or one array
into 3 ints. Memory wise, they occupy the same amount of space, and it is
contiguous in most cases as I have found them in the I-Code. Programmers
tend to group things differently, but each grouping has a pattern.
For dealing with the record field depths, it is as simple as resolving the
address down to the specific field address, and getting the size of that
field. Basic09 is not resolving the address down to the specific field
before getting the reference.
Wayne
----- Original Message -----
From: "Gene Heskett" <gene.heskett at verizon.net>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Monday, December 07, 2009 6:26 PM
Subject: Re: [Coco] A bug in Basic09/RunB
> On Monday 07 December 2009, Wayne Campbell wrote:
>>Gene,
>>
>>When I said they never intended to pass a single byte, I meant by value. I
>>know that passing byte variables by reference works. I use it all the
>>time.
>>This is all the more why passing a byte by value should work as well, IMO.
>>It seems the original authors decided it was too much extra code to fix,
>>or
>>just wasn't a priority.
>>
>>Wayne
>>
> Possibly. I have passed by value on numerous occasions, but you can't do
> math 'in' the call. Either before or in the subroutine has always worked
> if
> my wet ram can be trusted at 75. If it had been a problem I'm sure I
> would
> have remembered it. That may be something that since it could be coded
> around, wasn't worth the extra bytes to handle it in the call. This
> basic,
> FWIW was from what I've read back in the foggy past, modeled more or less
> on
> True Basic, and what little TB code I wanted to use was pretty easily
> adapted, although the biggest piece I re-wrote in C as it needed the C's
> math
> precision of about 17 digits. B09's 5 byte representation of a real sorta
> gets wonky when you want minute accuracy over nearly 6700 years. :)
>
>>On Mon, Dec 7, 2009 at 4:27 AM, Gene Heskett
> <gene.heskett at verizon.net>wrote:
>>> On Monday 07 December 2009, Wayne Campbell wrote:
>>> >Robert,
>>> >
>>> >Thanks for the clarification. I didn't think to change the received
>>> > parameter to a INTEGER to see what would happen.
>>> >
>>> >I think I found Microware's slant in the manual. I don't know why I
>>> > never saw it before:
>>> >
>>> >"If the called procedure is expecting a BYTE-type
>>> >variable, it uses only the high-order byte of the (two-byte) INTEGER
>>> > (which, if the value was intended to be in BYTE-range, will probably
>>> > be
>>> > zero!)."
>>> >
>>> >I guess they never intended to pass a single byte.
>>> >
>>> >Wayne
>>>
>>> It does work however since a #PATH is a byte. Also, ISTR when I was
>>> passing
>>> bytes, I set them as hexidecimal style numbers. giving it an only 2
>>> nibble wide value. The simple A+1 syntax can even have a real involved
>>> at some point if my wet ram can be trusted. In b09, that IIRC is a 5
>>> byte long value.
>>>
>>> --
>>> Cheers, Gene
>>> "There are four boxes to be used in defense of liberty:
>>> soap, ballot, jury, and ammo. Please use in that order."
>>> -Ed Howdershelt (Author)
>>> The NRA is offering FREE Associate memberships to anyone who wants them.
>>> <https://www.nrahq.org/nrabonus/accept-membership.asp>
>>>
>>> Frankly, Scarlett, I don't have a fix.
>>> -- Rhett Buggler
>>>
>>> --
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> http://five.pairlist.net/mailman/listinfo/coco
>>
>>--
>>Coco mailing list
>>Coco at maltedmedia.com
>>http://five.pairlist.net/mailman/listinfo/coco
>>
>
>
> --
> Cheers, Gene
> "There are four boxes to be used in defense of liberty:
> soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> The NRA is offering FREE Associate memberships to anyone who wants them.
> <https://www.nrahq.org/nrabonus/accept-membership.asp>
>
> The sooner you fall behind, the more time you have to catch up.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list