[comp.lang.pascal] Basic to Turbo 4.0

opergb@uvm-gen.UUCP (Gary Bushey) (06/16/88)

Does anyone know how to translate the basic program 

1 SCREEN 1
2 DIM ARRAY%(500)
3 BLOAD "FILENAME",VARPTR(ARRAY%(0))
4 PUT (0,0),ARRAY%

into Turbo Pascal 4.0 either with or without the Graphix Toolbox?

Any help would be most useful and appreciated.

Thanks in advance.

Gary Bushey
E-mail :opergb@uvm-gen.UUCP 

mbk@hpsemc.HP.COM (Miles Kehoe) (06/18/88)

>
>1 SCREEN 1
>2 DIM ARRAY%(500)
>3 BLOAD "FILENAME",VARPTR(ARRAY%(0))
>4 PUT (0,0),ARRAY%
>
>Gary Bushey
>E-mail :opergb@uvm-gen.UUCP 
----------

Gary: It's been a long time for me since I played with GWBASIC, which
this program looks to be based on.  I'll take a hack at it over the
weekend, but I *can* tell you right now what it's doing.... that 
by itself might be a start for you.

You're dimensioning an integer array (hence the % notation) called
'ARRAY' of 501 elements, from 0 to 500.  BLOAD loads a file into 
the memory address contained in the argument 'VARPTR()'... here, it
looks like the address of the zeroth element of your integer array.
Finally, (here's where I'm guessing for now) the PUT locates the
variable at screen address (0,0) : and I'm *guessing* it treats
ARRAY% as an entire integer array, hence dumping the entire image
to screen memory locations starting at (0,0).  

BLOAD files are created by BSAVE'ing them.  Like I said, it's been
a while, but I think the format of a BLOAD file is something like
this:

  Bytes     Contents
  1         File id code identifying this as a BLOAD/BSAVE file
  2,3       16 bit address of starting segment of memory
  4,5       16 bit address of starting offset in segment
	    (I *might* have these two turned around.....)
  6,7       16 bit length of the BSAVE'd data (ie, number of
	    bytes which remian in this file after these bytes.
  8 - n     Number of bytes contained in bytes 6 and 7 representing
	    a direct image of memory (ie, a screen)

Like I said, I have to check on how PUT works.... but it looks to me
like it's trying to write to screen. I'll play with Turbo P... there
is no BLOAD... but I think by defining a memory variable over 
the screen you might be able to fake it. I'll email to let you
know what I find.


Miles Kehoe
Days at 408-725-3826