'=========================================================================== ' Subject: BSAVE AND BLOAD FOR PBCC Date: 07-01-00 (20:47) ' Author: Jerry Fielden Code: PBCC ' Origin: fielden@pldi.com Packet: PBCC.ABC '=========================================================================== Coded by Jerry Fielden Public Domain I made a stab at writting some BSAVE and BLOAD type routines for PBCC. Run the program to see how long it takes for different screen modes.. Most Console Screen NON Standard modes I've tried worked properly except 50x79 and only sometimes. I haven't tried them all yet. All Standard modes seems to work well. You are welcome to use the routines at your own risk. '------------------------------------------------------------------- ' BSAVEs Copies the current screen to a file. It can be any screen ' mode size, 50x80, 70x80, 20x20, etc. The number of Screen rows is ' passed through the lRows Variable and the number of columns is ' passed through the lColumns Variable. The Global Variables and ' Global Arrays are used by both BLOADs and BSAVEs, they have to be ' included in your code. ' ' BLOADs will copy the screen from the file back to the Screen. ' As with BSAVEs, you'll need to pass the Console Screen Size through ' the lRows and lColumns variables. DECLARE SUB BSAVEs (FileNames$) DECLARE SUB BLOADs (FileNames$) DECLARE SUB MakeBox () FUNCTION PBMAIN DIM lRows AS GLOBAL LONG, lColumns AS GLOBAL LONG LOCATE 10, 1 LINE INPUT "Enter the Screen Mode, 25x80, 26x75, etc. " Mode$ lRows = VAL(LEFT$(Mode$, 2)) ' Get number of rows lColumns = VAL(RIGHT$(Mode$, 2)) ' Get number of columns Filenames$ = "Screens.bny" CONSOLE SCREEN lRows, lColumns 'Setting the Screen size DIM Colors(0 TO lRows*lColumns-1) AS GLOBAL LONG 'Arrays being DIM Area(0 TO lRows*lColumns-1) AS GLOBAL LONG 'pointed at MakeBox ' Fill up the SCREEN starttime$ = FORMAT$(TIMER, "#.###") 'Time the routines BSAVEs(FileNames$) ' Save screen to file RESET Colors() : RESET Area() ' Clear the Arrays CLS ' Clear the screen BLOADs (FileNames$) ' Put the screen back endtime$ = FORMAT$(TIMER, "#.###") 'How long did it take LOCATE 1, 1 : COLOR 0, 11 PRINT "It took "FORMAT$((VAL(endtime$)-VAL(starttime$)), "#.###")" Seconds" SLEEP 7000 KILL FileNames$ END FUNCTION '---------------------------------------------------------------------- ' BSAVE Replacement for PBCC, it should do Most Console screen modes, | '---------------------------------------------------------------------- SUB BSAVEs (FileNames$) DIM ColorAddr AS LONG PTR, AreaAddr AS LONG PTR DIM nbr AS LONG, row AS LONG, col AS LONG ColorAddr = VARPTR(Colors(0)) AreaAddr = VARPTR(Area(0)) FOR row = 1 TO lRows FOR col = 1 TO lColumns @ColorAddr[nbr] = SCREENATTR(row, col) 'Put color into array @AreaAddr[nbr] = SCREEN(row, col) 'Put Character into Array INCR nbr NEXT col NEXT row OPEN FileNames$ FOR BINARY AS #1 '..........Put it in a file FOR x& = 0 TO lColumns*lRows-1 PUT$ #1, CHR$(@AreaAddr[x&]) '..........Save a Character PUT$ #1, CHR$(@ColorAddr[x&]) '..........Save it's colors NEXT x& '..........Go do it again CLOSE #1 END SUB '--------------------------------------------------------------- ' BLOAD Replacement for PBCC, it should do most screen modes ? | '--------------------------------------------------------------- SUB BLOADs (FileNames$) DIM ColorAddr AS LONG PTR, AreaAddr AS LONG PTR DIM nbr AS LONG, sColour AS STRING, sChar AS STRING DIM row AS LONG, col AS LONG ColorAddr = VARPTR(Colors(0)) ' Pointers for Arrays DIMed in Main AreaAddr = VARPTR(Area(0)) OPEN FileNames$ FOR BINARY AS #1 FOR nbr = 0 TO lColumns*lRows-1 ' GET$ #1, 1, sChar : @AreaAddr [nbr] = ASC(sChar) GET$ #1, 1, sColour : @ColorAddr[nbr] = ASC(sColour) NEXT nbr CLOSE #1 nbr=0 PCOPY 1,2 : PAGE 2, 1 FOR row = 1 TO lRows FOR col = 1 TO lColumns LOCATE row, col ForGnd& = @ColorAddr[nbr] MOD 16& BackGnd& = @ColorAddr[nbr] \ 16& COLOR ForGnd&, BackGnd& PRINT CHR$(@AreaAddr[nbr]); INCR nbr NEXT col NEXT row PCOPY 2, 1 : PAGE 1, 1 END SUB SUB MakeBox() PCOPY 1, 2 : PAGE 2, 1 COLOR 1, 11 FOR x& = 1 TO lColumns*lRows PRINT CHR$(176); 'Fill up screen NEXT x& SLEEP 500 COLOR 14, 1 : LOCATE 8, 30 'make a box PRINT CHR$(201, 205, 205, 205, 205, 205, 205, 205, 205, _ 205, 205, 205, 205, 205, 205, 205, 187) LOCATE 9, 30 :PRINT CHR$(186) + " This is one " + CHR$(186) LOCATE 10, 30 :PRINT CHR$(186) + " Example of " + CHR$(186) COLOR 11, 4 LOCATE 11, 30 :PRINT CHR$(186) + " Bsaves and " + CHR$(186) LOCATE 12, 30 :PRINT CHR$(186) + " Bloads " + CHR$(186) LOCATE 13, 30 :PRINT CHR$(200, 205, 205, 205, 205, 205, 205, 205, 205, _ 205, 205, 205, 205, 205, 205, 205, 188) PCOPY 2, 1 : PAGE 1, 1 END SUB