Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two pictures in one BSAVE file?

Status
Not open for further replies.

sandmann999

Programmer
Apr 28, 2001
52
US
Someone was telling me that it is possible to put two or more pictures into one BSAVE file using the offset feature.
However, with some playing around with this, I couldn't get it to work. Does anyone know how to do it?

This is what I was trying

SCREEN 13

DIM pic%(500)
DIM pic2%(500)

'(code for GETting pictures here, putting one picture
'into pic% and the other picture into pic2%)

DEF SEG = VARSEG(pic%(0))
BSAVE "test.pic", 0

DEF SEG = VARSEG(pic2%(0))
BSAVE "test.pic", 500

'Then to load the pictures:

DEF SEG = VARSEG(pic%(0))
BLOAD "test.pic", 0
DEF SEG = VARSEG(pic2%(0))
BLOAD "test.pic", 500

PUT (10,10),pic%
PUT (100,100),pic2%

I kept getting errors, and I'm not sure what to do differently. If someone could guide me in the right direction, I would appreciate it. Thanks!
 
what errors were you getting?

also if your array is 500 you might want to offset to 1000 since an integer is 2 bytes ;-)

Dim pic%(500) is the same as Dim pic(500) as integer
which is actually 1000 bytes of information...

for example...
the sceen is 320 x 200 in SCREEN 13

that is 64000 bytes...

but you only need to define 32001 bytes...

((totalx x totaly) / BytesPerInteger) - 1forZero
((320 x 200) / 2) - 1 = 31999
then add 2 bytes for the height and width
31999 + 2 = 32001

try this:
Code:
Dim scrn(32001) as integer
  Screen 13
  Get (0,0)-(319,199),Scrn
  Line (0,0)-(319,199), 15
  A$ = Input$(1)
  Put (0,0),Scrn,Pset

Now, the offset should be in bytes, so try your code again, but double the integer for bytes... (500 integer = 1000 bytes)

Code:
  DEF SEG = VARSEG(pic%(0))
  BSAVE "test.pic", 0
  DEF SEG = VARSEG(pic2%(0))
  BSAVE "test.pic", 1000

  DEF SEG = VARSEG(pic%(0))
  BLOAD "test.pic", 0
  DEF SEG = VARSEG(pic2%(0))
  BLOAD "test.pic", 1000

Good Luck,
Tell me if it works ;-)

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
Hrm...didn't seem to make much difference. However, I'm probably not using your code right.
Here's a copy of the complete code:


'---start---

SCREEN 13
DIM SCRN(32001) AS INTEGER
DIM PIC(1250) AS INTEGER
DIM PIC2(1250) AS INTEGER
DIM PIC3(1250) AS INTEGER
DIM PIC4(1250) AS INTEGER

GET (0, 0)-(319, 199), SCRN
LINE (0, 0)-(319, 199), 15
A$ = INPUT$(1)
PUT (0, 0), SCRN, PSET

FOR Y = 1 TO 5
FOR X = 1 TO 5
READ Z
LINE (X * 5 - 5, Y * 5 - 5)-(X * 5, Y * 5), Z, BF
NEXT
NEXT
FOR Y = 1 TO 5
FOR X = 1 TO 5
READ Z
LINE (X * 5 + 40, Y * 5 - 5)-(X * 5 + 45, Y * 5), Z, BF
NEXT
NEXT
GET (0, 0)-(25, 25), PIC%
GET (45, 0)-(70, 25), PIC2%

DEF SEG = VARSEG(PIC%(0))
BSAVE "TEST.PIC", 0, 1250
DEF SEG = VARSEG(PIC2%(0))
BSAVE "TEST.PIC", 1250, 1250

CLS

DEF SEG = VARSEG(PIC3%(0))
BLOAD "TEST.PIC", 0
DEF SEG = VARSEG(PIC4%(0))
BLOAD "TEST.PIC", 1250

PUT (10, 10), PIC3%, PSET
PUT (100, 100), PIC4%, PSET

DATA 1,0,0,0,1
DATA 0,1,0,1,0
DATA 0,0,1,0,0
DATA 0,1,0,1,0
DATA 1,0,0,0,1

DATA 4,0,4,0,4
DATA 0,3,0,3,0
DATA 2,0,2,0,2
DATA 0,1,0,1,0
DATA 5,0,5,0,5

'---stop---
 
When it gets to the PUT statement, it gives me an "ILLEGAL FUNCTION CALL" error.
 
I think that if it was possible that would be awsome, but I thing when a BSAVE Statement is issued it overwrites the original file, but I'm prolly wrong since I'm usually wrong about most things. Well I'm pretty sure that the name of the picture doesn't matter Like after BSAVEing pic1% you can load it with any other name. Maybe if you changed the (#) like
BSAVE filename$, varptr(pic1%(0)), 500
BSAVE filename$, varptr(pic2%(1)), 500
but I don't know the structure of BSAVE so I'll study it some more.

"Pizza tastes good because its a combination of great foods" KenshinHimura's quote
 
You could always BSAVE the whole screen (with all your tiles next to each other.
DEF SEG = &HA000
BSAVE "screen13.scr", 0, 64000
and then load the screen and GET your tiles.
 
Am I missing something?
pic% is an integer by array 1250
integers are two bytes, you also seem to be forgetting that pic%(0) counts as 1.
so to figure out he size of the BSAVE file you have to use this code
1251*2
DEF SEG = VARSEG(PIC%(0))
BSAVE "TEST.PIC", 0, 2502
DEF SEG = VARSEG(PIC2%(0))
BSAVE "TEST.PIC", 2502, 2502
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top