By popular demand, here is your BSAVE and BLOAD programming example.
[tt]
'Set the graphics mode... SCREEN 8 '640 x 200 Resolution
'Set up an array large enough to store the contents of the screen REDIM GraphBlock(1 TO 31266)
'You determine the required size of the graphics array with:
'Bytes = 4 + INT(((X2-X1+1)*(Bits/pixel/plane)+7)/8)*planes*((Y2-Y1)+1)
'In SCREEN 8 that would be 62532 bytes for an array size of 31266.
'Draw a graphic.... X = 150: Y = 2
DO
CIRCLE (X, Y), Y / 4, (Y / 16) + 1
CIRCLE (X - Y, Y), Y / 4, (Y / 16) + 1
CIRCLE (X + Y, Y), Y / 4, (Y / 16) + 1
IF Y > 200 THEN EXIT DO
X = X + LOG(X * Y) / Y
Y = Y + LOG(Y) / 10
LOOP
'Place the contents of the screen in the array... GET (0, 0)-(639, 199), GraphBlock
'Set the memory segment to first element of the array DEF SEG = VARSEG(GraphBlock(1))
BSAVE "Screen.Img", VARPTR(GraphBlock(1)), 62532 'save it to a file DEF SEG 'Reset the default memory segment to the Qbasic area CLS 'To show that this actually works, clear the screen...
'and erase the array. ERASE GraphBlock
PRINT "Press a key to load screen..."
DO WHILE INKEY$ = ""
LOOP
REDIM GraphBlock(1 TO 31266)
DEF SEG = VARSEG(GraphBlock(1))
BLOAD "Screen.Img", VARPTR(GraphBlock(1))
DEF SEG
PUT (0, 0), GraphBlock, PSET [/tt]
The graphic has returned to the screen. A lot quicker the second time, eh?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.