{ IOCopy.mc, HGM, 11-Feb-84 15:48:44 This module implements a clump of opcodes used to copy data from/to main memory to/from Multibus IO addresses. The extra set of opcodes is because some devices (DES chip, SUN 3mb board) stuff all the data through 1 address, and others (3Com 10mb board) use a range of addresses. "Read" means Read from IO device and write into memory. "Write" means Write to IO device and read from memory. IO Mapping can't cross 64K word boundries. (Something is probably wrong if they cross 64K byte boundries.) Main memory address must be valid if word count is 0. Register usage: rhRio, Rio Used to address IO device T Holds data word rhTT, TT/Q Hold Virtual address rhRx, Rx Hold Real address TOS Has count of words left to transfer All 8 operations are minimal stack. Thus: TOS Count of words to transfer uStack5 STK High word of IO address uStack4 STK-1 Low word of IO address uStack3 STK-2 High word of main memory address uStack2 STK-3 Low word of main memory address Except for uStack2, the info on the stack is kept up to date. L0, L1, and L3 used for Map Fixup L2 used for mode dispatching Beware: IO Addresses are WORD addresses rather than byte addresses. Most boards will ignore the high bit in Rio and all of rhRio. rhRio is there because the 3Com Ethernet boards eat up a lot of address space. Fortunately, they respond to 24 bit addresses. IO addresses can't cross 64K boundries. Note that main memory address is on the bottom of the stack for both Reading and Writing. This makes the microcode simpler, but adds an opportunity to get things mixed up if you expect the dest to be on the bottom. } Set[L2.ReadHole, 0]; Set[L2.ReadBlock, 1]; Set[L2.ReadHyper, 2]; Set[L2.WriteHole, 3]; Set[L2.WriteBlock, 4]; Set[L2.WriteHyper, 5]; Set[L2.ReadHoleSlow, 6]; Set[L2.WriteHoleSlow, 7]; ESC9n: {L2 loaded on the DISP4 to get here} ReadHole: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.ReadHole,10,ESC9n]; ReadBlock: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.ReadBlock,10,ESC9n]; ReadHyper: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.ReadHyper,10,ESC9n]; WriteHole: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.WriteHole,10,ESC9n]; WriteBlock: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.WriteBlock,10,ESC9n]; WriteHyper: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.WriteHyper,10,ESC9n]; ReadHoleSlow: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.ReadHoleSlow,10,ESC9n]; WriteHoleSlow: TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1, at[L2.WriteHoleSlow,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[08,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[09,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0A,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0B,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0C,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0D,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0E,10,ESC9n]; PC _ PC - 1, GOTO[ESCb], c1, at[0F,10,ESC9n]; IOCopyRestart: rhTT _ uStack3{MemHi}, c2; L0 _ L0.IOCopy, GOTO[IOMap], c3; IONewPage: [] _ TT, ZeroBr, CANCELBR[$, 1], c2; uStack2 _ TT, BRANCH[IOMap, IONewBank], c3; IONewBank: Q _ rhTT + 1, LOOPHOLE[byteTiming], c1; rhTT _ Q LRot0, c2; uStack3 _ Q, c3; IOMap: Map _ Q _ [rhTT, TT], L1 _ L1.None, c1; rhRio _ uStack5{IOHi}, c2; Rx _ rhRx _ MD, XDirtyDisp, c3; BRANCH[IOMud, $, 1] c1, WLMFRet[L0.IOCopy]; [] _ TOS, ZeroBr, c2; BRANCH[IOCopy, IOCopyDone], c3; IOCopy: Rio _ uStack4, MesaIntBr, BRANCH[$, IONewPage], c1; Q _ Rio + 1, L2Disp, BRANCH[$, IOCopyInt], c2; DISP3[IOLoad], c3; IOLoadWord: IO _ [rhRio, Rio + 0], GOTO[IORdHole], c1, at[L2.ReadHole, 8, IOLoad]; IO _ [rhRio, Rio + 0], GOTO[IORd], c1, at[L2.ReadBlock, 8, IOLoad]; MAR _ [rhRio, Rio + 0], RawRef, GOTO[IORd], c1, at[L2.ReadHyper, 8, IOLoad]; MAR _ [rhRx, TT + 0], GOTO[IORdHole], c1, at[L2.WriteHole, 8, IOLoad]; MAR _ [rhRx, TT + 0], GOTO[IORd], c1, at[L2.WriteBlock, 8, IOLoad]; MAR _ [rhRx, TT + 0], GOTO[IORd], c1, at[L2.WriteHyper, 8, IOLoad]; IO _ [rhRio, Rio + 0], GOTO[IORdHole], c1, at[L2.ReadHoleSlow, 8, IOLoad]; MAR _ [rhRx, TT + 0], GOTO[IORdHole], c1, at[L2.WriteHoleSlow, 8, IOLoad]; IORdHole: L2Disp, GOTO[IORda], c2; IORd: uStack4 _ Q, L2Disp, c2; IORda: T _ MD, DISP3[IOStore], c3; IOStoreWord: MAR _ [rhRx, TT + 0], GOTO[IOWr], c1, at[L2.ReadHole, 8, IOStore]; MAR _ [rhRx, TT + 0], GOTO[IOWr], c1, at[L2.ReadBlock, 8, IOStore]; MAR _ [rhRx, TT + 0], GOTO[IOWr], c1, at[L2.ReadHyper, 8, IOStore]; IO _ [rhRio, Rio + 0], GOTO[IOWr], c1, at[L2.WriteHole, 8, IOStore]; IO _ [rhRio, Rio + 0], GOTO[IOWr], c1, at[L2.WriteBlock, 8, IOStore]; MAR _ [rhRio, Rio + 0], RawRef, GOTO[IOWr], c1, at[L2.WriteHyper, 8, IOStore]; MAR _ [rhRx, TT + 0], GOTO[IOWr], c1, at[L2.ReadHoleSlow, 8, IOStore]; IO _ [rhRio, Rio + 0], GOTO[IOWr], c1, at[L2.WriteHoleSlow, 8, IOStore]; IOWr: MDR _ T, TOS _ TOS - 1, ZeroBr, c2; TT _ TT + 1, PgCarryBr, BRANCH[IOCopy, IOCopyDone], c3; {-------------------------------------------------------------------------} {Don't bother to remember if we are reading or writing} {Map Update smashes L3.} IOMud: CALL[WLMapFix], c2; {-------------------------------------------------------------------------} IOCopyInt: [] _ uWDC, NZeroBr, CANCELBR[$, 0F], c3; uStack2 _ TT, BRANCH[$, IOCopyIgnoreInt], c1; PC _ PC - 1, GOTO[IOCopyDoInt], c2; IOCopyFalseInt: {Lots of registers have been smashed, but not L2} TT _ uStack2{MemLo}, GOTO[IOCopyRestart], c1; IOCopyIgnoreInt: Noop, c2; ClrIntErr, GOTO[IOCopy], c3; {-------------------------------------------------------------------------} IOCopyDone: stackP _ 0, CANCELBR[$, 1], c1; Noop, c2; Xbus _ uPCCross, XRefBr, c3; PC _ PC - PC16, BRANCH[blNoInt, blSetInt {Block.mc}], c1; {-------------------------------------------------------------------------}