

Task

Clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out.

There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved.   If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit.




 
Module PreserveScreen {
      Bold 1
      Font "Arial"
      Paper=#225511
      SplitScreenRow=0
      Cls Paper, SplitScreenRow
      Print "Test"
      Gosub GetState
      Font "Tahoma"
      Bold 1 : Italic 1: Pen 15
      cls 0, 5
      For i=1 to 100 : Print i: Next i
      Move 6000,6000
      For i=1000 to 6000 step 1000 : Circle i : Next i
      WaitKey$=Key$
      Gosub RestoreState
      Print "End"
      End
 
      GetState:
            prevfont$=fontname$
            prevbold=bold
            previtalic=italic
            prevpen=pen
            posx=pos
            posy=row
            graphicx=pos.x
            graphicy=pos.y
            OldPaper=Paper
            OldSplit=SplitScreenRow
            Hold
      Return
      RestoreState:
            Paper=OldPaper
            SplitScreenRow=OldSplit
            Cls Paper, SplitScreenRow
            Release
            font prevfont$
            bold prevbold
            italic previtalic
            pen prevpen
            cursor posx, posy
            move graphicx, graphicy
      Return
}
PreserveScreen
 
 