array of more then 1 MB?

First of all, one of the letters on my keyboard isn't working, so I think my post will be a little arbled.

I've been tryin to create an array to load a file of 1,063,939 bytes in memory, but it keeps tellin me there isn't enough memory, is there any way I can use extended memory to load it? Any other way to load the file in memory and write it to a file later is fine too.

Thanks.

Comments

  • : First of all, one of the letters on my keyboard isn't working, so I think my post will be a little arbled.
    :
    : I've been tryin to create an array to load a file of 1,063,939 bytes in memory, but it keeps tellin me there isn't enough memory, is there any way I can use extended memory to load it? Any other way to load the file in memory and write it to a file later is fine too.
    :
    : Thanks.
    :

    I am not sure what version of BASIC you are using, but I can share some info I know about Quick Basic that may put you on the right track.

    Quick Basic offers some statements which may help you with this. These are:

    BLOAD - This loads a memory-image file, created by BSAVE, into memory from an input file. The format is: BLOAD filename,offset

    BSAVE - This transfers the contents of a memory area to an output file.
    The format is: BSAVE filename,offset,length

    Before using these statements, you should probably use the following statement:

    DEF SEG - This sets the current segment address for a subsequent BLOAD or BSAVE. The format is: DEF SEG =address

    So, you would probably accomplish this by doing the following in your code:

    ** NOTE ** the lower case words below represent parameters you specify in the statement.

    DEF SEG = address
    BLOAD infilename,offset
    BSAVE outfilename,offset,length

    Personally, this is something I have never done, but I think this may put you on the right track. Furthermore, I'm not certain you can store a full megabyte in memory this way. You may hit the old notorious 640K limitation, but you can always break the file up by doing this twice and appending. Consult some books and target these statements. There, you will probably find more info regarding the memory address and offset you should use. These are real important, because if you don't have the addresses and offsets right, you could walk over memory and cause problems like locking your computer.

    Hope this helps!! Good Luck!!

  • try to use a library, you need qbasic 4.5 or higher for that. there are some libraries out where you can ems or xms memory. otherwise it whould be hard to use such a big amount of memory because qbasic itself only support the normal memory (64kb)
  • : First of all, one of the letters on my keyboard isn't working, so I think my post will be a little arbled.
    :
    : I've been tryin to create an array to load a file of 1,063,939 bytes in memory, but it keeps tellin me there isn't enough memory, is there any way I can use extended memory to load it? Any other way to load the file in memory and write it to a file later is fine too.

    You didn't say which BASIC and which OS you use. If it's QuickBasic or QBasic, you're out of luck. QuickBasic is a DOS program, so you will never find room for a megabyte of data without using a DOS extender.

    XBasic is free (open source), and available for Windows (32-bit versions) and Linux. It can generate a standalone .exe file and has lots of goodies that QB lacks, including signed and unsigned integers sizes from 8 to 64 bits, plus the two IEEE floating-point formats. XB will use all available memory, so you can just DIM Foo(1063939).
    The only drawback is the learning curve. The syntax is just different enough to drive a QB programmer nuts at first, and all identifiers are case-sensitive. See www.xbasic.org

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories