*LOAD

Discussions related to database technologies, file handling, directories and storage
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

*LOAD

Post by Ric »

Afternoon all,
Cant believe i am asking this but how do you use *LOAD
I have tried a few combinations of variables/addresses but can not get the bmp file to load into memory!!!!

Code: Select all

      MODE 1
      HIMEM=(LOMEM+500000000) AND -4
      DIM image 225*225*4+500
      address% = ^!image
      *LOAD "Wood.bmp", address%,address%+&318F8
Please could some one correct this snippet.
The bmp file is X= 225, Y= 225

kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: *LOAD

Post by Ric »

I now know that the image is 225x225 and in 24bit form.

The error I am getting is "Address out of range"
The file exists in the same folder as the main program.
Still hoping, Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
DDRM

Re: *LOAD

Post by DDRM »

The manual suggests using OSCLI if you are going to give a string for the file name?

This works for me:

Code: Select all

      t$="Round the rugged rock the ragged rascal ran"
      f%=OPENOUT("tempsentence.txt")
      PRINT#f%,t$
      CLOSE#f%
      DIM text 5000
      OSCLI "LOAD tempsentence.txt " + STR$~(text)
      FOR x%= 0 TO LEN(t$)-1
        PRINT CHR$(text!x%);
      NEXT x%
      PRINT
Note the space after the file name, to separate the data block address as a separate parameter (Looks like you need spaces rather than commas between the parameters: changing this alone might rescue your code?).
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: *LOAD

Post by Ric »

Thanks DDRM, worked a charm.
Got some stuff to post later under D3D9 Lessons
Regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: *LOAD

Post by Ric »

Dear all,
please can someone help?

All i am trying to do is load a bmp in to memory and display it using *MDISPLAY, i thought would be a simple exercise, but it appears not. I still get address out of range!!
In the manual under *MDISPLAY it says you can load an image using *LOAD. I have tried many ways to get a simple program to work and failed.

Surely

Code: Select all

      DIM picture 1000000
      *LOAD "Maple Wood.bmp" ~picture
should load the image in to memory!!

What am i doing wrong
I have tried

Code: Select all

     DIM picture 1000000
     OSCLI "LOAD Maple Wood.bmp " + STR$~(picture)
as well.

Please can some one help??

Kind Regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
David Williams

Re: *LOAD

Post by David Williams »

This works fine for me:

Code: Select all

      REM For this example, the BMP image must reside in the same
      REM folder from which this program is run.
      file$ = @dir$ + "ball0.bmp"
      F% = OPENIN( file$ )
      IF F% = 0 ERROR 0, "Can't load " + file$
      S% = EXT#F%
      CLOSE#F%
      DIM bmpdata% S%
      OSCLI "LOAD """ + file$ + " """ + STR$~bmpdata%
      OSCLI "MDISPLAY "+STR$~bmpdata%
Copy & paste into (for example) the BB4W IDE, then save the program somewhere. Make sure the BMP file is in the same folder as where the program is saved. Obviously, modify the BMP file name (file$) accordingly.
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: *LOAD

Post by Ric »

Thanks David
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: *LOAD

Post by KenDown »

Hmmmm. Richard posted a neat way of doing this using a string variable.

Code: Select all

OSCLI("SCREENSAVE "+@dir$+"Temp.bmp "+STR$l%+","+STR$t%+","+STR$w%+","+STR$h%)
bf%=OPENIN(@dir$+"temp.bmp"):bmp$=GET$#bf% BY EXT#bf%:CLOSE#bf%
SYS"SetStretchBltMode",@memhdc%,3
OSCLI("MDISPLAY "+STR$~PTR(bmp$)+" "+STR$l%+","+STR$t%+","+STR$w%+","+STR$h%)
 
(The first and second lines may be my addition for my purposes.)

The only problem I find is that it only works once with a large screensave and the next time crashes with a "No room" error. If anyone has any bright ideas on what I am doing wrong, I'll be pleased to hear them - I suspect it revolves around getting rid of bmp$ at the end of the routine, but I don't know how to do that.