Hello I recently viewed an old post here about dimensioning graphics arrays and bsaving. I have some working code although I do not fully understand why it works so. I understand with a graphics array (scrn 13) we get 2 bytes per integer. But in my code I must use L x W /2 + 1, I don't know what the +1 is for but it works. Also using bsave I calculate the amount of bytes and have to add 4 for the entire picture to be loaded. Can anyone enlighten me? I know a few people have given different answers to this question in the past I'm just wondering what the De Facto rule is for it, i.e. actual equation. here's the code I use just to test this.
It make a 320x200 picture of random pixels, gets its in array bsaves it, then clears the screen and then finally bloads it. check it out
------------------------------------------------------------
CLS
DIM scrn(32001) AS INTEGER
DIM scrn2(32001) AS INTEGER 'one integer = 2 bytes
RANDOMIZE TIMER
SCREEN 13
FOR y = 0 TO 199
FOR x = 0 TO 319
PSET (x, y), RND * 7
NEXT
NEXT
GET (0, 0)-(319, 199), scrn
a$ = INPUT$(1)
CLS
PUT (0, 0), scrn, PSET
DEF SEG = VARSEG(scrn(0))
INPUT "Filename: ", file$
BSAVE file$, VARPTR(scrn(0)),64004
DEF SEG
CLS
a$ = INPUT$(1)
DEF SEG = VARSEG(scrn2(0))
BLOAD file$, VARPTR(scrn2(0))
DEF SEG
PUT (0, 0), scrn2(0), PSET
SLEEP 3
'((totalx x totaly) / BytesPerInteger) - 1forZero
'((320 x 200) / 2) - 1 = 31999
'then add 2 bytes for the height and width
'31999 + 2 = 32001
It make a 320x200 picture of random pixels, gets its in array bsaves it, then clears the screen and then finally bloads it. check it out
------------------------------------------------------------
CLS
DIM scrn(32001) AS INTEGER
DIM scrn2(32001) AS INTEGER 'one integer = 2 bytes
RANDOMIZE TIMER
SCREEN 13
FOR y = 0 TO 199
FOR x = 0 TO 319
PSET (x, y), RND * 7
NEXT
NEXT
GET (0, 0)-(319, 199), scrn
a$ = INPUT$(1)
CLS
PUT (0, 0), scrn, PSET
DEF SEG = VARSEG(scrn(0))
INPUT "Filename: ", file$
BSAVE file$, VARPTR(scrn(0)),64004
DEF SEG
CLS
a$ = INPUT$(1)
DEF SEG = VARSEG(scrn2(0))
BLOAD file$, VARPTR(scrn2(0))
DEF SEG
PUT (0, 0), scrn2(0), PSET
SLEEP 3
'((totalx x totaly) / BytesPerInteger) - 1forZero
'((320 x 200) / 2) - 1 = 31999
'then add 2 bytes for the height and width
'31999 + 2 = 32001