<> <> <> <> Rapunzel: PROGRAM 2200 VERSION 3 = BEGIN <> <> <> <> <> 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; <> 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 }; <> <> 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.