-- JaMVMDefs.mesa
-- Written by Martin Newell, January 1979
-- Last changed by Doug Wyatt, March 29, 1980 1:53 PM

JaMVMDefs: DEFINITIONS =
BEGIN

JaMVM: PROGRAM;

-- InitializeVM must be called before any other procedure

InitializeVM: PROCEDURE[filename: STRING, nPages,nbuffers: CARDINAL] ;
-- Clear and initialize VM to page from file filename, not to
--
exceed nPages, using nbuffers buffers

RestartVM: PROCEDURE[filename: STRING, nPages,nbuffers: CARDINAL]
RETURNS[restarted: BOOLEAN];
--
Initialize VM to page from file filename, not to exceed nPages,
-- using nbuffers buffers.
--
Returns state of file, TRUE meaning file already existed and
-- FALSE meaning that a new file was created.
-- If file existed then allocation pointers are restored.

FlushVM: PROCEDURE;
-- Write up page buffers and deallocate them

CheckVM: PROCEDURE;
-- Write up page buffers and deallocate them

AllocateWordsVM: PROCEDURE[length: CARDINAL]
RETURNS[location: LONG POINTER];
-- Allocate length words in Virtual memory
-- Generates VMFull:

AllocateCharsVM: PROCEDURE[length: CARDINAL]
RETURNS[location: LONG POINTER, offset: CARDINAL];
-- Allocate length chars in Virtual memory
-- Generates VMFull:

GetWordVM: PROCEDURE[VMAddr: LONG POINTER, index: CARDINAL]
RETURNS[value: WORD];
-- Get a word from VM address VMAddr+index
-- Generates VMBadPointer:

GetCharVM: PROCEDURE[VMAddr: LONG POINTER, offset: CARDINAL, index: CARDINAL]
RETURNS[char: CHARACTER];
-- Get a character from VM address VMAddr
-- Generates VMBadPointer:

PutWordVM: PROCEDURE[value: WORD, VMAddr: LONG POINTER, index: CARDINAL];
-- Put value to VM address VMAddr+index
-- Generates VMBadPointer:

PutCharVM: PROCEDURE[char: CHARACTER,
VMAddr: LONG POINTER, offset: CARDINAL, index: CARDINAL];
-- Put a character to VM address VMAddr
-- Generates VMBadPointer:

GetWordsVM: PROCEDURE[VMAddr: LONG POINTER,
realAddr: POINTER, nwords: CARDINAL];
-- Copy nwords words from VM address VMAddr to actual memory address realAddr
-- Generates VMBadPointer:

GetCharsVM: PROCEDURE[VMAddr: LONG POINTER, VMOffset: CARDINAL,
realAddr: POINTER, realOffset: CARDINAL, nchars: CARDINAL];
-- Copy nchars chars from VM address VMAddr to actual memory address realAddr
-- Generates VMBadPointer:

PutWordsVM: PROCEDURE[VMAddr: LONG POINTER,
realAddr: POINTER, nwords: CARDINAL];
-- Copy nwords words from actual memory to VM
-- Generates VMBadPointer:

PutCharsVM: PROCEDURE[VMAddr: LONG POINTER, VMOffset: CARDINAL,
realAddr: POINTER, realOffset: CARDINAL, nchars: CARDINAL];
-- Copy nchars chars from actual memory to VM
-- Generates VMBadPointer:

-- SIGNALS

VMBadPointer: ERROR;
VMFull: ERROR;
VMFileProblem: ERROR;

END.

DKW March 27, 1980 6:25 PM
added JaMVM: PROGRAM;