; ; File: VSCDockingHandler.a ; ; Contains: a docking handler to support Dartanian's built-in VSC video ; ; Written by: Steve Christensen, Helder Ramalho, Dave Wong, Andy Gong (anyone else?) ; Rewritten: Mike Puckett, July 15, 1993. ; Copyright: © 1992-1993 by Apple Computer, Inc. All rights reserved. ; ; Change History (most recent first): ; ; 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ ; machines ; <1> 12-04-92 jmp first checked in ; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ ; Pre-SuperMario comments begin here. ; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ ;

6/1/92 HJR Fix Header. ;

6/1/92 HJR first checked in VidLowPwrFrame Record 0, Decrement VidLowPwrCntBlk Ds.b IOVQElSize ; control call parm block VidLowPwrVDPageInfo Ds.b VDPageInfo ; params VidLowPwrFrameSize Equ * ; size of frame Endr ;__________________________________________________________________________________________________ ; ; FUNCTION DockSelect(selector:OSType; params:LONGINT):LONGINT; ; ; Control/info handler for Dartanian/BlackBird. ; - selector is the index into the docking handler tables ; - params is any required input parameter ; ; DockSelect returns the result of the selector. ; ; Trashes: D0-D2, A0-A1 ;__________________________________________________________________________________________________ DockSelect Move.l (Sp)+,D2 ; Pop the return addressÉ Movea.l (Sp)+,A0 ; Éand the input params Move.l (Sp)+,D0 ; Éand the selector. Lea SelectorTable-4,A1 ; Point to the start of the table. @FindStatSelector Addq #4,A1 ; Skip over the previous function result. Move.l (A1)+,D1 ; If weÕre at the end of the function table, Beq.s @FindCtlSelector ; then check the other one. Cmp.l D1,D0 ; If this isnÕt the right selector, Bne.s @FindStatSelector ; then keep looking. Move.l (A1),D1 ; Get the function result into D1. @Done Move.l D1,(Sp) ; Stuff the funtion result onto the stack. Movea.l D2,A0 ; Restore the return address. Jmp (A0) ; And return. @FindCtlSelector Addq #4,A1 ; Skip over the function result/routine offset. Move.l (A1)+,D1 ; If weÕre at the end of this table, Beq.s @Done ; then we just leave. Cmp.l D1,D0 ; If this isnÕt the right selector, Bne.s @FindCtlSelector ; then keep looking. Adda.l (A1),A1 ; Get offset to routine. Jsr (A1) ; Jump to it. Move.l D0,D1 ; Copy result. Bra.s @Done ; Vamoose. SelectorTable ; Selector Function result ; -------- --------------- ; Dc.l dockSCCPorts, ((1< 110 bsr Delay100 ; delay 100 us move.b VSC_MonID(a4),d0 ; Read the sense lines into d0. lsr.b #4,d0 ; AB0 @EndC lsr.b #1,d0 ; 0AB or.b d0,D1 ; BC AC AB Move.b D1,D6 ; Save the extended-sense code. Movem.l (Sp)+,A0/D0-D1 ; Restore work registers. Rts ; Return to caller. ; In a ÒclassicÓ video card setup, weÕd normally perform the follwing code in the PrimaryInit. ; However, because we have a clamshell on Blackbird, we need to know whether or not it will ; be closed. If the clamshell is closed, we generally want to keep video turned off on the ; LCD, but only if some sort of external video is running. So, we check here to see if ; thereÕs a display attatched to the external video connector. If there is a display attached, ; then we just leave video power on. Otherwise, we turn it off, and the hardware attributes ; then return that no external video is available. ; ; No registers are trashed, but D0 returns the detected display code. ; DetectExtDisplay @ExtDispRegs Reg A0-A4/D1/D6 ; Define and save theÉ Movem.l @ExtDispRegs,-(Sp) ; Éregisters used here. ; Get some useful values up front. ; lea VSCVideoBase,a4 ; Get the video base address into a4. lea AIV3Base,a3 ; Point to AIV3 base. ; First, disable the VBL interrupts. ; Bset #VidPwrEn,AIV3PwrEn(a3) ; Turn on video power planeÉ Clr.b VSC_VidCtrl(A4) ; Ébut shut off syncs, dot clock, etcÉ. Move.w #500-1,D0 ; It takes approximately 500µsÉ @Wait500 Tst.b ([VIA]) ; Éfor the power-on signal to Dbra D0,@Wait500 ; Épropagate thru the video circuitry. Bset #vidReset,VSC_Test(A4) ; Reset the video subsystem byÉ Bclr #vidReset,VSC_Test(A4) ; Étoggling the reset bit. move.b #(1<. Clr.l spParamData(A0) ; Look only for enabled sRsrcs. Bset #foneslot,spParamData+3(A0) ; Limit search to this slot. _GetTypeSRsrc ; If we found it, then Beq.s @FoundDevice ; say so. Moveq #0,D0 ; Otherwise, say the device isnÕt loaded. Bra.s @Done ; @FoundDevice Move.w spRefNum(A0),D0 ; Get the refNum into D0. @Done Adda.w #SpBlockSize,Sp ; Restore the stack. Rts ; And vamoose. Endwith ;--------------------------------------------------------------------- ; ; Routine: ReadPMgrPRAM ; ; Inputs: D0.l - PRAM address. ; ; Outputs: D0.b - byte read ; ; Destroys: A0/D0. ; ; Function: Reads a byte of PowerMgr PRAM. ;--------------------------------------------------------------------- ; With PmgrRec ReadPMgrPRAM Movea.l PMgrBase,A0 ; Point to the Power ManagerÕs globals. Add.b PRAMBase(A0),D0 ; Get the absolute PRAM address. Swap D0 ; Save it. Addq #1,D0 ; Say we want one byte. Swap D0 ; Save it. Clr.b -(Sp) ; Make space for a buffer on the stack. Movea.l Sp,A0 ; Point to it. _ReadXPRAM ; Read the byte. Move.b (Sp)+,D0 ; Return it. Rts Endwith ;--------------------------------------------------------------------- ; ; Routine: WritePMgrPRAM ; ; Inputs: D0.l - PRAM address. ; D1.b - byte to write. ; ; Outputs: None. ; ; Destroys: A0/D0. ; ; Function: Writes a byte of PowerMgr PRAM (but doesnÕt set the dirty flag). ;--------------------------------------------------------------------- ; With PmgrRec WritePMgrPRAM Movea.l PMgrBase,A0 ; Point to the Power ManagerÕs globals. Add.b PRAMBase(A0),D0 ; Get the absolute PRAM address. Swap D0 ; Save it. Addq #1,D0 ; Say we want one byte. Swap D0 ; Save it. Move.b D1,-(Sp) ; Push the byte to write onto the stack. Movea.l Sp,A0 ; Point to it. _WriteXPRAM ; Write it. Tst.b (Sp)+ ; Clean up the stack. Rts Endwith