; Mu Float.mu ; Copywrite Xerox Corporation 1980 ; Horizontal bit blit. ; Updated by Bob Lyon on November 2, 1979 10:48 AM ; Updated by LStewart on May 14, 1980 7:33 PM ; Entry point is 540B. ; The only way this routine distinguishes HBlt from XHBlt ; is by inspection of stkp. If its is NOT 1 then XHBlt is used ; instead of HBlt. ; If this is used with the floating point package, ; put this file after the floating point entry predefs. ; That is, put "#HBlt.mu;" after the ram entry vector in file ; Float.mu. ; $ROMMUL $L004120,0,0; MUL routine address (120B) in ROM0 ; shiftable register declarations $MRMC $600; ; shiftable register declarations $Temp $R1; $OpCode $R2; ; non-shiftable register declarations $flags $R35; $dbca $R36; $gray $R55; $Smask $R57; $x1 $R56; $x2 $R41; $Mflag $R45; $HoldPC $R44; $addr $R47; $endAddr $R51; $AllOnes $R46; $savBnk $R43; $BnkAddr $R42; ; 3 and 50 should be available ; Move seven parameters from memory to S registers ; and claculate deltax, deltay, and init point P to point A ; %1,1777,550,HBlt; HBlt is the entry point. %7,17,0, Got0,, Got2,, Got4,, Got6; Return locs for mem reads. !1,2, Punt, Read; !1,2, Step4, Step3; HBlt: T _ ALLONES; MAR _ L _ 37 XOR T; BnkAddr _ L, L _ T; AllOnes _ L; L _ MD, TASK; savBnk _ L; T _ 2, :Read; -- read dbmr and y Got2: T _ MD; AC2 _ L, L _ T; AC1 _ L, L _ T _ 0; -- get ready for (y*dbmr) ; AC0 _ L, :Read; -- read flags and dbca Got0: T _ MD; flags _ L, L _ T, TASK; dbca _ L; ; T _ 4, :Read; -- read x1 and x2 Got4: T _ MD; x1 _ L, L _ T; x2 _ L; L _ x1 - T - 1; T _ 6, SH<0; ; :Punt; -- IF (x1 <= x2) goto read Got6: gray _ L, :GetAddr; ; ; -- Read memory subroutine Read: MAR _ stk0 + T; L _ T; SINK _ M, BUS; L _ MD, :Got0; -- return to Got[0-6] ; ; ; Compute the effective word begin & end address ; addr _ dbca + (y*dbmr) + x1/16; ; endAddr _ dbca + (y*dbmr) + x2/16; ; %1,1777,177,MULret; GetAddr: L _ PC, TASK; HoldPC _ L; T _ ALLONES; L _ MRMC XOR T, SWMODE; PC _ L, :ROMMUL; MULret: L _ HoldPC, TASK; -- restore the return addr PC _ L; T _ dbca; -- result is in AC1 L _ AC1 + T; T _ M; ; L _ x1; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp + T; addr _ L; ; L _ x2; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp; Temp _ L RSH 1; L _ Temp + T, TASK; endAddr _ L; ; T _ 0 + 1; L _ flags AND T; Mflag _ L; T _ 7; L _ flags AND T; OpCode _ L RSH 1; !1,2,UseXHB,Step1; ; -- If not HBlt then alter memory bank L _ stkp - 1; T _ 3, SH=0, :UseXHB; ; UseXHB: L _ savBnk AND NOT T; T _ stk1 . T; MAR _ BnkAddr; L _ M OR T; MD _ M, :Step1; ; ; -- mainloop has for steps: ; -- Step1: The left hand side of the blt. ; -- Step2: The right hand side of the blt. ; -- Step3: The middle of the blt. ; -- Step4: Finished. ; -- Narrow blts causes steps 1 and 3 to be performed together. %17,37,0, LftEnd0, LftEnd1, LftEnd2, LftEnd3, LftEnd4, LftEnd5, LftEnd6, LftEnd7, LftEnd8, LftEnd9, LftEnd10, LftEnd11, LftEnd12, LftEnd13,LftEnd14, LftEnd15; ; ; -- Step 1 - Draw the furthest left hand side of the scanline. ; -- Bits [15-offset1 .. 0] are set to 1's. Step1: T _ 17; -- SINK _ x1 AND 17 L _ x1 AND T; SINK _ M, BUS; T _ endAddr, :LftEnd0; LftEnd0: L _ ALLONES, :ContLE; LftEnd1: L _ 77777, :ContLE; LftEnd2: L _ 37777, :ContLE; LftEnd3: L _ 17777, :ContLE; LftEnd4: L _ 7777, :ContLE; LftEnd5: L _ 3777, :ContLE; LftEnd6: L _ 1777, :ContLE; LftEnd7: L _ 777, :ContLE; LftEnd8: L _ 377, :ContLE; LftEnd9: L _ 177, :ContLE; LftEnd10: L _ 77, :ContLE; LftEnd11: L _ 37, :ContLE; LftEnd12: L _ 17, :ContLE; LftEnd13: L _ 7, :ContLE; LftEnd14: L _ 3, :ContLE; LftEnd15: L _ 0 + 1, :ContLE; ; !1,2, ContSt1, Stp1to3; %3,7,0, mRead, XmRead; %3,7,0, mWrite, XmWrite; ; ContLE: Smask _ L; L _ addr - T; -- T _ endAddr from above TASK, SH=0; :ContSt1; ContSt1: SINK _ Mflag, BUS; L _ ALLONES, :mRead; Stp1to3: T _ 17, :Step3; ; !1,2, ContSt2, ContSt3; %17,37,0, RhtEnd0, RhtEnd1, RhtEnd2, RhtEnd3, RhtEnd4, RhtEnd5, RhtEnd6, RhtEnd7, RhtEnd8, RhtEnd9, RhtEnd10, RhtEnd11, RhtEnd12, RhtEnd13,RhtEnd14, RhtEnd15; ; -- Step 3 - Draw the furthest right hand side word of the ; -- scanline. Bits [0 .. offset2] are left alone. Step3: L _ x2 AND T; -- SINK _ x2 AND 17 SINK _ M, BUS; :RhtEnd0; RhtEnd0: T _ 77777, :ContRE; RhtEnd1: T _ 37777, :ContRE; RhtEnd2: T _ 17777, :ContRE; RhtEnd3: T _ 7777, :ContRE; RhtEnd4: T _ 3777, :ContRE; RhtEnd5: T _ 1777, :ContRE; RhtEnd6: T _ 777, :ContRE; RhtEnd7: T _ 377, :ContRE; RhtEnd8: T _ 177, :ContRE; RhtEnd9: T _ 77, :ContRE; RhtEnd10: T _ 37, :ContRE; RhtEnd11: T _ 17, :ContRE; RhtEnd12: T _ 7, :ContRE; RhtEnd13: T _ 3, :ContRE; RhtEnd14: T _ 0+1, :ContRE; RhtEnd15: T _ 0, :ContRE; ContRE: L _ Smask AND NOT T, TASK; Smask _ L; ContSt3: SINK _ Mflag, BUS; L _ ALLONES, :mRead; ; ; -- The 1's in Smask describes which bit locations in the word ; -- That will be affected by HBlt. %7,17,0, op0, op1, op2, op3; mRead: MAR _ addr, :ContMB; XmRead: XMAR _ addr, :ContMB; ContMB: T _ Smask; SINK _ OpCode, BUS; Smask _ L, :op0; ; op0: L _ MD AND NOT T; -- dest _ gray T _ gray . T; L _ M OR T, :ContBd2; ; op1: T _ gray . T; -- dest _ dest OR gray L _ MD OR T, :ContBd2; ; op2: T _ gray . T; -- dest _ dest XOR gray L _ MD XOR T, :ContBd2; ; op3: T _ gray . T; -- dest _ (NOT gray) AND dest L _ AllOnes XOR T; T _ MD; L _ M AND T, :ContBd2; ; ContBd2: SINK _ Mflag, TASK, BUS; Temp _ L, :mWrite; mWrite: MAR _ addr, :Step2; XmWrite: XMAR _ addr, :Step2; ; Step2: T _ endAddr-1; L _ addr - T; MD _ Temp; L _ addr + 1, SH<0; addr _ L, :ContSt2; -- IF(addr