DIRECTORY Basics USING [ LowByte ], Commander USING [ CommandProc, Register ], DoveInputOutput USING [ Peek, Poke ], IO USING [ PutF ]; SparcSoftcardMapInitialize: CEDAR PROGRAM IMPORTS Basics, Commander, DoveInputOutput, IO ~ BEGIN threePtFiveByteAddress: CARD32 ~ 0380000H; threePtFiveWordAddress: CARD32 ~ threePtFiveByteAddress / 2; alternatePathByteOffset: CARD32 ~ 10000H; alternatePathWordOffset: CARD32 ~ alternatePathByteOffset / 2; tRegisterByteOffset: CARD32 ~ 04C06H; tRegisterWordOffset: CARD32 ~ tRegisterByteOffset / 2; tRegisterWord: CARD32 ~ threePtFiveWordAddress + tRegisterWordOffset; tRegisterAlternateWord: CARD32 ~ threePtFiveWordAddress + tRegisterWordOffset + alternatePathWordOffset; mapWindowBaseByteOffset: CARD32 ~ 08000H; mapWindowBaseWordOffset: CARD32 ~ mapWindowBaseByteOffset / 2; mapWindowBaseWord: CARD32 ~ threePtFiveWordAddress + mapWindowBaseWordOffset; mapPageRegisterByteOffset: CARD32 ~ 04406H; mapPageRegisterWordOffset: CARD32 ~ mapPageRegisterByteOffset / 2; mapPageRegisterWord: CARD32 ~ threePtFiveWordAddress + mapPageRegisterWordOffset; daybreakMapPage: BYTE ~ 014h; -- This number has to be stored inside mapPageRegister in order to have inside the window the map entries for the Mesa processor and the IOP. iopBaseEntryInsideWindow: NAT ~ 0; mesaBaseEntryInsideWindow: NAT ~ 200H; mapEntryHighPartByteOffset: NAT ~ 6; mapEntryHighPartWordOffset: NAT ~ mapEntryHighPartByteOffset / 2; mapEntryLowPartByteOffset: NAT ~ 0EH; mapEntryLowPartWordOffset: NAT ~ mapEntryLowPartByteOffset / 2; mapEntrySizeByte: NAT ~ 10H; mapEntrySizeWord: NAT ~ mapEntrySizeByte / 2; mapEntryHighPartPattern: NAT ~ 0; mapEntryLowPartPattern: NAT ~ 0; softcardPageSize: NAT ~ 2000H; magic: BYTE ~ 05Ah; -- Arbitrary constant magicNot: BYTE ~ 0A5h; -- Another arbitrary constant MyPoke: PROC [address: CARD32, word: UNSPECIFIED] ~ { DoveInputOutput.Poke[address, word]; }; MyPeek: PROC [address: CARD32] RETURNS [ word: UNSPECIFIED ]~ { word _ DoveInputOutput.Peek[address]; }; SparcSoftcardMapInitializeProc: Commander.CommandProc = BEGIN PeekPokePeekRestore: PROC [ address0: CARD32, content: CARD16, address1: CARD32 ] RETURNS [ lowByte: BYTE ] ~ { word0: CARD16 ~ MyPeek[address0]; MyPoke[address0, content]; { word1: CARD16 ~ MyPeek[address1]; lowByte _ Basics.LowByte[word1]; }; MyPoke[address0, word0]; }; constant1: BYTE ~ PeekPokePeekRestore[tRegisterWord, magic, tRegisterAlternateWord]; constant2: BYTE ~ PeekPokePeekRestore[tRegisterAlternateWord, magicNot, tRegisterWord]; softcardHere: BOOL ~ SELECT TRUE FROM ( constant1 # magic ) => FALSE, ( constant2 # magicNot ) => FALSE, ENDCASE => TRUE; IF ( softcardHere ) THEN { value: INT16; addressIOPHigh: CARD32 ~ mapWindowBaseWord + mapEntrySizeWord * iopBaseEntryInsideWindow + mapEntryHighPartWordOffset; addressIOPLow: CARD32 ~ mapWindowBaseWord + mapEntrySizeWord * iopBaseEntryInsideWindow + mapEntryHighPartWordOffset; addressMesaHigh: CARD32 ~ mapWindowBaseWord + mapEntrySizeWord * mesaBaseEntryInsideWindow + mapEntryHighPartWordOffset; addressMesaLow: CARD32 ~ mapWindowBaseWord + mapEntrySizeWord * mesaBaseEntryInsideWindow + mapEntryHighPartWordOffset; startingPage: NAT ~ 180000h / softcardPageSize; -- Softcard memory starts at 1.5 meg in Daybreak adress space endingPage: NAT ~ 380000h / softcardPageSize; -- Softcard memory starts at 3.5 meg in Daybreak adress space MyPoke[mapPageRegisterWord, daybreakMapPage]; -- Initialize the window register FOR i: NAT IN [startingPage..endingPage) DO MyPoke[addressIOPHigh + mapEntrySizeWord * i, mapEntryHighPartPattern]; MyPoke[addressMesaHigh + mapEntrySizeWord * i, mapEntryHighPartPattern]; value _ mapEntryLowPartPattern + i - startingPage; MyPoke[addressIOPLow + mapEntrySizeWord * i, value]; MyPoke[addressMesaHigh + mapEntrySizeWord * i, value]; ENDLOOP; IO.PutF[cmd.out,"SPARC Softcard present\n"] } ELSE IO.PutF[cmd.out,"SPARC Softcard NOT present\n"]; END; Commander.Register[key: "SparcSoftcardMapInitialize", proc: SparcSoftcardMapInitializeProc, doc: "This program test the presence of a Sparc softcard.\n"]; END. SparcSoftcardMapInitialize.mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Christophe Cuenod, April 15, 1988 5:57:46 pm PDT This program tests for the presence of a Sparc softcard and initialise the Mesa map and the IOP map. Daybreak memory range 1.5 to 3.5 Mbytes is mapped into the 2 first Mbytes of the Sparc softcard local memory. Due to the decoding the peripheral registers of the softcard appear at different locations mapWindow is a 2048 entries window to the sparc softcard map. This map contains the entries for the Sparc as well as the Mesa processor, the IOP and the DMA. In order to change the window you must write mapPageRegister. mapPageRegister is a register that holds the 5 more significant bits of address of the map entries array. IfmapPageRegister holdsthe value daybreakMapPage the window will point to the right locations for the Mesa and IO port. In this case IOP page 0 will be the iopBaseEntryInsideWindow entry and Mesa page 0 will be the mesaBaseEntryInsideWindow entry. Currently mapPageRegister is Write only register Each entry of the map is composed of 2 non contiguous 16 bits words. The high part of the map contains mostly the flags and has to be set to mapEntryHighPartPattern. The low part of the map contains mostly the page number (limited to [0..0400H) for 8 Megabytes memory and has to be set to mapEntryLowPartPattern + the required phisical page number. Size of a softcard VM page. Fill the High part of the entry for IOP and Mesa Fill the Low part of the entry for IOP and Mesa Κx˜code•Mark outsideHeaderšœ™Kšœ<™KšœZ™Z—K˜Kšœœ ˜%Kšœœ˜6Kšœœ0˜EKšœœJ˜hK˜Kšœœ œ?™ΫK™Kšœœ ˜)Kšœœ˜>Kšœœ4˜MK™Kšœi™iKšœoœœo™χKšœΟa œ ™2K˜Kšœœ ˜+Kšœœ!˜BKšœœ6˜QK˜Kšœœ Οc˜«K˜Kšœœ˜"Kšœœ˜&K˜K™DKšœœ˜$Kšœœ"˜AKšœœ˜%Kšœœ"˜@Kšœœ˜Kšœœ˜-K˜Kšœ`™`KšœΆ™ΆKšœœ˜!Kšœœ˜ K™K™Kšœœ ˜K˜Kšœœ  ˜)Kšœ œ  ˜4K˜šžœœ œ œ˜5Kšœ$˜$K˜—š žœœ œœ  œ˜?Kšœ%˜%K˜—K˜šžœ˜=šžœœ œ œ œœ œ˜oKšœœ˜"Kšœ˜˜Kšœœ˜!Kšœ ˜ K˜—Kšœ˜K˜K˜—Kšœ œE˜TKšœ œH˜WK˜šœœœœ˜%Kšœœ˜Kšœœ˜"Kšœœ˜—K˜šœ˜šœ˜Kšœœ˜ Kšœœa˜wKšœœa˜vKšœœb˜yKšœœb˜xK˜Kšœœ  =˜nKšœ œ  =˜lK˜Kšœ. !˜OK˜šœœœ˜+Kšœ$œ ™0KšœG˜GKšœH˜HKšœ#œ ™/Kšœ2˜2Kšœ4˜4Kšœ6˜6Kšœ˜—K˜Kšœ)˜+K˜—Kšœœ.˜5—Kšœ˜K˜—Kšœš˜šKšœ˜—J˜—…—”