TURBO PASCAL |
Новости
|
31: How does one store, and then restore the original screen?A: Here is a simple outline for storing and restoring a text mode screen in the standard 80 x 25 mode. Note that the code below is incomplete in a sense that it works for a color monitor only, because the monochrome screen address is $B000:$0000. For storing and restoring the graphics screen see Ohlsen & Stoker (1989), Turbo Pascal Advanced Techniques, Que, pp 333-337. uses Crt; type ScreenType = array [1..4000] of byte; (* 2 x 80 x 25 *) var ColorScreen : ScreenType Absolute $B800:$0000; SavedScreen : ScreenType; posx, posy : byte; begin SavedScreen := ColorScreen; (* Save the screen *) posx := WhereX; posy := WhereY; (* Save the cursor position *) writeln ('A simple demo storing and restoring the color text screen'); writeln ('By Prof. Timo Salmi, ts@uwasa.fi'); writeln; write ('Press <-'''); readln; ColorScreen := SavedScreen; (* Restore the screen *) GotoXY(posx,posy); (* Go to the stored cursor position *) end. If you would prefer not using the Crt unit, you can apply WHEREXFN, WHEREYFN, and GOATXY from TSUNTG.TPU from my units collection ftp://garbo.uwasa.fi/pc/ts/tspa3470.zip. If you wish to test for the monitor type, that is choose between $B800:$0000 and $B000:$0000 bases, you can use the following function to test for the monochrome adapter. function MONOFN : boolean; var regs : registers; begin FillChar (regs, SizeOf(regs), 0); regs.ah := $0F; Intr ($10, regs); monofn := (regs.al = 7); end; (* monofn *) |
(с)Все права защищены По всем интересующим вопросам прошу писать на электронный адрес |