LIM Expanded Memory Specification V4: Appendix D

From Lo-tech Wiki
Jump to navigation Jump to search

OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28

All expanded memory boards have a set of registers that "remember" the logical to physical page mappings. Some boards have extra (or alternate) sets of these mapping registers. Because no expanded memory board can supply an infinite number of alternate map register sets, this specification provides a way to simulate them using Function 28 (Alternate Map Register Set).

EXAMPLES

For the examples in this section, assume the hardware supports alternate map register sets. First Windows is brought up, then "Reversi" is started. Then control is switched back to the MS-DOS Executive. For this procedure, here are the calls to the expanded memory manager:

EXAMPLE 1

Allocate alt reg set               ; Start up the MS-DOS
(for the MS-DOS executive)         ; Executive

Set alt reg set
(for MS-DOS Executive)

Allocate alt reg set               ; Start up Reversi
(for Reversi)

Set alt reg set
(for Reversi)

Map pages
(for Reversi)

Set alt reg set                    ; Switch back to MS-DOS
(for MS-DOS Executive)             ; Executive

Notice this procedure needed no "get" calls because the register set contained all the information needed to save a context. However, using "Get" calls would have no ill effects.

EXAMPLE2

Allocate alt reg set               ; Start up MS-DOS
(for MS-DOS Executive)             ; Executive

Set alt reg set
(for MS-DOS Executive)

Get alt reg set
(for MS-DOS Executive)

Allocate alt reg set               ; Start up Reversi
(for Reversi)

Set alt reg set
(for Reversi)

Map pages
(for Reversi)

Get alt reg set
(for Reversi)

Set alt reg set                    ; Switch back to MS-DOS
(for MS-DOS Executive)             ; Executive

The important point to follow is that a Set must always precede a Get. The model of Set then Get is the inverse of what interrupt handlers use, which is Get then Set (Get the old map context and Set the new one). Another crucial point is that an alternate map register set must have the current mapping when allocated; otherwise, the Set will create chaos.

What happens if this is simulated in software? The same Set and Get model applies. The main difference is where the context is saved. Since the allocate call is dynamic and there is no limit on the number of sets allocated, the OS/E must supply the space required. Device drivers cannot allocate space dynamically, since the request would fail. If the Allocate register set call returns a status indicating the alternate map register sets aren't supported, the OS/E must allocate space for the context. It must also initialize the context using Function 15. At that point it can do the Set, passing a pointer to the map context space. On the Get call, the EMM driver is to return a pointer to the same context space.

EXAMPLE 3

Allocate alt reg set               ; Start up MS-DOS
(for the MS-DOS executive)         ;Executive

Get Page Map
(for the MS-DOS executive)

Set alt reg set
(for MS-DOS Executive)

Allocate alt reg set               ; Start up Reversi
(for Reversi)

Set alt reg set
(for Reversi)

Map pages
(for Reversi)

Get Page Map
(for Reversi)

Set alt reg set                    ; Switch back to MS-DOS
(for MS-DOS Executive)             ; Executive

LIM Expanded Memory Specification V4 Contents

See Also