'---------------------------------------------------------------------
'Function: Saving any text screen area for later restore, eg. any
' area which is temporary covered/overwritten by other things.
'
'Synopsis: GetRefresh dat$, lin%, col%, hei%, wid%
'
'Inputs: dat$ --> this variable will become the ID for the specified
' area, don't change its content until the area was
' restored via PutRefresh() and you no longer need it
' for further refresh calls
' lin% --> text line of top/left edge of the area
' col% --> text column of top/left edge of the area
' hei% --> height of the area as text lines
' wid% --> width of the area as text columns
'
'Notes: Note the intended side effect on the argument "dat$".
'---------------------------------------------------------------------
SUB GetRefresh
(dat$
, lin%
, col%
, hei%
, wid%
) '--- save dimensions ---
'--- save screen data ---
FOR y%
= lin%
TO lin%
+ hei%
- 1 FOR x%
= col%
TO col%
+ wid%
- 1
'---------------------------------------------------------------------
'Function: Restore a text screen area saved earlier by GetRefresh().
' Note that the actual PRINT (cursor) position and COLOR is
' changed after this call, so you have to use LOCATE and
' COLOR to designate your next PRINT position and color.
'
'Synopsis: PutRefresh dat$
'
'Inputs: dat$ --> the same (and still unchanged) variable you did use
' as "dat$" for the respective GetRefresh() call.
'---------------------------------------------------------------------
'--- get dimensions ---
wc& = 5
'--- restore screen data ---
FOR y%
= lin%
TO lin%
+ hei%
- 1 FOR x%
= col%
TO col%
+ wid%
- 1 bg%
= (co%
AND &HF0) / 16 IF bg%
> 7 THEN 'MSB set in the bg% nibble indicates blinking fg% fg% = fg% + 16
bg% = bg% - 8
wc& = wc& + 2