XBusImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Jim Gasbarro August 27, 1985 5:07:36 pm PDT
Last Edited by: Gasbarro, April 18, 1986 11:44:58 am PST
Tim Diebert: March 25, 1986 4:25:08 pm PST
DIRECTORY
Basics, Process, XBus;
XBusImpl:
CEDAR
PROGRAM
IMPORTS
Basics, Process, XBus
BEGIN
mBusCtl: POINTER = LOOPHOLE[2];
lBusOutData: POINTER = LOOPHOLE[2];
lBusInData: POINTER = LOOPHOLE[2];
mBusAddr: POINTER = LOOPHOLE[3];
lBusAddr: POINTER = LOOPHOLE[3];
timer: LONG POINTER = LOOPHOLE[LONG[64]];
masterClear: LONG POINTER = LOOPHOLE[LONG[13]];
pcMode: PUBLIC BOOL ← FALSE;
IORead:
PUBLIC
PROCEDURE [add:
LONG POINTER]
RETURNS [data:
WORD] =
BEGIN
XBus.WriteM[mBusAddr, Basics.HighHalf[LOOPHOLE[add]]];
XBus.WriteL[lBusAddr, Basics.LowHalf[LOOPHOLE[add]]];
XBus.WriteM[mBusCtl, IF pcMode THEN 4H ELSE 8604H];
XBus.WriteL[lBusOutData, 0];
WHILE Basics.
BITAND[XBus.ReadM[mBusCtl], 4] = 0
DO
--check for XACK
Process.CheckForAbort[];
ENDLOOP;
data ← XBus.ReadL[lBusInData]
END;
IOWrite:
PUBLIC
PROCEDURE[add:
LONG POINTER, data:
WORD] =
BEGIN
XBus.WriteM[mBusAddr, Basics.HighHalf[LOOPHOLE[add]]];
XBus.WriteL[lBusAddr, Basics.LowHalf[LOOPHOLE[add]]];
XBus.WriteM[mBusCtl, IF pcMode THEN 8H ELSE 8508H];
XBus.WriteL[lBusOutData, data];
WHILE Basics.
BITAND[XBus.ReadM[mBusCtl], 4] = 0
DO
--check for XACK
Process.CheckForAbort[];
ENDLOOP;
END;
MemRead:
PUBLIC
PROCEDURE [add:
LONG POINTER]
RETURNS [data:
WORD] =
BEGIN
XBus.WriteM[mBusAddr, Basics.HighHalf[LOOPHOLE[add]]];
XBus.WriteL[lBusAddr, Basics.LowHalf[LOOPHOLE[add]]];
XBus.WriteM[mBusCtl, IF pcMode THEN 1H ELSE 8A01H];
XBus.WriteL[lBusOutData, 0];
WHILE Basics.
BITAND[XBus.ReadM[mBusCtl], 4] = 0
DO
--check for XACK
Process.CheckForAbort[];
ENDLOOP;
data ← XBus.ReadL[lBusInData]
END;
MemWrite:
PUBLIC
PROCEDURE[add:
LONG POINTER, data:
WORD] =
BEGIN
XBus.WriteM[mBusAddr, Basics.HighHalf[LOOPHOLE[add]]];
XBus.WriteL[lBusAddr, Basics.LowHalf[LOOPHOLE[add]]];
XBus.WriteM[mBusCtl, IF pcMode THEN 2H ELSE 8902H];
XBus.WriteL[lBusOutData, data];
WHILE Basics.
BITAND[XBus.ReadM[mBusCtl], 4] = 0
DO
--check for XACK
Process.CheckForAbort[];
ENDLOOP;
END;
PCRefreshOn:
PUBLIC
PROCEDURE =
BEGIN
XBus.IOWrite[timer+3, 84];
XBus.IOWrite[timer+1, 18];
XBus.IOWrite[masterClear, 0];
XBus.IOWrite[LOOPHOLE[LONG[12]], 0];
XBus.IOWrite[LOOPHOLE[LONG[1]], Basics.BITAND[8191, 255]];
XBus.IOWrite[LOOPHOLE[LONG[1]], Basics.BITSHIFT[8191, -8]];
XBus.IOWrite[LOOPHOLE[LONG[11]], 88];
XBus.IOWrite[LOOPHOLE[LONG[10]], 0];
END;
These are here so that you can get at ReadL, ReadM, etc. from the interpreter
XReadL:
PROCEDURE[add:
POINTER]
RETURNS [
WORD] =
BEGIN
RETURN[XBus.ReadL[LOOPHOLE[add]]];
END;
XReadM:
PROCEDURE[add:
POINTER]
RETURNS [
WORD] =
BEGIN
RETURN[XBus.ReadM[LOOPHOLE[add]]];
END;
XWriteL:
PROCEDURE[add:
POINTER, data:
WORD] =
BEGIN
XBus.WriteL[LOOPHOLE[add], data];
END;
XWriteM:
PROCEDURE[add:
POINTER, data:
WORD] =
BEGIN
XBus.WriteM[LOOPHOLE[add], data];
END;
END.