[Coco] BASIC09 - unsigned INTEGERs?

K. Pruitt pruittk at roadrunner.com
Sun Feb 1 10:04:48 EST 2015


----- Original Message ----- 
From: "K. Pruitt" <pruittk at roadrunner.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Sunday, February 01, 2015 6:39 AM
Subject: Re: [Coco] BASIC09 - unsigned INTEGERs?


>
> ----- Original Message ----- 
> From: "Robert Gault" <robert.gault at att.net>
> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
> Sent: Sunday, February 01, 2015 6:20 AM
> Subject: Re: [Coco] BASIC09 - unsigned INTEGERs?
>
>
>> Allen Huffman wrote:
>>>> On Feb 1, 2015, at 7:45 AM, K. Pruitt <pruittk at roadrunner.com> wrote:
>>>>
>>>> This is from the rainbow mag and it does print the correct value:
>>>>
>>>> PROCEDURE filesize
>>>> TYPE Registers=CC,A,B,DP:BYTE; X,Y,U:INTEGER
>>>> DIM regs:Registers
>>>> DIM path,callcode:BYTE
>>>> OPEN #path,"test":READ
>>>> callcode=$8D
>>>> regs.A:=path
>>>> regs.B=$02
>>>> RUN SysCall(callcode,regs)
>>>> CLOSE #path
>>>> PRINT USING "'Filesize = $',2(h4)",regs.X; regs.U
>>>>
>>>> I created a file with a size of 92324 bytes and it prints out the 
>>>> correct value of 000168A4.
>>>>
>>>> I guess the real question now is how do we get this result in to a 
>>>> variable.
>>>
>>> Right. That code there is the example from the SYSCALL source code, 
>>> apparently, from the OS-9 Level 1 days.
>>>
>>> http://www.cocopedia.com/wiki/index.php/SysCall.asm_Level_1 
>>> <http://www.cocopedia.com/wiki/index.php/SysCall.asm_Level_1>
>>>
>>> — A
>>>
>>>
>>>
>>
>> Well that might work given typical file sizes but for general math, there 
>> are still problems. After some testing, it looks like a big problem 
>> resides in PRINT USING.
>>
>> DIM a:INTEGER; b:REAL
>> a=$FE
>> b=a*16777216.
>> PRINT b
>> PRINT USING "h8",b
>>
>> 4.261141286E+09
>> 20FE0000
>>
>> The real product is correct but PRINT USING can't convert to the correct 
>> hexadecimal notation. The hex answer is $FE000000.
>>
>> Robert
>>
>>
>
>
> Yeah, you're right regarding general math use.  But as far as sizing 
> files, what would you consider as a reasonable maximum to shoot for?
>
>


I think I answered my own question.  If my math is correct the largest file 
size possible to be reported by syscall in two 16 byte registers is 
4294967295.




More information about the Coco mailing list