🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #12132

Variable Addresses in AmigaBasic

#12132
From: Bernie Cosell
Date: Fri, 07 Apr 1989 15:27
34 lines
2263 bytes
[are you allowed to ask "basic" questions in the .tech group... I guess I'll
find out..:-)]

I have a bunch of Basic programs which have the need to move LARGE quantities
of data in and out.  I was looking at an old ABasiC program and I noticed that
_it_ used a thing called "bload".  Now I don't exactly know what that does, but
I guessed it did a "binary load", and that seemed like a great idea.  SO...
I whipped up some simple code to do a big xRead to suck the stuff in in one
gulp.  My problem: how can I do that from a *subroutine*?  The problem is
passing in the address of the place where the loading is to go (or the address
of the stuff to be dumped for bdump).  I had originally inteded to do it with:
     SUB BLoad (FileName$, Address&) STATIC
and then have the guy on the outside call it as
    CALL BLoad ("datafile.dat", VARPTR(dataarrar(1)))

But then I realized that since Basic *moves* variables around, the "Address&"
will be mostly useless by tthe time I get around to the xRead().  Two
questions:
  a) is there some way to _beat_ the var-moving problem?  Passing in the
  memory-address explicitly is surely the most convenient scheme, if I could
  make it work, and
  b) if not, how then could I declare that subroutine?  I'm OK with the program
  always reading into a array (hard to imagine that this is all that useful for
  reading in a single value, and even then you can just set up a one-long
  array).  BUT: how to get the *types* to match???  I can easily do:
      SUB BLoad (FileName$, Array()) STATIC
  and do the VARPTR inside the subroutine, but how do I handle arry-of-shorts
  versus array-of-floats, etc.

Thanks
   __
  /  )                              Bernie Cosell
 /--<  _  __  __   o _              BBN Sys & Tech, Cambridge, MA 02238
/___/_(<_/ (_/) )_(_(<_             cosell@bbn.com
Technical Details
Message-ID: <38410@bbn.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!bbn.com!cosell

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!bbn.com!cosell
From: cosell@bbn.com (Bernie Cosell)
Newsgroups: comp.sys.amiga.tech
Subject: Variable Addresses in AmigaBasic
Message-ID: <38410@bbn.COM>
Date: 7 Apr 89 15:27:51 GMT
Sender: news@bbn.COM
Reply-To: cosell@BBN.COM (Bernie Cosell)
Organization: Bolt Beranek and Newman Inc., Cambridge MA
Lines: 34