Utilities
PeekAtByteAd:
PROC [byteAd:
CARD32]
RETURNS [content:
CARD16] ~ {
wordAd: CARD32 ← Basics.DoubleShiftRight[[lc [byteAd]], 1].lc; -- /2
content ← DoveInputOutput.Peek[wordAd];
};
PokeAtByteAd:
PROC [byteAd:
CARD32, content:
CARD16] ~ {
wordAd: CARD32 ← Basics.DoubleShiftRight[[lc [byteAd]], 1].lc; -- /2
DoveInputOutput.Poke[wordAd, content];
};
ControlBitWrite:
PUBLIC
PROC [ byteAddress:
CARD32, polarity: Polarity, value:
BOOL ] ~ {
IF ((byteAddress MOD 8) # 7) THEN ERROR;
If error here the address for the control bit is false.
SELECT
TRUE
FROM
(polarity=ActiveLow) AND value => PokeAtByteAd[byteAddress, 0];
(polarity=ActiveLow) AND (NOT value) => PokeAtByteAd[byteAddress, commandBitMask];
(polarity=ActiveHigh) AND value => PokeAtByteAd[byteAddress, commandBitMask];
(polarity=ActiveHigh) AND (NOT value) => PokeAtByteAd[byteAddress, 0];
ENDCASE;
};
ControlBitRead:
PUBLIC
PROC [ byteAddress:
CARD32, polarity: Polarity ]
RETURNS [ value:
BOOL ] ~ {
read: CARD16 ~ Basics.BITAND[commandBitMask, PeekAtByteAd[byteAddress]];
IF ((byteAddress MOD 8) # 7) THEN ERROR;
If error here the address for the control bit is false.
SELECT
TRUE
FROM
( ( polarity = ActiveLow ) AND ( read = 0) ) => { value ← TRUE };
( ( polarity = ActiveLow ) AND ( read # 0) ) => { value ← FALSE };
( ( polarity = ActiveHigh ) AND ( read = 0) ) => { value ← FALSE };
( ( polarity = ActiveHigh ) AND ( read # 0) ) => { value ← TRUE };
ENDCASE;
};
Sparc Operations
SparcReset:
PUBLIC
PROC ~ {
ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, TRUE];
ResetSparcToIOPInt[];
ResetSparcToMesaInt[];
ResetSparcToSparcInt[];
ResetIOPToSparcInt[];
ResetMesaToSparcInt[];
};
SparcResetAndStart:
PUBLIC
PROC ~ {
ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, TRUE];
ControlBitWrite[sparcResetRegisterByte, sparcResetPolarity, FALSE];
ResetSparcToIOPInt[];
ResetSparcToMesaInt[];
ResetSparcToSparcInt[];
ResetIOPToSparcInt[];
ResetMesaToSparcInt[];
};
TestSparcError:
PUBLIC
PROC
RETURNS [ error:
BOOLEAN ] ~ {
error ← ControlBitRead[sparcErrorRegisterByte, sparcErrorPolarity];
};
Interrupt Operations
SetSparcToIOPInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToIOPIntRegisterByte, sparcToIOPIntPolarity, TRUE];
};
ResetSparcToIOPInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToIOPIntRegisterByte, sparcToIOPIntPolarity, FALSE];
};
SetSparcToMesaInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToMesaIntRegisterByte, sparcToMesaIntPolarity, TRUE];
};
ResetSparcToMesaInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToMesaIntRegisterByte, sparcToMesaIntPolarity, FALSE];
};
SetSparcToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToSparcIntRegisterByte, sparcToSparcIntPolarity, TRUE];
};
ResetSparcToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcToSparcIntRegisterByte, sparcToSparcIntPolarity, FALSE];
};
SetIOPToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[iOPToSparcIntRegisterByte, iOPToSparcIntPolarity, TRUE];
};
ResetIOPToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[iOPToSparcIntRegisterByte, iOPToSparcIntPolarity, FALSE];
};
SetMesaToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[mesaToSparcIntRegisterByte, mesaToSparcIntPolarity, TRUE];
};
ResetMesaToSparcInt:
PUBLIC
PROC ~ {
ControlBitWrite[mesaToSparcIntRegisterByte, mesaToSparcIntPolarity, FALSE];
};
SetSparcAbortInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcAbortIntRegisterByte, sparcAbortIntPolarity, TRUE];
};
ResetSparcAbortInt:
PUBLIC
PROC ~ {
ControlBitWrite[sparcAbortIntRegisterByte, sparcAbortIntPolarity, FALSE];
};
EnableInt:
PUBLIC
PROC ~ {
ControlBitWrite[enableIntRegisterByte, enableIntPolarity, TRUE];
};
DisableInt:
PUBLIC
PROC ~ {
ControlBitWrite[enableIntRegisterByte, enableIntPolarity, FALSE];
};
DMA Operations
DMAState: TYPE = SparcSoftcardOps.DMAState;
SetDMAState:
PUBLIC
PROC [dMAState: DMAState] ~ {
IF dMAState = active
THEN
ControlBitWrite[dMAActiveRegisterByte, dMAActivePolarity, TRUE]
ELSE
ControlBitWrite[dMAActiveRegisterByte, dMAActivePolarity, FALSE];
};
DMAMode: TYPE = SparcSoftcardOps.DMAMode;
SetDMAMode:
PUBLIC
PROC [dMAMode: DMAMode]~ {
SELECT dMAMode
FROM
= printer => {
ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, FALSE];
ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, FALSE];
};
= display => {
ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, FALSE];
ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, TRUE];
};
= versatecOneShot => {
ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, TRUE];
ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, FALSE];
};
= versatecStream => {
ControlBitWrite[dMAMode0RegisterByte, dMAMode0Polarity, TRUE];
ControlBitWrite[dMAMode1RegisterByte, dMAMode1Polarity, TRUE];
};
ENDCASE;
DMAAddressRegisterLoad:
PUBLIC
PROC [ byteAddress:
CARD32 ] ~ {
address: CARD32 ← Basics.DoubleShiftRight[[lc [byteAddress]], 3].lc; -- /8
PokeAtByteAd[dMAAddressRegisterHighByte, Basics.HighHalf[address]];
PokeAtByteAd[dMAAddressRegisterLowByte, Basics.LowHalf[address]];
};
Versatec Operations
VersatecMode: TYPE = SparcSoftcardOps.VersatecMode;
SetVersatecMode:
PUBLIC
PROC [versatecMode: VersatecMode] ~ {
IF ( versatecMode = print
OR versatecMode = SPPPrint )
THEN {
ControlBitWrite[versatecPrintRegisterByte, versatecPrintPolarity, TRUE];
}
ELSE {
ControlBitWrite[versatecPrintRegisterByte, versatecPrintPolarity, FALSE];
};
IF ( versatecMode = SPPPrint
OR versatecMode = SPPPlot )
THEN {
ControlBitWrite[versatecSPPRegisterByte, versatecSPPPolarity, TRUE];
}
ELSE {
ControlBitWrite[versatecSPPRegisterByte, versatecSPPPolarity, FALSE];
};
};
VersatecRCommand: TYPE = SparcSoftcardOps.VersatecRCommand;
SendVersatecRCommand:
PUBLIC
PROC [versatecRCommand: VersatecRCommand]
RETURNS [ ok:
BOOLEAN ]~ {
Reading the correct location sends the command
byteAddress: CARD32;
SELECT versatecRCommand
FROM
= CLEAR => byteAddress ← SparcSoftcard.versatecClearByte;
= RESET => byteAddress ← SparcSoftcard.versatecResetByte;
= RLTER => byteAddress ← SparcSoftcard.versatecRLTERByte;
= RFFED => byteAddress ← SparcSoftcard.versatecRFFEDByte;
= REOTR => byteAddress ← SparcSoftcard.versatecREOTRByte;
ENDCASE;
[] ← PeekAtByteAd[byteAddress];
VersatecCommandTermin:
PUBLIC
PROC []
RETURNS [terminated:
BOOLEAN] ~ {
terminated ← ControlBitRead[pVEndRegisterByte, pVEndPolarity];
};
VersatecSendOneByte: PUBLIC PROC [ byteAddress: CARD32 ] RETURNS [ ok: BOOLEAN ] ~ {
SetDMAState[inactive];
SetDMAMode[versatecOneShot];
DMAAddressRegisterLoad[byteAddress];
SetDMAState[active];
WHILE NOT VersatecCommandTermin[] DO
ENDLOOP;
SetDMAState[inactive];
};
}.