Rapunzel0.cr
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Demers, September 18, 1986 5:39:53 pm PDT
Willie-Sue, March 18, 1987 11:25:59 am PST
Rapunzel: PROGRAM 2200 VERSION 3
= BEGIN
Introduction
This package provides generic remote peek and poke operations for 16-bit and 32-bit entities.
It also provides specialized operations that are useful to the Softcard
Word Order: For either Short (n = 16) or Long (n = 32), an n-bit number on the source machine is mapped to (the same) n-bit number in standard representation on the wire, which is mapped to (the same) n-bit number on the target machine.
Types
Short: TYPE = CARDINAL;
Long: TYPE = LONG CARDINAL;
SeqShort: TYPE = SEQUENCE OF Short;
SeqLong: TYPE = SEQUENCE OF Long;
Address: TYPE = LONG CARDINAL;
PeekShortCmd: TYPE = RECORD [address: Address];
PokeShortCmd: TYPE = RECORD [address: Address, value: Short];
PokeLongCmd: TYPE = RECORD [address: Address, value: Long];
ShftReadCmd: TYPE = RECORD [address: Address, numRepeats: Short];
ShftWriteCmd: TYPE = RECORD [address: Address, numRepeats: Short];
ReturnLengthCmd: TYPE = RECORD [returnLength: Short]; -- ignored if not the first Cmd
OpCode: TYPE = {
peekShort(0), pokeShort(1), pokeLong(2),
shftRead(3), shftWrite(4),
returnLength(5)
};
Cmd: TYPE = CHOICE OpCode OF {
peekShort => PeekShortCmd,
pokeShort => PokeShortCmd,
pokeLong => PokeLongCmd,
shftRead => ShftReadCmd,
shftWrite => ShftWriteCmd,
returnLength => ReturnLengthCmd
};
SeqCmd: TYPE = SEQUENCE OF Cmd;
PeekShortResult: TYPE = RECORD [value: Short];
PokeShortResult: TYPE = RECORD [];
PokeLongResult: TYPE = RECORD [];
ShftReadResult: TYPE = RECORD [numRepeats: Short];
ShftWriteResult: TYPE = RECORD [numRepeats: Short];
ReturnLengthResult: TYPE = RECORD []; -- actually nothing returned
Result: TYPE = CHOICE OpCode OF {
peekShort => PeekShortResult,
pokeShort => PokeShortResult,
pokeLong => PokeLongResult,
shftRead => ShftReadResult,
shftWrite => ShftWriteResult,
returnLength => ReturnLengthResult
};
SeqResult: TYPE = SEQUENCE OF Result;
Errors
Fault: ERROR [code: FaultCode, address: Address] = 0;
FaultCode: TYPE = {
nonexistent(1), -- the referenced memory location does not exist
protection(2), -- access denied (can't happen with Softcard?)
alignmentShort(3), -- alignment error for Short (can't happen with 6085)
alignmentLong(4) -- alignment error for Long
};
Procedures
Procedure 0 is reserved for address lookup - not used at the moment
PeekShort: PROCEDURE [address: Address]
RETURNS [result: Short]
REPORTS [Fault]
= 1;
PokeShort: PROCEDURE [address: Address, value: Short]
REPORTS [Fault]
= 3;
PeekSeqShort: PROCEDURE [address: Address, count: CARDINAL]
RETURNS [resultSeq: SeqShort]
REPORTS [Fault]
= 4;
PeekSeqLong: PROCEDURE [address: Address, count: CARDINAL]
RETURNS [resultSeq: SeqLong]
REPORTS [Fault]
= 5;
PokeSeqShort: PROCEDURE [address: Address, valueSeq: SeqShort]
REPORTS [Fault]
= 6;
PeekLong: PROCEDURE [address: Address]
RETURNS [result: Long]
REPORTS [Fault]
= 7;
PokeLong: PROCEDURE [address: Address, value: Long]
REPORTS [Fault]
= 8;
DoCmds: PROCEDURE [cmdSeq: SeqCmd]
RETURNS [resultSeq: SeqResult]
REPORTS [Fault]
= 9;
SetShftAddrs: PROCEDURE[shftA, shftB: Address]
REPORTS [Fault]
= 10;
END.