Loading Images from PP256

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Guest

Loading Images from PP256

Post by Guest »

I just can't figure out how to load the DATA made from PixelPlus into QBasic. I get no image at all, ive tried reading tuts on this but i just dont know. If someone could post the code or send it to VirtualMeth@gmail.com i would really appreciate it.
User avatar
The Awakened
Veteran
Posts: 144
Joined: Sun Aug 07, 2005 1:51 am

Post by The Awakened »

Don't use DATA Statements. Icky. Save them as a regular bsave file, and then to load them, use this:

Code: Select all


DIM Image%(130)  'This is 260 bytes, as each integer is 2 bytes. This is
                             'enough for a 16 by 16 image. The formula for figuring
                             'out how many bytes you will need is width * height
                             '+ 4, and that's the amount of bytes. Divide this
                             'number by 2 to get how many integers you will need.
                             'Round up if you have an odd number... although
                             'odd numbers are wayyyyy slower to put to the screen

DEF SEG = VARSEG(Image%(0)) 'This sets our default segment in which
                                                 'the array that will hold our image
                                                 'resides
BLOAD "myimg.img", VARPTR(Image%(0)) 'this loads the image
DEF SEG          'resets the default segment

PUT (0,0), Image%(0)

"Sorry for beating you up with a baseball bat Julian, but I DID think that you were a samsquanch."
Post Reply