BBS: Inland Empire Archive Date: 04-04-92 (13:43) Number: 200 From: DON KROUSE Refer#: NONE To: GREG BUXTON Recvd: NO Subj: Saving Screen In Text Mod Conf: (2) Quik_Bas
GB>Hello, I am a Decent QB Programmer, but have not beeen able to do something Hi Greg, I'm sure there are better ways, but the code below will work. It saves all or a part of the screen to an array. (you could bsave it to disk instead) The screen can then be restored to the same or different locations. I hope that it helps. Don ' Demonstration of PEEK & POKE to save & write screens by DON KROUSE DEFINT A-Z: CLS FOR i = 1 TO 25 '---- Fill the screen with a pattern LOCATE i, 1: COLOR 1: PRINT STRING$(40, "*"); LOCATE i, 41: COLOR 4: PRINT STRING$(40, "*"); NEXT i COLOR 7, 0 LOCATE 7, 30: PRINT "My name is Don Krouse" LOCATE 9, 22: PRINT "Press a key to save part of the screen" SLEEP ' ---- define the part of the screen to be saved TopRow = 6: BRow = 10: LCol = 20: RCol = 60 '---- Determine the array size needed Els% = ((BRow - TopRow + 1) * (RCol - LCol + 1)) * 2 REDIM ScreenArray%(Els%) '---- Save the screen Cols = RCol - LCol DEF SEG = &HB800 'Use &HB000 for Mono cards FOR i = TopRow TO BRow FOR j = LCol - 1 TO ((LCol - 1) + (Cols * 2)) + 1 Place% = (((i - 1) * 160) + LCol + j) - 1 ScreenArray%(El%) = PEEK(Place%) El% = El% + 1 NEXT j NEXT i CLS LOCATE 7, 22: PRINT "Part of the screen has been saved" LOCATE 9, 22: PRINT "Press a key to Restore the saved part" LOCATE 10, 22: PRINT "to several new locations" SLEEP DEF SEG = &HB800 TopRow = 5: BRow = 9: LCol = 15: El% = 0 FOR i = TopRow TO BRow FOR j = LCol - 1 TO ((LCol - 1) + (Cols * 2)) + 1 STEP 2 Place% = (((i - 1) * 160) + LCol + j) - 1 POKE Place%, ScreenArray%(El%) POKE Place% + 1, ScreenArray%(El% + 1) El% = El% + 2 NEXT j NEXT i TopRow = 20: BRow = 24: LCol = 1: El% = 0 FOR i = TopRow TO BRow FOR j = LCol - 1 TO ((LCol - 1) + (Cols * 2)) + 1 STEP 2 Place% = (((i - 1) * 160) + LCol + j) - 1 POKE Place%, ScreenArray%(El%) POKE Place% + 1, ScreenArray%(El% + 1) El% = El% + 2 NEXT j NEXT i SLEEP END --- * Origin: Silver Lake Systems * Bothell, WA (1:343/58)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET