# SWPSBR

> [HTML Version](swpsbr_sbr.htm)

_Updated December 2023; see History_

**xcall SWPSBR, function \{,parameters dependent on function\}**

SWPSBR performs various functions related to the Swap multi-session and screen-tracking system available as a third-party add-on in the AMOS world. A-Shell does not support Swap per se, since it has its own screen tracking system ([TRACKER](terminology.md#tracker-in-terminology)) and multi-session system (either PolyShell or using multiple Windows instances), but it does support most of the SWPSBR functions, which are listed below. Note that unless you already have a lot of code using these functions, you would be better off to use [MSBOXX](msboxxsbr.md), which can do all of these things and which is both more powerful and better supported. 

**xcall SWPSBR, 0, active\$**

Function 0 tests whether the Swap system is active. A-Shell returns "Y" in the _active\$_ parameter.

**xcall SWPSBR, 1, screen**

**xcall SWPSBR, 1, srow, scol, erow, ecol, screen**

Function 1 restores the previously saved window or entire screen. With Swap, the screen parameter was a buffer to hold the screen contents, but it is ignored with A-Shell, which has an internal storage scheme. (You can map it as X,1 to save space.) However, A-Shell's scheme acts like a stack, so you must save and restore in LIFO order (i.e. last item saved will be the first item restored.) The first format above restores the entire screen. The second format restores a previously saved partial screen.

You can also restore an entire screen with Tab(-1,203), assuming it has previously been saved with Tab(-1,202) or an equivalent. You can also save and restore partial screens using [MSBOXX](msboxxsbr.md)

**xcall SWPSBR, 3, screen**

**xcall SWPSBR, 3, srow, scol, erow, ecol, screen**

Function 3 saves an entire screen (first format) or partial screen (second format). See Function 1 above for the restore operation.

**xcall SWPSBR, 7, srow, scol, erow, ecol, siz**

Function 7 was used to establish the size needed to store the specified screen area. The call is simply ignored by A-Shell, since you do not need to provide any storage space for the save and restore operations.

**xcall SWPSBR, 8, srow, scol, erow, ecol**

Function 8 was used to restore attributes on the right side of the box. It is not implemented by A-Shell. You do not need this capability with mode emulations (such as Windows, VT100, etc.) and if you really need it, you can get it by using [MSBOXX](msboxxsbr.md) and the BOX\_FAO option, or via Function 128.

**xcall SWPSBR, 9, srow, scol, erow, ecol**

Function 9 clears the specified box. It is equivalent to the [MSBOXX](msboxxsbr.md) option BOX\_ERA.

**xcall SWPSBR, 128, srow, scol, erow, ecol, flags**

Function 128 draws a box, with various options determined by the contents of the _flags_ parameter. The options are listed in the following table, and may be strung together using commas. For example, "T,C,B,O=2,I=3."

| **Flags** | **Description** |
|------|------|
| B | Draw a border around the box. Equivalent to [MSBOXX](msboxxsbr.md) option BOX\_BDR. |
| C | Clear interior of box. Equivalent to [MSBOXX](msboxxsbr.md) option BOX\_ERA. |
| T | Seal up field attributes. Equivalent to [MSBOXX](msboxxsbr.md) option BOX\_FAO. |
| I=<text fg> | Sets the text (interior) foreground color. For example, I=1 would set it to white. Equivalent to the IBOX'FG parameter in [MSBOXX](msboxxsbr.md). |
| O=<border fg> | Sets the border (outside) foreground color. For example, O=2 would set it to color 2 (blue). Equivalent to the BRDR'FG parameter in [MSBOXX](msboxxsbr.md). |




**xcall SWPSBR, 129, screen, fspec\$**

Function 129 saves the current screen, VUEs the specified file, then restores the screen. As with the other functions involving the Screen parameter, Screen is ignored by A-Shell, which instead uses [EZTYP](eztypsbr.md) to save the screen, display the file, and restore the screen on exit.

**History**

2023 November, A-Shell 7.0.1751.4:  Hot spots created with Tab(-1,162) are now saved and restored in ATE environments as well as pure Windows.  Note however that in the ATE environment, the application needs to send a Tab() command with an explicit termination following the Tab(-1,162) in order to get a clean save/restore. Tab(-1,254); (flush) is the simplest way to satisfy the requirement.