Hardware manual
This table of levels corresponds to the order in which the objects are located in the Alto memory: levBasic
is at the very top; the bottom of levMain is the highest location for the Bcpl stack.
The "Junta" function is responsible for de-activating these levels, thereby permitting the space to be
reclaimed. When a program that has called Junta is ready to finish, it calls OsFinish in the normal way.
OsFinish performs the "counter-junta," reading in portions of the operating system from the boot file and
rebuilding the internal state of those levels that were previously de-activated, and then proceeds with the
finish, calling the Executive, etc.
During the counter-junta process (which takes about 1/2 second), the display and interrupt system can
continue to be active, provided that the code and storage they use lies below the address that is the value of
OsFinishSafeAdr. This permits a token display to remain; also a keyboard handler can continue to sense
key strokes and record characters in the system keyboard buffer.
Junta(levName, Proc) This function, which may be called only once before a "finish"
or CounterJunta is done, de-activates all levels below levName.
Thus levName specifies the name of the last level you wish to
retain. (Manifest constants for the level names are in SysDefs.d.)
It then sets the stack to a point just below the retained level, and
calls Proc(), which should
not return.
The stack present at the time Junta is called is destroyed. The
recommended procedure for saving data across a call to Junta is
to locate the data below EndCode.
A Junta always destroys the system free-storage pool and does
not re-create it. Therefore, open streams, the system display and
system font are all destroyed.
It is the user’s responsibility to take care not to call operating
system procedures that lie in the region de-activated by the
Junta. If in doubt, consult the file Sys.Bk, which documents the
association between procedures and levels.
...finish... Any of the methods for terminating execution (section 3.12)
automatically restores the full operating system.
CounterJunta(Proc) This function restores all de-activated sections of the operating
system, and then calls Proc. The program stack present when
CounterJunta was called is destroyed. This function is provided
for those programs that do not wish to return to the operating
system with a "finish," but may wish to do other processing (e.g.,
CallSubsys).
After calling Junta, many programmers will wish to restore some of the facilities that the Junta destroys,
such as a free storage zone, a display stream, etc. Below is an example of how to go about this. Note that
some thought is required because the operating system keeps a separate copy of statics from those
referenced in your program. Thus when the OS defaults the third argument of CreateDisplayStream to
sysFont, it uses the OS copy of sysFont, not the copy available to your program.
...
Junta(levXXXXX, Proc)
...
let Proc() be
[
//Make a new sysZone:
let v = vec 7035 // You can make it any size
v = InitializeZone(v, 7035)
@lvSysZone = v // Patch the os’s version of the static
Alto Operating System May 5, 1980 19
For Xerox Internal Use Only -- December 15, 1980










