Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Graphic difficulty

KRich84KRich84 Posts: 5Member
Hello out there. I've been using QBasic to rewrite a program that I wrote back in mid-school and I wanted to improve it by introducing graphics. Well, Memory capacities of QBasic are somewhat limited and I KNOW there has to be a way around it. I'm making a graphics editor for myself to use to make the graphics for the game, and in it I need a large array (300X300) to store the colors in the picture and another array large enough to contain a picture that has those dimensions, which means I need to use expanded memory (uses > 64k). I'm using bload and bsave to save the pictures to different files. Anyway, I set up the shortcut to QBX to include the /aH command. This allows me to have the big arrays, but runs me into another problem--apparently QBasic does not like 'bload' -ing anything into an array in expanded memory. Is there a way that I can make an array and be sure that it is not in expanded memory when I declare it?

Comments

  • IDKIDK Posts: 1,784Member
    : I need a large array (300X300) to store the colors in the picture and
    : another array large enough to contain a picture that has those
    : dimensions

    ??
    What do you mean by that?
    And how many colors are you needing?
    One way is to compres it and extract everything when you need it.
    I've done that some times.
    [hr]
    El PROgrammador Niklas Ulvinge
    (who doesn't know how to spell in inglish)

  • KRich84KRich84 Posts: 5Member
    : : I need a large array (300X300) to store the colors in the picture and
    : : another array large enough to contain a picture that has those
    : : dimensions
    :
    : ??
    : What do you mean by that?
    : And how many colors are you needing?
    : One way is to compres it and extract everything when you need it.
    : I've done that some times.
    : [hr]

    I have an array in the main module:
    DIM SHARED PXL(300, 300) AS INTEGER
    This is used to store the colors of each individual pixel in the graphic. I could use an array of strings to do the same thing, and it would eliminate the need for such a large array, but the main problem that I have is when I try to BLOAD a graphic from a file that was BSAVEed in the following way (below message), I get an illegal function call error. The only thing that I can think of that is making this error is that I'm trying to bload an image into an expanded memory array.

    'Save the image
    iN = 4 + INT((xsz * 1 + 7) / 8) * 4 * ysz / 2
    'formula in QBasic help for memory needed
    'for a graphic stored in numeric array
    DIM pik(iN) AS INTEGER
    GET (sX + 1, sY + 1)-STEP(xsz - 1, ysz - 1), pik
    DEF SEG = VARSEG(pik)
    BSAVE file$, VARPTR(pik)
    DEF SEG

    'To load the image
    iN = 4 + INT((xsz * 1 + 7) / 8) * 4 * ysz / 2
    DIM pik(iN) AS INTEGER
    DEF SEG = VARSEG(pik)
    BLOAD file$, varptr(pik)
    DEF SEG
    PUT (sX + 1, sY + 1), pik ' This is where I get my error

    Thanks
    Kent
  • KRich84KRich84 Posts: 5Member
    OK, there's my problem. I didn't have the right number in the BSAVE parameter list. It just wasn't saving the graphic to the file at all!
Sign In or Register to comment.