This function has three subfunctions that provide the capability to save, and later restore, the current display context (display data, display mode, graphics cursor state, etc.). The context is saved and restored from a buffer supplied by the caller and must be at least as large as the size specified by the Size subfunction. The Save and Restore subfunctions do not use Int 10h, Fcn 00h (or other Int 10h services). Instead, the raw data is saved and restored directly. During the restore, the display is turned off to avoid "hardware insanity" while the registers used by the display controller are modified. Restore will conditionally turn on the (display state at time of Save) at the end of the Restore.
The data saved and restored falls into several groups:
This function returns the size of the buffer that will be required to save the current display context.
Given a supplied buffer, this function saves the current display data in the buffer. As a precaution (see the note below), the size of the buffer must be supplied and is checked by this function.
Note: The size may be context dependent. This provides protection against a context change that occurs between the call to SIZE and the call to SAVE.
Given a buffer previously loaded with data from a SAVE call (D902h), this function restores display context using the buffer data.
Note that if the display was off at the time of the SAVE call, the display will be off after the RESTORE.