-- DLionInputOutput.mesa
-- Last edited by: Gobbel on: January 23, 1981 1:33 PM
DIRECTORY
Environment USING [PageCount, PageNumber, wordsPerPage],
Inline USING [],
MiscAlpha USING [aINPUT, aOUTPUT],
Mopcodes USING [zMISC],
PageMap USING [GetF, RealPageNumber],
Utilities USING [LongPointerFromPage, PageFromLongPointer];
DLionInputOutput: DEFINITIONS
IMPORTS Inline, PageMap, Utilities SHARES PageMap =
BEGIN
-- Support for Dandelion heads (device face implementations)
-- I/O page. The general layout (beginning of each of the csb's) should
-- also be defined here.
IOPage: READONLY LONG POINTER;
RegNum: TYPE = CARDINAL; -- used to index the I/O registers
-- Read one word from specified controller register.
Input: PROC [RegNum] RETURNS [UNSPECIFIED] = MACHINE CODE
BEGIN Mopcodes.zMISC, MiscAlpha.aINPUT; END;
-- Write one word to specified controller register.
Output: PROC [datum: UNSPECIFIED, register: RegNum] = MACHINE CODE
BEGIN Mopcodes.zMISC, MiscAlpha.aOUTPUT; END;
-- Return real page number currently mapped to given virtual page. Undefined
-- if virtual page is not mapped. The following code could (should) be
-- replaced by GetFlags when it is implemented. It depends on the fact that
-- on Dandelion only the emulator updates map flags.
GetRealPage: PROC [page: Environment.PageNumber]
RETURNS [PageMap.RealPageNumber] =
INLINE {RETURN[PageMap.GetF[page].realPage]};
GetRealAddress: PROC [p: LONG POINTER] RETURNS [rp: LONG POINTER] = INLINE
BEGIN OPEN Utilities;
longPtr: TYPE = MACHINE DEPENDENT RECORD [lo, hi: CARDINAL];
RETURN[
LOOPHOLE[p, longPtr].lo MOD Environment.wordsPerPage +
LongPointerFromPage[
GetRealPage[PageFromLongPointer[p]]]];
-- this could take advantage of the fact that the add never carries
END;
-- Memory description and support:
firstReservedPage: PageMap.RealPageNumber = 0; -- special display/raven memory
reservedPageCount: Environment.PageCount = 256;
-- = [0..377B) = [0..100x) = [0..256D)
firstMapPage: PageMap.RealPageNumber = 256; -- real memory reserved for map
mapPagesCount: Environment.PageCount = 64;
-- = [0..500B) = [0..140x) = [0..320D)
ioPageNumber: PageMap.RealPageNumber = 320; -- = 140x = 500B
ioPageRealAddr: LONG POINTER = LOOPHOLE[240000B];
-- = 240000B = 14000x = 81920D
ioPageRealAddrLow: WORD = 40000B; -- low half of ioPageRealAddr
numberVirtualPages: Environment.PageCount = 40000B; -- = 16384D = 4000x
-- used to resolve contention for special memory
ReservedMemoryUse: TYPE = {notBusy, Raven, Display};
SetReservedMemoryUse: PROC
[use: ReservedMemoryUse, pagesNeeded: Environment.PageCount ← 0];
-- DonateReservedMemory is intended to be called from
-- appropriatly named modules, i.e. FreeAllReservedMemory,
-- FreeReservedMemoryFor8KRaven, FreeReservedMemoryFor12KRaven, etc.
DonateReservedMemory: PROCEDURE [pagesToKeep: Environment.PageCount];
END.
LOG
Time: June 10, 1980 1:51 PM By: Davies
Action: Create from D0InputOutput of May 15, 1980 10:54 AM.
Time: June 17, 1980 11:53 AM By: McJones
Action: Add GetRealPage
Time: June 19, 1980 1:22 PM By: Forrest
Action: reformat.
Time: June 23, 1980 12:09 PM By: Forrest
Action: Page<=>LongPointer, GetRealAddress.
Time: July 28, 1980 11:27 AM By: Forrest
Action: Upgrade to 5.0c build.
Time: July 31, 1980 11:16 PM By: Forrest
Action: Fix GetRealAddress.
Time: November 10, 1980 2:23 PM By: Forrest
Action: Add memory configuration code AND DonateReservedMemory.
Time: January 22, 1981 11:25 AM By: Gobbel
Action: Move DonateReservedMemory to RealMemoryImplDLion.