ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
BLOAD and BSAVE Statements Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example draws a magenta cube inside a white box and then uses the
' BSAVE statement to store the drawing in the file MAGCUBE.GRH. The BLOAD
' statement is used to retrieve and display the drawing.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 DIM Cube(1 TO 675)                    ' Declaration
 CLS                                   ' Clear the screen
 SCREEN 1
 LINE (140, 25)-(140 + 100, 125), 3, B ' Draw a white box
 
' Draw the outline of a magenta cube inside the box.
 DRAW "C2 BM140,50 M+50,-25 M+50,25 M-50,25"
 DRAW "M-50,-25 M+0,50 M+50,25 M+50,-25 M+0,-50 BM190,75 M+0,50"
 GET (140, 25)-(240, 125), Cube        ' Save the drawing in the array Cube
 
' Set segment to the segment of the array named Cube and store the drawing
' in the file MAGCUBE.GRH. Note: 2700 is the number of bytes in Cube
' (4 bytes per array element * 675).
 
 DEF SEG = VARSEG(Cube(1))
 BSAVE "MAGCUBE.GRH", VARPTR(Cube(1)), 2700
 LOCATE 20, 10
 PRINT "This image saved in file MAGCUBE.GRH"
 PRINT "Press any key."
 DO WHILE INKEY$ = ""
 LOOP
 CLS
 LOCATE 20, 10                         ' Display the saved image
 BLOAD "MAGCUBE.GRH", VARPTR(Cube(1))
 PRINT "This image loaded from MAGCUBE.GRH."
 DEF SEG                               ' Restore default Basic segment
 PUT (80, 10), Cube                    ' Put the drawing on the screen