×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Two pictures in one BSAVE file?

Two pictures in one BSAVE file?

Two pictures in one BSAVE file?

(OP)
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!

RE: Two pictures in one BSAVE file?

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:
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)

  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

http://cubee.topcities.com

RE: Two pictures in one BSAVE file?

(OP)
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---

RE: Two pictures in one BSAVE file?

(OP)
When it gets to the PUT statement, it gives me an "ILLEGAL FUNCTION CALL" error.

RE: Two pictures in one BSAVE file?

(OP)
The first one.

RE: Two pictures in one BSAVE file?

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

RE: Two pictures in one BSAVE file?

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.

RE: Two pictures in one BSAVE file?

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close