Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #1064 > unrolled thread

BBC BASIC 64bit integers (RISC OS)

Started bycferris@freeRemoveuk.com.invalid
First post2011-11-26 12:25 +0000
Last post2012-01-02 20:50 +0100
Articles 14 — 11 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  BBC BASIC 64bit integers (RISC OS) cferris@freeRemoveuk.com.invalid - 2011-11-26 12:25 +0000
    Re: BBC BASIC 64bit integers (RISC OS) Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-11-26 12:40 +0000
      Re: BBC BASIC 64bit integers (RISC OS) Jim Lesurf <jcgl@audiomisc.co.uk> - 2011-11-26 13:58 +0000
        Re: BBC BASIC 64bit integers (RISC OS) Steve Drain <steve@kappa.me.uk> - 2011-11-26 17:12 +0000
          Re: BBC BASIC 64bit integers (RISC OS) Steve Fryatt <news@stevefryatt.org.uk> - 2011-11-26 17:52 +0000
          Re: BBC BASIC 64bit integers (RISC OS) Erik G <erikg@noname.invalid> - 2011-11-27 12:52 +0100
      Re: BBC BASIC 64bit integers (RISC OS) jgharston <jgh@arcade.demon.co.uk> - 2011-11-26 15:12 -0800
        Re: BBC BASIC 64bit integers (RISC OS) Steve Drain <steve@kappa.me.uk> - 2011-12-07 19:53 +0000
          Re: BBC BASIC 64bit integers (RISC OS) Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-12-09 09:39 +0100
            Re: BBC BASIC 64bit integers (RISC OS) Steve Drain <steve@kappa.me.uk> - 2011-12-09 10:34 +0000
              Re: BBC BASIC 64bit integers (RISC OS) druck <news@druck.org.uk> - 2011-12-10 11:39 +0000
                Re: BBC BASIC 64bit integers (RISC OS) Gerph <gerph@gerph.org> - 2011-12-11 11:08 -0800
                  Re: BBC BASIC 64bit integers (RISC OS) Christopher Bazley <cs99cjb@gmail.com> - 2012-01-02 11:39 +0000
                    Re: BBC BASIC 64bit integers (RISC OS) Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2012-01-02 20:50 +0100

#1064 — BBC BASIC 64bit integers (RISC OS)

Fromcferris@freeRemoveuk.com.invalid
Date2011-11-26 12:25 +0000
SubjectBBC BASIC 64bit integers (RISC OS)
Message-ID<c9d02e3852.cferris@cferris.freeuk.com>
Ref RISC OS BBC BASIC

Is there a straight forward way of handling 64bit integers with BASIC?

Thanks
-- 
Colin Ferris Cornwall UK

[toc] | [next] | [standalone]


#1065

FromMartin Bazley <martin.bazley@blueyonder.co.uk>
Date2011-11-26 12:40 +0000
Message-ID<1038303852.martin@blueyonder.co.uk>
In reply to#1064
The following bytes were arranged on 26 Nov 2011 by cferris@freeRemoveuk.com.invalid:

> Ref RISC OS BBC BASIC
>
> Is there a straight forward way of handling 64bit integers with BASIC?

No.

-- 
  __<^>__   "Start off every day with a smile and get it over with."
 / _   _ \  - W.C. Fields
( ( |_| ) )
 \_>   <_/  ======================= Martin Bazley ==========================

[toc] | [prev] | [next] | [standalone]


#1066

FromJim Lesurf <jcgl@audiomisc.co.uk>
Date2011-11-26 13:58 +0000
Message-ID<52383759fcjcgl@audiomisc.co.uk>
In reply to#1065
In article <1038303852.martin@blueyonder.co.uk>, Martin Bazley
<martin.bazley@blueyonder.co.uk> wrote:
> The following bytes were arranged on 26 Nov 2011 by
> cferris@freeRemoveuk.com.invalid:

> > Ref RISC OS BBC BASIC
> >
> > Is there a straight forward way of handling 64bit integers with BASIC?

> No.

I don't know the OP means by "handling", but basic64 starts up here ok.

Slainte,

Jim

-- 
Electronics  http://www.st-and.ac.uk/~www_pa/Scots_Guide/intro/electron.htm
Armstrong Audio  http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc  http://www.audiomisc.co.uk/index.html

[toc] | [prev] | [next] | [standalone]


#1067

FromSteve Drain <steve@kappa.me.uk>
Date2011-11-26 17:12 +0000
Message-ID<f69Aq.93519$HA5.25650@newsfe30.ams2>
In reply to#1066
On 26/11/2011 13:58, Jim Lesurf wrote:
> In article<1038303852.martin@blueyonder.co.uk>, Martin Bazley
> <martin.bazley@blueyonder.co.uk>  wrote:
>> The following bytes were arranged on 26 Nov 2011 by
>> cferris@freeRemoveuk.com.invalid:
>
>>> Ref RISC OS BBC BASIC
>>>
>>> Is there a straight forward way of handling 64bit integers with BASIC?
>
>> No.
>
> I don't know the OP means by "handling", but basic64 starts up here ok.

Basic64 (BASIC VI) uses the FPE to do 64-bit floating-point values. 
Integers are still 32-bit.

I started to implement long integers (64-bit) in Basalt, but got no 
further than creating and printing them. There is a library or two 
around with routines for handling 64-bit integers, but I cannot lay my 
hands on one atm.

So, the first answer is correct, I think.

[toc] | [prev] | [next] | [standalone]


#1068

FromSteve Fryatt <news@stevefryatt.org.uk>
Date2011-11-26 17:52 +0000
Message-ID<mpro.lva4bo0ep8fcg01ji.news@stevefryatt.org.uk>
In reply to#1067
On 26 Nov, Steve Drain wrote in message
    <f69Aq.93519$HA5.25650@newsfe30.ams2>:

> There is a library or two around with routines for handling 64-bit
> integers, but I cannot lay my hands on one atm.

Routines, from 7th Software, has a one such library (I've never used it,
though).

  http://www.7thsoftware.co.uk/software.htm

-- 
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/

[toc] | [prev] | [next] | [standalone]


#1073

FromErik G <erikg@noname.invalid>
Date2011-11-27 12:52 +0100
Message-ID<4ed22472$0$16284$e4fe514c@dreader37.news.xs4all.nl>
In reply to#1067
On 26-11-2011 18:12, Steve Drain wrote:
> Basic64 (BASIC VI) uses the FPE to do 64-bit floating-point values.

For the technically minded: Basic64 uses the 64 bit format for storage
of floating point variables as defined in IEEE 754.
See <http://en.wikipedia.org/wiki/IEEE_754-1985>

Basic64 does this (as stated) by using the Floating Point Emulator (FPE)
or Floating Point Accelerator / software support code (FPA/FPASC).

BTW: the FPA (and presumably, by extension, the FPE) has 8 internal
registers with 81 bit precision, so intermediate results can have a
greater precision. This helps e.g. the calculation of sin(x), where only
the parameter x and the result are held in 64 bits, and all intermediate
calculations are done in 81 bits.

See <http://www.datasheetarchive.com/ARM%20FPA-datasheet.html>

-- 
Erik G.
From address is fake
See http://erikgrnh.home.xs4all.nl/

[toc] | [prev] | [next] | [standalone]


#1069

Fromjgharston <jgh@arcade.demon.co.uk>
Date2011-11-26 15:12 -0800
Message-ID<6dd01c58-e01f-4417-96c2-1dc586ff338c@f29g2000yqa.googlegroups.com>
In reply to#1065
Martin Bazley wrote:
> cfer wrote:
> > Is there a straight forward way of handling 64bit integers with BASIC?
>
> No.

Most straight forward is to store them in 8-byte blocks of memory
and use the /address/ of them to refer to them, and build up some
routines to manipulate them.

eg:
var1%=FNint64_create(1)
var2%=FNint64_create(2)
result%=FNint64_create(0)
PROCint64_add(result%,var1%,var2%)
PRINT FNint64_str(result%)

in a similar manner to the LongStrings library.

JGH

[toc] | [prev] | [next] | [standalone]


#1166

FromSteve Drain <steve@kappa.me.uk>
Date2011-12-07 19:53 +0000
Message-ID<LwPDq.217308$Vv5.177597@newsfe05.ams2>
In reply to#1069
On 26/11/2011 23:12, jgharston wrote:
> Martin Bazley wrote:
>> cfer wrote:
>>> Is there a straight forward way of handling 64bit integers with BASIC?
>>
>> No.
>
> Most straight forward is to store them in 8-byte blocks of memory
> and use the /address/ of them to refer to them, and build up some
> routines to manipulate them.
>
> eg:
> var1%=FNint64_create(1)
> var2%=FNint64_create(2)
> result%=FNint64_create(0)
> PROCint64_add(result%,var1%,var2%)
> PRINT FNint64_str(result%)

For a few operations that is fine, but it does not integrate long and 
normal integers and may leave unwanted temporary values around.

I was stimulated by this, and Steve's !Routines, to put some flesh on 
ideas I had for Basalt, rather like the Strings library I just released.

The Longs library is not quite as nicely integrated, but it treats 
normal and long integers the same and removes transient values as soon 
as they are used.

All the normal integer operations are emulated.

I have uploaded the Longs library to:

   http://www.kappa.me.uk/longs.htm

I hope it may be of interest.

Steve

[toc] | [prev] | [next] | [standalone]


#1169

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2011-12-09 09:39 +0100
Message-ID<4ee1c942$0$2528$ba4acef3@reader.news.orange.fr>
In reply to#1166
On 07/12/2011 20:53, Steve Drain wrote:

> I have uploaded the Longs library to:
> http://www.kappa.me.uk/longs.htm

Doesn't RISC OS have 64 bit filesystem SWIs now?

<clicky>

Mmm... ADFS_FreeSpace64

Could be a way to use this sort of info in BASIC?


Best wishes,

Rick.

[toc] | [prev] | [next] | [standalone]


#1170

FromSteve Drain <steve@kappa.me.uk>
Date2011-12-09 10:34 +0000
Message-ID<nwlEq.92875$Rz.33798@newsfe29.ams2>
In reply to#1169
On 09/12/2011 08:39, Rick Murray wrote:
> On 07/12/2011 20:53, Steve Drain wrote:
>
>> I have uploaded the Longs library to:
>> http://www.kappa.me.uk/longs.htm
>
> Doesn't RISC OS have 64 bit filesystem SWIs now?
>
> <clicky>
>
> Mmm... ADFS_FreeSpace64

I had a look, but the ADFS SWIs are not documented in the Wiki; the 
Filecore SWIs are.

FreeSpace64 requires the LSW and MSW to be specified separately.
DiscOp64 requires an 3-word address block, comprising the disc number 
and a 2-word long integer. This is not consistent and it means that 
FNiPTR from my library could not be used directly in either, nor could 
any internal change to BASIC integers.

I cannot find any OS_GBPB64, so I assume files are still limited to 
32-bit size.

> Could be a way to use this sort of info in BASIC?

I am not sure there is much scope for this yet. ;-)

Steve


[toc] | [prev] | [next] | [standalone]


#1173

Fromdruck <news@druck.org.uk>
Date2011-12-10 11:39 +0000
Message-ID<jbvgdg$jsi$1@dont-email.me>
In reply to#1170
On 09/12/2011 10:34, Steve Drain wrote:
> On 09/12/2011 08:39, Rick Murray wrote:
>> On 07/12/2011 20:53, Steve Drain wrote:
>>
>>> I have uploaded the Longs library to:
>>> http://www.kappa.me.uk/longs.htm
>>
>> Doesn't RISC OS have 64 bit filesystem SWIs now?

No all the filing systems are 32bit, it just has a 64 bit call to return 
the amount of disc space, which has been over 2GB for some considerable 
time now.

> DiscOp64 requires an 3-word address block, comprising the disc number
> and a 2-word long integer. This is not consistent and it means that
> FNiPTR from my library could not be used directly in either, nor could
> any internal change to BASIC integers.

ADFS_DiscOp64 is only partially implemented by mapping down to 
ADFS_SectorOp. There isn't any support further up the fs heirarchy for 
64 bit addressing. I do use it in DiscKnight if available.

> I cannot find any OS_GBPB64, so I assume files are still limited to
> 32-bit size.

All api's concerning files are still 32 bit.

>> Could be a way to use this sort of info in BASIC?

In the case of the free space calls, you'd be better off with a couple 
of lines of assembler to turn the 64bit byte value in to a 32bit 
megabyte or gigabyte value, and return that to BASIC.

---druck

[toc] | [prev] | [next] | [standalone]


#1175

FromGerph <gerph@gerph.org>
Date2011-12-11 11:08 -0800
Message-ID<fe667820-8270-468e-8d90-d16c76b3f975@4g2000yqu.googlegroups.com>
In reply to#1173
On Dec 10, 11:39 am, druck <n...@druck.org.uk> wrote:
> On 09/12/2011 10:34, Steve Drain wrote:
>
> > On 09/12/2011 08:39, Rick Murray wrote:
> >> On 07/12/2011 20:53, Steve Drain wrote:
>
> >> Could be a way to use this sort of info in BASIC?
>
> In the case of the free space calls, you'd be better off with a couple
> of lines of assembler to turn the 64bit byte value in to a 32bit
> megabyte or gigabyte value, and return that to BASIC.

If you want to use a sledgehammer to crack a nut, yes you could.
If you were feeling less insane you'd just do the maths in BASIC:

megabytes% = (low% >>> 20) OR (high% << 12)
gigabytes% = (low% >>> 30) OR (high% << 2)

--
Gerph

[toc] | [prev] | [next] | [standalone]


#1243

FromChristopher Bazley <cs99cjb@gmail.com>
Date2012-01-02 11:39 +0000
Message-ID<8889384b52.chris@blueyonder.co.uk>
In reply to#1175
In message <fe667820-8270-468e-8d90-d16c76b3f975@4g2000yqu.googlegroup 
s.com>
          Gerph <gerph@gerph.org> wrote:

> On Dec 10, 11:39 am, druck <n...@druck.org.uk> wrote:
>> On 09/12/2011 10:34, Steve Drain wrote:
>>
>>> On 09/12/2011 08:39, Rick Murray wrote:
>>>> On 07/12/2011 20:53, Steve Drain wrote:
>>
>>>> Could be a way to use this sort of info in BASIC?
>>
>> In the case of the free space calls, you'd be better off with a couple
>> of lines of assembler to turn the 64bit byte value in to a 32bit
>> megabyte or gigabyte value, and return that to BASIC.

> If you want to use a sledgehammer to crack a nut, yes you could.
> If you were feeling less insane you'd just do the maths in BASIC:

> megabytes% = (low% >>> 20) OR (high% << 12)
> gigabytes% = (low% >>> 30) OR (high% << 2)

I wish usenet had a 'like' button. Too much time spent on Facebook.

-- 
Chris Bazley
Star Fighter 3000: http://starfighter.acornarcade.com/

[toc] | [prev] | [next] | [standalone]


#1249

FromRick Murray <heyrickmail-usenet@yahoo.co.uk>
Date2012-01-02 20:50 +0100
Message-ID<almarsoft.2645914895887114773@news.orange.fr>
In reply to#1243
On Mon, 02 Jan 2012 11:39:06 GMT, Christopher Bazley 
<cs99cjb@gmail.com> wrote:

> I wish usenet had a 'like' button. Too much time spent on Facebook.

It is a meaningless statistic - how many looked and didn't "Like" and 
how many *dis*liked?

FWIW, Gerph's little piece of bit shifting, +1 Like. ;)


Best wishes,

Rick.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web