mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2025-02-08 11:32:26 +00:00
Reverse roughly to 81838
This commit is contained in:
parent
1a0bf7c4ad
commit
1833036a99
Binary file not shown.
@ -265,70 +265,110 @@ selectInitializediskCache equ $0010 ; <24>
|
||||
MACRO
|
||||
_sbIsOutline
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbIsOutline,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbIsOutline,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbRetrieveGlyph
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbRetrieveGlyph,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbRetrieveGlyph,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbKillSomeCaches
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbKillSomeCaches,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbKillSomeCaches,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbFillWidthTab
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbFillWidthTab,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbFillWidthTab,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbResetWorkSpace
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbResetWorkSpace,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbResetWorkSpace,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbInitMemory
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbInitMemory,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbInitMemory,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbSetFontState
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbSetFontState,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbSetFontState,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbSearchForCache
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbSearchForCache,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbSearchForCache,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_sbPreFlightFontMem
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbPreFlightFontMem,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbPreFlightFontMem,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
_fsLowestPPEM
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #fsLowestPPEM,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #fsLowestPPEM,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
@ -341,19 +381,31 @@ selectInitializediskCache equ $0010 ; <24>
|
||||
MACRO
|
||||
_sbFlushFonts
|
||||
IMPORT SplineMgr
|
||||
MOVEQ #sbFlushFonts,D0
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #sbFlushFonts,D0
|
||||
OPT &OLDOPT
|
||||
_SplineMgr
|
||||
ENDM
|
||||
|
||||
Macro ; <24>
|
||||
_InitializePartialFonts ; <24>
|
||||
moveq #selectInitializePartialFonts,d0 ; <24>
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #selectInitializePartialFonts,d0 ; <24>
|
||||
OPT &OLDOPT
|
||||
_SplineMgr ; <24>
|
||||
EndM ; <24>
|
||||
|
||||
Macro ; <24>
|
||||
_InitializeDiskCache ; <24>
|
||||
moveq #selectInitializeDiskCache,d0 ; <24>
|
||||
LCLC &OLDOPT
|
||||
&OLDOPT SETC &Setting('OPT')
|
||||
OPT NONE
|
||||
MOVE #selectInitializeDiskCache,d0 ; <24>
|
||||
OPT &OLDOPT
|
||||
_SplineMgr ; <24>
|
||||
EndM ; <24>
|
||||
|
||||
|
@ -1071,12 +1071,42 @@ NXTDST MOVE.L (A4)+,D1 ;GET NEXT DST DEVICE
|
||||
MOVE.L srcDevice,A1 ;handle to source gDevice
|
||||
move.l (a1),a1 ;pointer to source gDevice
|
||||
move.l gdRect(a1),d0 ;get rect top.left
|
||||
move.l theGDevice,a1 ;handle to destination gDevice
|
||||
move.l (a1),a1 ;pointer to destination gDevice
|
||||
cmp.l gdRect(a1),d0 ;dest and src gDevice have same top-left?
|
||||
beq.s nxtdst ;devices overlap, skip drawing
|
||||
|
||||
|
||||
move.l theGDevice,a0 ;handle to destination gDevice
|
||||
move.l (a0),a0 ;pointer to destination gDevice
|
||||
|
||||
CMP $24(A0), D0
|
||||
BGT.S @L5
|
||||
BLT.S @L2
|
||||
SWAP D0
|
||||
CMP gdRect+0(A0), D0
|
||||
BGT.S @L6
|
||||
BLT.S @L3
|
||||
MOVE.L gdRect+4(A1), D0
|
||||
CMP gdRect+6(A0), D0
|
||||
BLT.S @L7
|
||||
BGT.S @L4
|
||||
BRA.S nxtdst
|
||||
@L2 SWAP D0
|
||||
CMP gdRect+0(A0), D0
|
||||
BGT.S @cont
|
||||
@L3 MOVE.L gdRect+4(A1), D0
|
||||
CMP gdRect+6(A0), D0
|
||||
BLT.S @cont
|
||||
@L4 SWAP D0
|
||||
CMP gdRect+4(A0), D0
|
||||
BLT.S @cont
|
||||
BRA.S nxtdst
|
||||
@L5 SWAP D0
|
||||
CMP gdRect+0(A0), D0
|
||||
BLT.S @cont
|
||||
@L6 MOVE.L gdRect+4(A1), D0
|
||||
CMP gdRect+6(A0), D0
|
||||
BGT.S @cont
|
||||
@L7 SWAP D0
|
||||
CMP gdRect+4(A0), D0
|
||||
BGT.S @cont
|
||||
BRA.S nxtdst
|
||||
|
||||
@cont
|
||||
;
|
||||
; End of <KON 2/19/90>
|
||||
@ -1715,7 +1745,29 @@ VARSIZE EQU 0
|
||||
|
||||
share LINK A6,#VARSIZE ;ALLOCATE STACK FRAME
|
||||
MOVEM.L D3-D7/A2-A4,-(SP) ;SAVE WORK REGISTERS FOR DEVLOOP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; SET UP REGISTERS FOR CALLING CMDEVLOOP
|
||||
|
||||
MOVE.L DSTBITS(A6),A1 ;GET DST BIT/PIXMAP
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -50,6 +50,7 @@ PrNonPortable EQU 1
|
||||
WholeErrors EQU 1
|
||||
AddrModeFlag EQU 0
|
||||
Quicker EQU 1
|
||||
has32BitQD EQU 1
|
||||
|
||||
ROMPaletteMgr EQU 1 ;set to zero for System Disk, 1 for ROM build <C864>
|
||||
|
||||
@ -133,6 +134,10 @@ _PMBackColor OPWORD $Aa98
|
||||
ENDM
|
||||
|
||||
|
||||
QD_ERASECURSOR proc export
|
||||
QD_DRAWCURSOR proc export
|
||||
GETDCTLENTRY proc export
|
||||
|
||||
BlockHead PROC EXPORT
|
||||
|
||||
GBLC &CurFile ;current file name used by DrawingVars
|
||||
@ -155,6 +160,7 @@ BlockHead PROC EXPORT
|
||||
endif
|
||||
INCLUDE 'BITBLT.a'
|
||||
INCLUDE 'cCrsrCore.a'
|
||||
INCLUDE 'QDExtensions2.a'
|
||||
INCLUDE 'QDUtil.a'
|
||||
INCLUDE 'Colorasm.a'
|
||||
INCLUDE 'Patterns.a'
|
||||
@ -182,4 +188,35 @@ BlockHead PROC EXPORT
|
||||
INCLUDE 'PaletteMgr.a' ; <02Jun87 DAF>
|
||||
INCLUDE 'GWorld.a' ; <29May89 BAL>
|
||||
|
||||
QDEXTENSIONS2_SELECTOR_0 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_1 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_2 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_3 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_4 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_5 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_6 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_7 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_8 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_9 PROC EXPORT
|
||||
QDEXTENSIONS2_SELECTOR_10 PROC EXPORT
|
||||
QDNEW_HIDECURSOR PROC EXPORT
|
||||
QDNEW_SHOWCURSOR PROC EXPORT
|
||||
QDNEW_SHIELDCURSOR PROC EXPORT
|
||||
QDNEW_SCRNADDRESS PROC EXPORT
|
||||
QDNEW_SCRNSIZE PROC EXPORT
|
||||
QDNEW_INITCURSOR PROC EXPORT
|
||||
QDNEW_SETCURSOR PROC EXPORT
|
||||
QDNEW_OBSCURECURSOR PROC EXPORT
|
||||
QDNEW_ALLOCCRSR PROC EXPORT
|
||||
QDNEW_SETCCURSOR PROC EXPORT
|
||||
|
||||
CRSRVBLTASK PROC EXPORT
|
||||
UNBLITCURSOR PROC EXPORT
|
||||
BLITCURSOR PROC EXPORT
|
||||
SETCRSRDATA PROC EXPORT
|
||||
GETMAINCRSR PROC EXPORT
|
||||
CURSORSECT PROC EXPORT
|
||||
ALLOCCRSR PROC EXPORT
|
||||
|
||||
|
||||
END
|
||||
|
@ -317,557 +317,40 @@ SetDevGamma
|
||||
; ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Link A6,#-$B4
|
||||
Move.l A2,-(SP)
|
||||
Move.l (A0),A2
|
||||
|
||||
Lea.l -$94(A6),A1
|
||||
Move.l #-2,(A1)
|
||||
|
||||
Lea.l -$B4(A6),A0
|
||||
Move.l A0,$C(A1)
|
||||
Lea.l -$40(A6),A0
|
||||
|
||||
Move (A2),$18(A0)
|
||||
Move #$14,$1A(A0)
|
||||
Move.l A1,$1C(A0)
|
||||
dc.w $A205 ; _PBStatusImmed
|
||||
Move.l (SP)+,A2
|
||||
Unlk A6
|
||||
Rts
|
||||
|
||||
|
||||
|
||||
CheckDevices ; <19>: Moved label from within if-endif to embed utility
|
||||
; routines. It would be nice to be able to the the LINK
|
||||
; stuff AFTER the GotScrn entrypoint.
|
||||
|
||||
LINK A6,#VARSIZE ; allocate local stack frame
|
||||
MOVEM.L A0-A6/D0-D7,-(SP) ; so we donÕt screw up the boot process
|
||||
;+++ MOVEM.L D6-D7/A2-A4,-(SP) ; save work registers
|
||||
|
||||
;+++; check to see if the device list needs to be initialized
|
||||
;+++
|
||||
;+++ MOVE.L DeviceList,A0 ; get handle to device list
|
||||
;+++ MOVE.L (A0),A0 ; point to head of device list
|
||||
;+++ MOVE GDFlags(A0),D0 ; get the flags word
|
||||
;+++ BTST #allInit,D0 ; test initialize flag?
|
||||
;+++ BNE GoHome ; => devices already initialized
|
||||
|
||||
; ¥¥¥ 1st INIT ¥¥¥
|
||||
;
|
||||
; Try to load in the resource. If none, then just do a SetEntries on the boot device (see
|
||||
; the comments on the NoScrn code below).
|
||||
;
|
||||
GetScrn
|
||||
CLR.L -(SP) ; make room for function result
|
||||
MOVE.L #'scrn',-(SP) ; push desired resource type
|
||||
CLR -(SP) ; resource ID = 0
|
||||
_GetResource ; get the resource
|
||||
MOVE.L (SP)+,D0 ; get the resource handle
|
||||
Beq.s NoScrn ; if nil, do the no 'scrn' code
|
||||
|
||||
; ¥¥¥ 2nd INIT ¥¥¥
|
||||
;
|
||||
; Test the scrnInval low-mem to make sure the screen resource is valid. (Note: scrnInval
|
||||
; will generally be cleared by the video cardÕs primaryInit IF the information in
|
||||
; pRAM doesnÕt match the current set up). This is ALSO a case where we need to
|
||||
; make a SetEntries call so the screen colors donÕt change on the the first SetEntries
|
||||
; and/or SetGamma call.
|
||||
;
|
||||
ChkScrn
|
||||
Tst.b scrnInval ; If the 'scrn' resource is not invalid,
|
||||
Bne.s GotScrn ; then just go on.
|
||||
|
||||
Move.l D0,A4 ; Save the 'scrn' resource handle.
|
||||
|
||||
Move.l #gestaltDisplayMgrAttr,D0 ; We need to know if the Display Manager is around.
|
||||
_Gestalt ; Ask, and ye shall receive.
|
||||
Bne.s @NoDM ; Oops, got an error.
|
||||
Move.l A0,D0 ; Get the result into D0.
|
||||
Btst #gestaltDisplayMgrPresent,D0 ; If the Display Manager is around, then
|
||||
Bne.s NoScrn ; donÕt dispose of the 'scrn' resource so
|
||||
@NoDM ; so that the Display Manager can deal with it.
|
||||
|
||||
Clr.w -(Sp) ; Make room for resFile refNum.
|
||||
Move.l A4,-(Sp) ; Push 'scrn' resource handle for resFile.
|
||||
_HomeResFile ; Get refNum.
|
||||
|
||||
Move.l A4,-(Sp) ; Push 'scrn' resource handle for remove.
|
||||
_RmveResource ; Try to remove it.
|
||||
Tst.w ResErr ; If everything is okay, then
|
||||
Beq.s @DisposeIt ; just go on.
|
||||
|
||||
Tst.w (Sp)+ ; Clean up the stack.
|
||||
Move.l A4,D0 ; Get 'scrn' resource handle back into D0.
|
||||
Bra.s GotScrn ; And weÕre screwed.
|
||||
|
||||
@DisposeIt Movea.l A4,A0 ; Get 'scrn' resource handle into A0.
|
||||
_DisposHandle ; Dispose it.
|
||||
|
||||
_UpdateResFile ; Update the 'scrn's resFile lest we die later.
|
||||
|
||||
; If a 'scrn' resource is NOT around weÕll get here. The only thing we want to do at this
|
||||
; point is to call SetDevEntries on the boot device so that the screen will not change colors
|
||||
; after a SetEntries/SetGamma call is made later.
|
||||
;
|
||||
NoScrn
|
||||
Move.l DeviceList,A0 ; A0 contains gDevice.
|
||||
Move.l #-1,A1 ; Use gDeviceÕs PixMap for colorTable.
|
||||
Bsr.s SetDevEntries ;
|
||||
Bra NoGammaFix
|
||||
|
||||
; ¥¥¥ 3rd INIT ¥¥¥
|
||||
;
|
||||
; Lock down the 'scrn' handle, and point at the data (in A4).
|
||||
;
|
||||
GotScrn
|
||||
MOVE.L DeviceList,A0 ; get handle to device list
|
||||
MOVE.L (A0),A0 ; point to head of device list
|
||||
BSET #allInit,GDFlags(A0) ; say list has been initialized
|
||||
|
||||
MOVE.L D0,-(SP) ; save 'scrn' resource for ReleaseResource
|
||||
MOVE.L D0,A0 ; get the resource
|
||||
_HLock ; lock it down
|
||||
MOVE.L (A0),A4 ; A4 = resource pointer
|
||||
|
||||
; Validate the 'scrn' resource. There must be a descriptor for every screen device.
|
||||
; I assume that there are no duplicate entries and that screens don't overlap.
|
||||
; In addition the devices in the 'scrn' resource must be in slot order.
|
||||
;
|
||||
MOVE.L A4,StartList(A6) ; save pointer to start of list
|
||||
MOVE (A4)+,D7 ; get the number of screens in resource
|
||||
|
||||
WITH spBlock,vpBlock
|
||||
|
||||
LEA SlotParms(A6),A0 ; get pointer to parameter block
|
||||
MOVE.L #((CatDisplay << 16) ++ TypVideo),spCategory(A0)
|
||||
; set category ID, type
|
||||
MOVE.W #drSwApple,spDrvrSw(A0) ; set software, hardware ID
|
||||
MOVE.B #$01,spTBMask(A0) ; ignore spDrvrHw
|
||||
MOVE.B #0,spSlot(A0) ; start with desired slot (0 to check built-in devices)
|
||||
MOVE.B #0,spID(A0) ; start with first (zeroth) ID
|
||||
CLR.B spExtDev(A0) ;
|
||||
NxtDev _sNextTypesRsrc ; get next video device
|
||||
BEQ.S GotDev ; => there is one
|
||||
|
||||
; There are no more screens; are there any more entries in the 'scrn' resource?
|
||||
;
|
||||
TST D7 ; there should have been one per device
|
||||
BEQ GoodRsrc ; => there was, go initialize them
|
||||
BRA BadScrn ;
|
||||
|
||||
; Scan through 'scrn' resource entry for this device.
|
||||
;
|
||||
GotDev MOVE (A4)+,D0 ; get type
|
||||
CMP spDrvrHw(A0),D0 ; does it match?
|
||||
BNE BadScrn ; => nope, bad screen resource
|
||||
MOVE (A4)+,D0 ; get slot
|
||||
CMP.B spSlot(A0),D0 ; does it match?
|
||||
BNE.S BadScrn ; => nope, bad screen resource
|
||||
|
||||
; Get the DCE entry for the device and check dCtlDevBase.
|
||||
; If no match, look for other devices in the same slot.
|
||||
;
|
||||
SlotOK MOVE spRefNum(A0),D0 ; get the refNum
|
||||
NOT D0 ; refNum to unitnum
|
||||
ASL #2,D0 ; offset in unitTable
|
||||
MOVE.L UTableBase,A1 ; get the base of the unit table
|
||||
MOVE.L (A1,D0),A3 ; A3 = handle to the DCE
|
||||
MOVE.L (A3),A1 ; get pointer to the DCE
|
||||
MOVE.L dCtlDevBase(A1),D0 ; get dCtlDevBase
|
||||
CMP.L (A4)+,D0 ; do they match?
|
||||
BNE.S BadScrn ; => nope, bad screen resource
|
||||
|
||||
; Test to make sure that the requested mode (screen depth) is valid in this video
|
||||
; sRsrc list.
|
||||
;
|
||||
MOVE.B spID(A0),D1 ; save the spID (so that itÕs correct for the sNextTypesRsrc)
|
||||
MOVE.W (A4)+,D0 ; get the mode
|
||||
MOVE.B D0,spID(A0) ; insert into spBlock
|
||||
_sFindStruct ; find the sRsrc list entry for this mode
|
||||
BNE.S BadScrn ; if not, then the scrn resource is no good
|
||||
MOVE.B D1,spID(A0) ; restore the spID
|
||||
|
||||
; To be completely compulsive about it, make sure there's a gDevice.
|
||||
;
|
||||
MOVE.L DeviceList,A3 ; A3 = first gDevice in list
|
||||
MOVE spRefNum(A0),D1 ; get refnum (unaffected by sFindStruct)
|
||||
@NxtGD MOVE.L (A3),A1 ; get pointer to device
|
||||
CMP gdRefNum(A1),D1 ; does refnum match?
|
||||
BEQ.S RectCheck ; => yes, this device matches!
|
||||
MOVE.L gdNextGD(A1),D0 ; get handle of next device
|
||||
MOVE.L D0,A3 ; get in A3
|
||||
BNE.S @NxtGD ; => check all gDevices
|
||||
BRA.S BadScrn ; => no such gDevice, bad 'scrn'
|
||||
|
||||
; Compare the size of the remembered screenRect to the size of this gDevice's
|
||||
; gdRect. At this point, the gdRects are still topleft={0,0} from InitGDevice
|
||||
; so we can just check 'scrn' rect against botRight.
|
||||
;
|
||||
RectCheck
|
||||
ADD #8,A4 ; skip to global rect in 'scrn'
|
||||
MOVE.W bottom(A4),D0 ; get bottom
|
||||
SUB.W top(A4),D0 ; = height
|
||||
CMP.W gdRect+bottom(A1),D0 ; is it equal?
|
||||
BNE.S BadScrn ; nope, we're out
|
||||
MOVE.W right(A4),D0 ; get right
|
||||
SUB.W left(A4),D0 ; = width
|
||||
CMP.W gdRect+right(A1),D0 ; is it equal?
|
||||
BNE.S BadScrn ; nope, we're out
|
||||
|
||||
; This device matches! Go check the next one.
|
||||
;
|
||||
SkipData ADD #8,A4 ; skip to control field
|
||||
MOVE (A4)+,D0 ; get number of control calls
|
||||
BRA.S SkipCtl ; skip control call
|
||||
SkipNxt MOVE.L (A4)+,D1 ; get control code, size of params
|
||||
ADD D1,A4 ; add size of params to skip block
|
||||
SkipCtl DBRA D0,SkipNxt ; => skip next control
|
||||
|
||||
SUBQ #1,D7 ; decrement device count
|
||||
BMI.S BadScrn ; => oops, bad screen resource
|
||||
|
||||
LEA SlotParms(A6),A0 ; get pointer to parameter block <14>
|
||||
BRA.s NxtDev ; => check next device <19>: .s
|
||||
|
||||
; If the 'scrn' resource is bad, then let's walk down the device list and offset
|
||||
; the invalid screens' gdRects so that they don't all pile up at (0,0). Let's keep
|
||||
; it simple--just put them all edge-to-edge, with the top edge at 0 (unchanged) and
|
||||
; to the right of the previous guys'. Offset the gdPMap's rect also.
|
||||
;
|
||||
BadScrn
|
||||
MOVE.L DeviceList,A0 ; get the head of the list (the boot screen)
|
||||
MOVE.L (A0),A0 ; hndl->ptr
|
||||
MOVE.W gdRect+right(A0),D1 ; get the boot screen's right edge (if the scrn
|
||||
; is invalid, then this is the real right edge)
|
||||
@Loop MOVE.L gdNextGD(A0),D0 ; get handle to next screen
|
||||
BEQ ScrnDone ; when NIL we're out of here <19>: Done -> ScrnDone
|
||||
MOVE.L D0,A0 ; get this device
|
||||
MOVE.L (A0),A0 ; handle to ptr
|
||||
ADD.W D1,gdRect+left(A0) ; offset the left edge (normally zero)
|
||||
ADD.W D1,gdRect+right(A0) ; offset the right edge
|
||||
MOVE.L gdPMap(A0),A1 ; get the gdPMap handle
|
||||
MOVE.L (A1),A1 ; get the gdPMap pointer
|
||||
ADD.W D1,pmBounds+left(A1) ; offset the left edge (normally zero)
|
||||
ADD.W D1,pmBounds+right(A1) ; offset the right edge
|
||||
|
||||
MOVE.W gdRect+right(A0),D1 ; get the new right edge for the next device
|
||||
BRA.S @Loop ; for each screen
|
||||
|
||||
GoodRsrc _HideCursor ; cursor must be hidden here
|
||||
MOVE.B #true,CrsrBusy ; MARK CHANGE IN PROGRESS
|
||||
|
||||
; Configure each entry in the scrn resource
|
||||
;
|
||||
MOVE.L StartList(A6),A4 ; save pointer to start of list
|
||||
MOVE (A4)+,D7 ; get the number of screens in resource
|
||||
SUBQ #1,D7 ; make it 0 based
|
||||
|
||||
; It would be nice if this routine could use sRsrcInfo or sNextsRsrc here, but we
|
||||
; don't keep the video sRsrc spID in the scrn resource, just the hw ID!!! To
|
||||
; make up for this, we must do a search by type.
|
||||
;
|
||||
DoNxt LEA SlotParms(A6),A0 ; get pointer to parameter block
|
||||
MOVE.L #((CatDisplay << 16) ++ TypVideo),spCategory(A0)
|
||||
; set category ID, type
|
||||
MOVE.W #drSwApple,spDrvrSw(A0) ;
|
||||
; set software, (invalid) hardware ID
|
||||
MOVE (A4)+,spDrvrHw(A0) ; set driver hardware ID
|
||||
MOVE.B #$00,spTBMask(A0) ; all fields valid
|
||||
MOVE (A4)+,D0 ; get slot
|
||||
MOVE.B D0,spSlot(A0) ; does it match?
|
||||
MOVE.B #0,spID(A0) ; start with first ID
|
||||
CLR.B spExtDev(A0) ;
|
||||
_sNextTypesRsrc ; get next video device
|
||||
;+++ BNE BadScrn ; => this should never be taken (so letÕs comment it out) <12>
|
||||
|
||||
; We found a device that matches the given description! Find its gDevice and configure it.
|
||||
;
|
||||
MOVE spRefNum(A0),D1 ; D1 = refnum
|
||||
|
||||
MOVE.L DeviceList,A3 ; A3 = first gDevice in list
|
||||
@NxtGD MOVE.L (A3),A0 ; get pointer to device
|
||||
CMP gdRefNum(A0),D1 ; does refnum match?
|
||||
BEQ.S @GotGD ; => yes, got the gDevice
|
||||
MOVE.L gdNextGD(A0),D0 ; get handle of next device
|
||||
MOVE.L D0,A3 ; get in A3
|
||||
BNE.S @NxtGD ; => check all gDevices
|
||||
;+++ BRA BadScrn ; => this should never be taken (so letÕs comment it out) <12>
|
||||
|
||||
@GotGD MOVE.L (A4)+,D0 ; discard dCtlDevBase
|
||||
|
||||
; Set up the GDFlags word before calling InitGDevice.
|
||||
;
|
||||
MOVE.L (A3),A1 ; point at the grafDevice
|
||||
MOVE gdFlags(A1),D0 ; get the flags word
|
||||
AND 2(A4),D0 ; turn off the bits that are used
|
||||
OR 4(A4),D0 ; turn on new bits
|
||||
BSET #ramInit,D0 ; say we've initialized it
|
||||
BSET #screenDevice,D0 ; and flag it as a screen device
|
||||
MOVE D0,GDFlags(A1) ; set the flags word
|
||||
|
||||
; If main device, set up low-memory handles. (Wait: If the ramInit and screenDevice
|
||||
; flags are NOT setup, then why would the mainScreen flag be setup? -- jmp)
|
||||
;
|
||||
MOVE gdFlags(A1),D0 ; get the flags word
|
||||
BTST #mainScreen,D0 ; is it the main scrn?
|
||||
BEQ.S @InitGD ; => no, go init device
|
||||
|
||||
MOVE.L A3,MainDevice ; set up as main screen device
|
||||
MOVE.L A3,TheGDevice ; set up as default destination device
|
||||
MOVE.L A3,SrcDevice ; set up as default source device
|
||||
; AllocCursor called by InitCursor to init cursor
|
||||
MOVE.L (A3),A0 ; point to gDevice
|
||||
MOVE.L gdPMap(A0),A0 ; get pixMap handle
|
||||
MOVE.L (A0),A0 ; point to pixMap
|
||||
MOVE.L baseAddr(A0),D0 ; get base address
|
||||
MOVE.L D0,scrnBase ; and set up screen base
|
||||
|
||||
LEA SlotParms(A6),A0 ; point at slot manager block again (it's still positioned from above)
|
||||
MOVE (A4),D0 ; get the requested mode
|
||||
MOVE.B #oneBitMode,spId(A0) ; pass the default mode (assumed to be 1-bit mode)
|
||||
_sFindStruct ; point to this mode information
|
||||
|
||||
MOVE.B #mVidParams,spID(A0) ; now get the device pixmap
|
||||
_sGetBlock ; on the current heap (system normally here)
|
||||
MOVE.L spResult(A0),A1 ; get the result pointer
|
||||
MOVE.w vpRowBytes(A1),screenRow ; get the screen row bytes (WORD)
|
||||
|
||||
; Set up the low-mem for screen resolution too. TheyÕre only WORD/WORD rather then FIXED/FIXED.
|
||||
;
|
||||
MOVE.W vpHRes(A1),ScrHRes ; Take the high word of vpHRes
|
||||
MOVE.W vpVRes(A1),ScrVRes ; Take the high word of vpVRes
|
||||
|
||||
MOVE.L spResult(A0),A0 ; Do what it says in IM V (p 446) instead of
|
||||
_DisposPtr ; of using _sDispose. <12>
|
||||
|
||||
@InitGD MOVE D1,-(SP) ; push refnum
|
||||
MOVE (A4)+,-(SP) ; push mode
|
||||
CLR -(SP) ; which should be long
|
||||
MOVE.L A3,-(SP) ; push gDevice
|
||||
_InitGDevice ; configure the gDevice
|
||||
ADDQ #4,A4 ; mask and flags already used
|
||||
|
||||
; If there is a gamma table resource id, get the gamma correction table and call the driver.
|
||||
; We need to do this before setting the color table (via SetEntries) to make sure it takes
|
||||
; effect right away.
|
||||
;
|
||||
MOVE 2(A4),D0 ; get the gamma table resource id
|
||||
CMP #-1,D0 ; is it -1?
|
||||
BEQ.S ChkTbl ; => yes, no table
|
||||
|
||||
; If the gamma table resource id = -2, then request linear gamma from the driver.
|
||||
;
|
||||
CMP #-2,D0 ; is it -2?
|
||||
BNE.S @GetFromSys ; nope, so load the system resource
|
||||
|
||||
;+++ LEA VidParms(A6),A1 ; point to parameter block
|
||||
;+++ CLR.L csGTable(A1) ; pass NIL to tell new drivers to set linear
|
||||
;+++ BSR.S GammaControl ; call a common routine to set gamma
|
||||
|
||||
; <19>: Use SetDevGamma instead of GammaControl
|
||||
;
|
||||
Move.l A3,A0 ; Put gDevice in A0 for SetDevGamma call.
|
||||
Move.l #0,A1 ; (nil) gammaTable Ptr in A1 (to set linear).
|
||||
Bsr.s SetDevGamma
|
||||
;
|
||||
BRA.S ChkTbl
|
||||
|
||||
; Load the gamma resource from the system and set it.
|
||||
;
|
||||
@GetFromSys CLR.L -(SP) ; make room for function result
|
||||
MOVE.L #'gama',-(SP) ; push gamma table rsrc type
|
||||
MOVE D0,-(SP) ; else push resource id
|
||||
_GetResource ; try to read in gamma table
|
||||
MOVE.L (SP)+,D0 ; get the result
|
||||
BEQ.S ChkTbl ; => couldn't find it, use default
|
||||
MOVE.L D0,-(SP) ; save a copy for later
|
||||
MOVE.L D0,A0 ; setup for HLock
|
||||
_HLock ;
|
||||
|
||||
;+++ LEA VidParms(A6),A1 ; point to params for SetGamma
|
||||
;+++ MOVE.L (A0),csGTable(A1) ; gamma table pointer is only param
|
||||
;+++ BSR.S GammaControl ; call a common routine
|
||||
|
||||
; <19>: Use SetDevGamma instead of GammaControl. For <23>, the setup for the
|
||||
; SetDevGamma call was backwards.
|
||||
;
|
||||
Move.l (A0),A1 ; Put pointer to gammaTable in A1, and
|
||||
Move.l A3,A0 ; put pointer to GDevice in A0.
|
||||
Bsr.s SetDevGamma
|
||||
;
|
||||
MOVE.L (SP),A0 ; get the resource handle back
|
||||
_HUnlock ; free it
|
||||
_ReleaseResource ; and release it (fixing the stack)
|
||||
|
||||
; <19>: Commented out GammaControl as it is replaced by the SetDevGamma utility
|
||||
; above. Also, the branch around the GammaControl routine is commented
|
||||
; out.
|
||||
;
|
||||
;+++ BRA.S ChkTbl ; continue on
|
||||
;
|
||||
; Here's an imbedded utility. I know I burn 2 bytes always BSRing around it, but I
|
||||
; would burn two with a word branch if the utility were outside. This routine sets
|
||||
; up the iopb and csParam block for a SetGamma control call. It expects the csGTable
|
||||
; field to be set up, the csParam block pointer in A1, and the gdevice pointer in A3.
|
||||
;
|
||||
;GammaControl
|
||||
;
|
||||
; LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
; MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
; MOVE.W #cscSetGamma,csCode(A0) ; cscSetGamma <12>
|
||||
;+++ CLR.L ioCompletion(A0) ; no completion routine <16>: not necessary
|
||||
;+++ CLR.W ioVRefNum(A0) ; no volRefNum <16>: not necessary
|
||||
; MOVE.L (A3),A1 ; point to gdevice
|
||||
; MOVE GDRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
; _Control ,IMMED ; SetGamma(GammaTable)
|
||||
; ; if error here (likely if -2 were passed to
|
||||
; ; and old driver) then just use default table
|
||||
; RTS ; and back
|
||||
;
|
||||
;
|
||||
; Previously, if there was a color table resource id, this part loaded that table. Now,
|
||||
; it checks the state of the gdDevType bit. If it is monochrome (=0), then this routine
|
||||
; substitutes pixelSize+32 for the resID. If it is color (=1) and in 2- or 4-bit mode, then
|
||||
; pixelSize+64 is substituted to yield a modified color table that includes the highlight
|
||||
; color.
|
||||
;
|
||||
; If we EVER have a gamma ID <> -1 (not default), then be sure to set the color table
|
||||
; to flush this gamma into the CLUT hardware.
|
||||
;
|
||||
; The pointer to the gDevice is still in A1.
|
||||
;
|
||||
;
|
||||
ChkTbl
|
||||
MOVE.L (A3),A1 ; point to the gDevice again
|
||||
MOVE.L gdPMap(A1),A0 ; get pixmap
|
||||
MOVE.L (A0),A0 ; get pixmap ptr
|
||||
MOVE.W pmPixelSize(A0),D0 ; get depth
|
||||
|
||||
CMP #clutType,gdType(A1) ; is it a direct/fixed (SKH) device? <SM9>
|
||||
BNE SetGRect ; if so, then do nothing <19>:s <SM4> CSS
|
||||
|
||||
BTST #gdDevType,gdFlags+1(A1) ; is it color or monochrome mode?
|
||||
BNE.S @ClrMode ; if set, then this is color
|
||||
CMP.W #2,D0 ; 1 or 2 bit/pixel?
|
||||
BLE.S @RegClr ; don't do anything funky
|
||||
@MonoMode
|
||||
ADD #32,D0 ; add 32 to pixelsize in all modes for linear gray
|
||||
BRA.S @GetClut ;
|
||||
@ClrMode
|
||||
MOVE.W D0,D1 ; copy the depth
|
||||
AND #9,D1 ; is it 1- or 8-bit mode?
|
||||
BNE.S @RegClr ; if so, then do regular behavior
|
||||
@Is2or4
|
||||
ADD #64,D0 ; for 2- or 4-bit, add 64 to pixel depth (gives color+highlight)
|
||||
;!!! BRA.S @GetClut ;
|
||||
|
||||
@RegClr
|
||||
;!!! MOVE (A4),D1 ; get the color table resource id
|
||||
;!!! CMP #-1,D1 ; is it -1?
|
||||
;!!! BNE.S @GetClut ; if not, then set the CLUT
|
||||
;!!! CMP #-1,2(A4) ; if CLUTid=-1, and gammaID<>-1, then set CLUT to flush
|
||||
;!!! BEQ.S SetGRect ; if both are default, then continue
|
||||
|
||||
@GetClut CLR.L -(SP) ; make room for function result
|
||||
MOVE D0,-(SP) ; push resource id
|
||||
_GetCTable ; get a color table
|
||||
MOVE.L (SP)+,D0 ; get the result
|
||||
BEQ.S SetGRect ; => couldn't find it, use default
|
||||
|
||||
MOVE.L D0,A0 ; save source handle in A0
|
||||
MOVE.L (A3),A1 ; point at the gDevice
|
||||
MOVE.L gdPMap(A1),A1 ; get handle to its pixMap
|
||||
MOVE.L (A1),A1 ; point at the pixMap
|
||||
MOVE.L pmTable(A1),A1 ; get handle to existing color table
|
||||
MOVE.L A1,-(SP) ; push the color table for later
|
||||
MOVE.L A0,-(SP) ; push new table handle for dispose
|
||||
|
||||
_GetHandleSize ; get the source size
|
||||
MOVE.L D0,D1 ; save size in D1
|
||||
EXG A0,A1 ; get dest handle in A0
|
||||
_SetHandleSize ; set the dest handle size
|
||||
EXG A0,A1 ; swap dest back to A1, src to A0
|
||||
|
||||
MOVE.L (A0),A0 ; get source ptr
|
||||
MOVE.L (A1),A1 ; get dst ptr
|
||||
MOVE.L D1,D0 ; get size to move
|
||||
_BlockMove ; copy it
|
||||
|
||||
_DisposCTable ; and dispose new handle
|
||||
|
||||
; Now call the driver to set this color table (handle on stack)
|
||||
; <19>: Use SetDevEntries call instead of in-line code.
|
||||
;
|
||||
Move.l A3,A0 ; A0 contains gDevice.
|
||||
Move.l (Sp),A1 ; A1 contain colorTable Handle
|
||||
Bsr.s SetDevEntries ;
|
||||
|
||||
; MOVE.L (SP),A0 ; get handle to color table
|
||||
; _HLock ; lock down the color table
|
||||
; LEA VidParms(A6),A1 ; point to params for SetEntries
|
||||
; MOVE.L (A0),A0 ; get ctabPtr
|
||||
; CLR.W csStart(A1) ; start at zero, use sequence mode
|
||||
; MOVE.W ctSize(A0),csCount(A1) ; for the length of the table
|
||||
; LEA ctTable(A0),A0 ; get pointer to colorspecs
|
||||
; MOVE.L A0,csTable(A1) ; color table pointer is first param
|
||||
; LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
; MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
; MOVE.W #cscSetEntries,csCode(A0) ; cscSetEntries <12>
|
||||
;+++ CLR.L ioCompletion(A0) ; no completion routine <14>: not necessary
|
||||
;+++ CLR.W ioVRefNum(A0) ; no volRefNum <14>: not necessary
|
||||
; MOVE.L (A3),A1 ; point to gdevice
|
||||
; MOVE gdRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
; _Control ,IMMED ; do a SetEntries on color table
|
||||
;
|
||||
; MOVE.L (SP),A0 ; get handle to color table
|
||||
; _HUnLock ; unlock the color table
|
||||
|
||||
; Finally, generate an inverse table for the table (handle on stack)
|
||||
;
|
||||
MOVE.L (A3),A1 ; point at the gDevice
|
||||
MOVE.L gdITable(A1),-(SP) ; push inverse table handle
|
||||
MOVEQ #4,D0 ; make 4-4-4 inverse tables
|
||||
MOVE D0,gdResPref(A1) ; save in GDevice
|
||||
MOVE D0,-(SP) ; and push res
|
||||
_MakeITable ; and generate inverse table (color/inverse table handles still on stack)
|
||||
|
||||
; Use the specified rectangle to determine the device's global coordinates
|
||||
;
|
||||
SetGRect
|
||||
ADDA #4,A4 ; skip the CLUT and gamma resID's
|
||||
MOVE.L (A3),A0 ; point to the grafDevice
|
||||
MOVE.L gdPmap(A0),A1 ; get handle to pixMap
|
||||
MOVE.L (A1),A1 ; get pointer to pixMap
|
||||
ADDQ #bounds,A1 ; point to pixMap.bounds
|
||||
LEA gdRect(A0),A0 ; point to its rectangle
|
||||
MOVE.L (A4)+,D0 ; get topLeft for mouse offset
|
||||
MOVE.L D0,(A1)+ ; copy topLeft to pixMap.bounds
|
||||
MOVE.L D0,(A0)+ ; copy topLeft to GDRect
|
||||
MOVE.L (A4),(A1) ; copy botRight to pixMap.bounds
|
||||
MOVE.L (A4)+,(A0)+ ; copy botRight to GDRect
|
||||
|
||||
; Parse and execute the additional control commands
|
||||
;
|
||||
MOVE (A4)+,D6 ; get number of control calls
|
||||
BRA.S ChkNxtCtl ; => jump into end of dbra loop
|
||||
DoCtl LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
LEA 4(A4),A1 ; point to call parameters
|
||||
MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
MOVE.W (A4)+,csCode(A0) ; set control code
|
||||
;+++ CLR.L ioCompletion(A0) ; no completion routine <14>: not necessary
|
||||
;+++ CLR.W ioVRefNum(A0) ; no volRefNum <14>: not necessary
|
||||
MOVE.L (A3),A1 ; point to gdevice
|
||||
MOVE gdRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
_Control ,IMMED ; and issue the control call
|
||||
|
||||
MOVE (A4)+,D0 ; get size of param block
|
||||
ADD D0,A4 ; skip param block
|
||||
ChkNxtCtl DBRA D6,DoCtl ; loop for all control calls
|
||||
|
||||
ChkNxt DBRA D7,DoNxt ; loop for all screens in resource
|
||||
|
||||
MOVE.L MainDevice,a0
|
||||
move.l a0,CrsrDevice ; cursor is now on main device, no longer on boot device
|
||||
|
||||
import GetDCtlEntry
|
||||
|
||||
subq #4,sp ; room for resulting DCE handle
|
||||
move.l (a0),a0
|
||||
move.w gdRefnum(a0),-(sp) ; get the refNum
|
||||
jsr GetDCtlEntry
|
||||
move.l (sp)+,a0 ; get handle to DCE
|
||||
move.l (a0),a0 ; get pointer to DCE
|
||||
move.l #0,d0 ; clear out D0
|
||||
move.b dCtlSlot(a0),d0 ; get the slot number
|
||||
_AttachVBL ; attach VBL to this slot
|
||||
|
||||
CLR.B CrsrBusy ; end of change
|
||||
_AllocCursor ; make sure all cursor structs are updated
|
||||
_ShowCursor ; now redisplay cursor
|
||||
|
||||
ScrnDone _ReleaseResource ; all done with the resource <19>: Done -> ScrnDone
|
||||
|
||||
; ¥¥¥ 4th INIT ¥¥¥
|
||||
;
|
||||
; As explained above in the SixPack update notes, the NoGammaFix is for $067C-class
|
||||
@ -879,14 +362,7 @@ ScrnDone _ReleaseResource ; all done with the resource <19>: Done -> ScrnDone
|
||||
;
|
||||
NoGammaFix
|
||||
|
||||
Move.l ROMBase,A0 ; Point to ROMBase with A0.
|
||||
If Not ForROM Then
|
||||
Cmp.w #$067C,8(A0) ; If weÕre not running on a $67C
|
||||
Bne GoHome ; ROM, then just go on.
|
||||
Else
|
||||
Cmp.w #$077D,8(A0) ; If weÕre not running on a $77D
|
||||
Bne GoHome ; ROM, then just go on.
|
||||
Endif
|
||||
WITH spBlock,vpBlock
|
||||
|
||||
; Get the default gamma table from ROM (so we donÕt have to get it every time
|
||||
; we find a card that needs it -- if we donÕt find any cards that need
|
||||
@ -925,6 +401,16 @@ NoGammaFix
|
||||
Move.l (A0),A0 ; DCE Ptr.
|
||||
|
||||
Move.b dCtlSlot(A0),D0 ; Save slot number.
|
||||
|
||||
Cmp.b #15,D0
|
||||
Bcs.b @dont
|
||||
Move.l A3,A0
|
||||
Bsr.w CheckDevices
|
||||
nop
|
||||
Bne.s * + $4A
|
||||
Bra.s * + $62
|
||||
@dont
|
||||
|
||||
Lea SlotParms(A6),A0 ; Fill out SpBlock:
|
||||
Move.b D0,spSlot(A0) ; spSlot = slot number
|
||||
Clr.w spID(A0) ; spID = 0
|
||||
@ -969,11 +455,6 @@ NoGammaFix
|
||||
Move.l A2,A0 ; Dispose of the storage used for the
|
||||
_DisposHandle ; gammaTable Handle.
|
||||
|
||||
GoHome
|
||||
;+++ MOVEM.L (SP)+,D6-D7/A2-A4 ; restore work registers
|
||||
MOVEM.L (SP)+,A0-A6/D0-D7 ; so we donÕt screw up the boot process
|
||||
UNLK A6
|
||||
|
||||
; ¥¥¥ 5th INIT ¥¥¥
|
||||
;
|
||||
;----------------------------------------------------------------
|
||||
@ -1195,7 +676,12 @@ NxtSlotLoop
|
||||
MOVE.L (A2,D0*4),A1 ; get DCE handle
|
||||
MOVE.L (A1),A1 ; get DCE pointer
|
||||
|
||||
MOVE.L A1,A4 ; save this for driver patching code below
|
||||
MOVE.L (A1),A4
|
||||
MOVE dCtlFlags(A1),D0
|
||||
BTST.L #6,D0
|
||||
BEQ.S @dont
|
||||
MOVE.L (A4),A4
|
||||
@dont
|
||||
|
||||
;
|
||||
; Point to spBlock.
|
||||
@ -1235,13 +721,7 @@ NxtSlotLoop
|
||||
; Take the DCE pointer in A4 (from above), and test to see if we want to patch this driver.
|
||||
;
|
||||
@IntPtch
|
||||
If Not ForROM Then
|
||||
BTST #dRAMBased,dCtlFlags+1(A4) ; test if this is a driver in ROM (Erickson overpatch) <7.0>
|
||||
BEQ NxtSlot ; if so, then continue to next slot <7.0>
|
||||
Endif
|
||||
|
||||
MOVE.L dCtlDriver(A4),A1 ; get handle to driver
|
||||
MOVE.L (A1),A1 ; get pointer to driver
|
||||
MOVE.L A4,A1 ; get pointer to driver
|
||||
|
||||
MOVE.L drvrName+2(A1),D0 ; get a unique long from the name
|
||||
CMP.L #'DrWV',D0 ; is it the 2-Page card?
|
||||
@ -1342,201 +822,10 @@ Out LEA spBlockSize(SP),SP ; clean up the stack <SM6>
|
||||
;
|
||||
; Lets restore more registers than have ever been restored before. (Hey, you can never be too careful.)
|
||||
;
|
||||
MOVEM.L (SP)+,A0-A6/D0-D7 ; so we donÕt screw up the boot process
|
||||
MOVEM.L (SP)+,A5-A6
|
||||
MOVEM.L (SP)+,A0-A4/D0-D7 ; so we donÕt screw up the boot process
|
||||
|
||||
; ¥¥¥ 6th INIT ¥¥¥
|
||||
;
|
||||
if asINIT then
|
||||
;
|
||||
; Early in the boot process an _InitGraf was performed (for the Welcome to Mac box).
|
||||
; It's not correct if the main screen moved away from the boot screen, so let's call
|
||||
; InitGraf on these early globals to correct the problem. This will fix a problem
|
||||
; with the LMgr "init" which didn't do an InitGraf while setting up the environment
|
||||
; for an alert dialog.
|
||||
;
|
||||
; Note that for the new boot process this is no longer necessary.
|
||||
;
|
||||
|
||||
PEA -4(A5)
|
||||
_InitGraf
|
||||
|
||||
endif
|
||||
|
||||
; ¥¥¥ 7th INIT ¥¥¥
|
||||
;
|
||||
If Not ForROM Then
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
; Local variables, definitions, etc....
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
drHwDAFB Equ $001C ; Built-in Video Hardware ID for Macintosh Quadras 700/900/950.
|
||||
DrvrVer950 Equ $0001 ; Version number of the Macintosh Quadra 950Õs video driver.
|
||||
|
||||
badEntry Equ $38 ; Location of bad table entry in the Macintosh Quadra 950 driver.
|
||||
|
||||
; Straight from the Macintosh Quadra 950 ROMÕs source codeÉ
|
||||
;
|
||||
DAFBVidPrivates RECORD 0
|
||||
saveBaseAddr DS.L 1 ; the screen base address (NOT ST corrected!)
|
||||
saveScreenBase DS.L 1 ; ST corrected version of saveBaseAddr.
|
||||
saveSQElPtr DS.L 1 ; the SQ element pointer (for _SIntRemove)
|
||||
saveGammaPtr DS.L 1 ; the pointer to the Gamma correction table
|
||||
saveGamDispPtr DS.L 1 ; the pointer to the Gamma block
|
||||
saveVDACBase DS.L 1 ; the base addr of the VDAC
|
||||
saveDAFBBase DS.L 1 ; the base addr of the DAFB
|
||||
saveVidPtr DS.L 1 ; pointer to a big block of DAFB video parameters
|
||||
GFlags DS.W 1 ; flags word
|
||||
has16bppACDC Ds.b 1 ; true if AC842A is around
|
||||
pageModeSet Ds.b 1 ; true if the pRam PageMode enable bit is set
|
||||
saveMode DS.W 1 ; the current mode setting (in lo-byte)
|
||||
saveMonID DS.W 1 ; monitor type ID (in lo-byte)
|
||||
saveSlotId DS.W 1 ; spID of video sRsrc (hi-order byte only!)
|
||||
DAFBVidPrivSize EQU *
|
||||
ENDR
|
||||
|
||||
; Flags within GFlags wordÉ
|
||||
;
|
||||
GrayFlag EQU 15 ; luminance mapped if GFlags(GrayFlag) = 1
|
||||
IntDisFlag EQU 14 ; interrupts disabled if GFlags(IntFlag) =1
|
||||
IsMono EQU 13 ; true if monochrome only display (Portrait/Kong)
|
||||
UseSeq EQU 12 ; true if sequence mode SetEntries
|
||||
UseTrans Equ 12 ; True if weÕre supposed to translate 5-bit into 8 (DAFB 16bpp).
|
||||
Is16 EQU 11 ; true if 16Mhz (Slow) CPU
|
||||
IsSlow Equ 11 ; True if Slow CPU (for DAFB, 25Mhz is slow).
|
||||
IsDirect EQU 10 ; true if direct video mode, else chunkyIndexed
|
||||
PsuedoIndex EQU 9 ; true if SetEntries request was mapped to indexed from sequential
|
||||
; (due to screen depth hardware requirements)
|
||||
Has16bppSRsrc Equ 9 ; True if FifthVidMode is 16bpp instead of 32bpp (DAFB).
|
||||
SyncOnGreen Equ 8 ; True if weÕre supposed to put sync on green (DAFB).
|
||||
|
||||
|
||||
bra.s PatchQuadra950Driver ; skip over the title
|
||||
|
||||
String Pascal
|
||||
|
||||
DAFBVideoTitle Dc.b '.Display_Video_Apple_DAFB'
|
||||
Align 2
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
; Main
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
PatchQuadra950Driver
|
||||
String AsIs
|
||||
With SpBlock,DAFBVidPrivates
|
||||
|
||||
Quadra950SaveRegs Reg D4-D6 ; Define work registers.
|
||||
|
||||
If AsInit Then
|
||||
Cmp.w #$3FFF,ROM85 ; If Color QuickDraw is not around,
|
||||
Bne @ExitNow ; then just leave.
|
||||
EndIf
|
||||
|
||||
Tst.l DeviceList ; If the device list is empty,
|
||||
Beq @ExitNow ; then just leave.
|
||||
|
||||
Move.l DeviceList,A0 ; Get the DeviceList Handle.
|
||||
Move.l (A0),A0 ; Make it a pointer.
|
||||
Move.w gdRefNum(A0),D0 ; If thereÕs no driver, then
|
||||
Beq @ExitNow ; we canÕt do anything here.
|
||||
|
||||
Movem.l Quadra950SaveRegs,-(Sp) ; Save work registers.
|
||||
Suba.w #spBlockSize,Sp ; Allocate SpBlock
|
||||
|
||||
; The shipping version of the Macintosh Quadra 950Õs ROM (1.7F2) has a bug in the built-in video
|
||||
; driver which prevents the DirectSetEntries call from working correctly when the attached display
|
||||
; is put into 32 bit-per-pixel mode. To fix this problem, we just patch the bad table in place
|
||||
; since it resides in the System heap.
|
||||
;
|
||||
Move.l Sp,A0 ; Get spBlock ptr into A0.
|
||||
Clr.b spId(A0) ; Begin at id 0.
|
||||
Clr.b spSlot(A0) ; We only care about Slot $0.
|
||||
Clr.b spExtDev(A0) ; No external device.
|
||||
Clr.b spTBMask(A0) ; No mask in search.
|
||||
Move.w #catDisplay,spCategory(A0) ; Look for: Display,
|
||||
Move.w #typVideo,spCType(A0) ; Video,
|
||||
Move.w #drSwApple,spDrvrSW(A0) ; Apple,
|
||||
Move.w #drHwDAFB,spDrvrHW(A0) ; DAFB.
|
||||
Clr.l spParamData(A0) ; Look only for enabled sRsrcs.
|
||||
Bset #foneslot,spParamData+3(A0) ; Limit search to this slot only.
|
||||
_GetTypeSRsrc ; If built-in video is not enabled, then
|
||||
Bne.s @AllDone ; just quit.
|
||||
|
||||
; We found the DAFB-based (Macintosh Quadra 700/900/950) built-in video in Slot $0.
|
||||
;
|
||||
Moveq #0,D5 ; Prepare D5.
|
||||
Move.w spRefNum(A0),D5 ; Get the refNum.
|
||||
Beq.s @AllDone ; If nil, then just leave (no driver).
|
||||
Not.w D5 ; Convert the refNum intoÉ
|
||||
Lsl.w #2,D5 ; Éa UTable index.
|
||||
|
||||
Add.l UTableBase,D5 ; Get a ptr to the AuxDCEHandle.
|
||||
Move.l D5,A0 ; Get it into A0.
|
||||
|
||||
Move.l (A0),A0 ; Get the AuxDCEHandle.
|
||||
Move.l (A0),A0 ; Get the AuxDCEPtr.
|
||||
Move.l A0,D5 ; Save it for later.
|
||||
|
||||
move.w dCtlFlags(a0),d0 ; <27> Get driver flags
|
||||
Move.l dCtlDriver(A0),A0 ; Get driver.
|
||||
btst #dRAMBased,d0 ; <27> Check to see if dCtlDriver is a handle or a pointer
|
||||
bz.s @gotDriverPointer ; <27> A ROM based driver means itÕs a pointer
|
||||
Move.l (A0),A0 ; Get ptr to driver.
|
||||
@gotDriverPointer
|
||||
Move.l A0,D6 ; Save it for later.
|
||||
|
||||
Moveq #0,D0 ; Prepare D0.
|
||||
Lea drvrName(A0),A0 ; Point to the driver name.
|
||||
Move.l A0,D4 ; Save it for later.
|
||||
Move.b (A0)+,D0 ; Get its length.
|
||||
Swap D0 ; Save it.
|
||||
Lea DAFBVideoTitle,A1 ; Point to the driver name we want.
|
||||
Move.b (A1)+,D0 ; Get its length.
|
||||
_CmpString ; Compare the names.
|
||||
Tst.w D0 ; If they are not equal, then we donÕt know about
|
||||
Bne.s @AllDone ; this DAFB driver, so just leave.
|
||||
|
||||
Moveq #0,D0 ; Re-prepare D0.
|
||||
Move.l D4,A0 ; Re-point to the driver name.
|
||||
Move.b (A0),D0 ; Get its length.
|
||||
Addq #2,D0 ; Adjust offset to version field.
|
||||
Bclr #0,D0 ; Adjust offset for word alignment.
|
||||
Move.w (A0,D0),D4 ; Get the driverÕs version number.
|
||||
Cmp.w #DrvrVer950,D4 ; If this isnÕt the Quadra 950Õs driver version,
|
||||
Bne.s @AllDone ; then just leave.
|
||||
|
||||
Adda.w D0,A0 ; Point to version part of driver name.
|
||||
Move.l A0,D4 ; Save it for later.
|
||||
|
||||
; We found the Macintosh Quadra 950Õs version of the DAFB driver.
|
||||
;
|
||||
Move.l D5,A0 ; Re-point to the AuxDCEPtr.
|
||||
Move.l dCtlStorage(A0),A0 ; Get the Handle to DAFB private storage.
|
||||
Move.l (A0),A0 ; Make it a pointer.
|
||||
|
||||
Btst #Has16bppSRsrc,GFlags(A0) ; If a 16bpp-capable sRsrc is not in use,
|
||||
Beq.s @AllDone ; then just leave.
|
||||
|
||||
Move.l D6,A0 ; Re-point to the DAFB driver.
|
||||
Move.b #$FF,badEntry(A0) ; Fix the bad table entry.
|
||||
|
||||
Move.l D4,A0 ; Re-point to the DAFB driver version number.
|
||||
Move.w #DrvrVer950+1,(A0) ; Update it.
|
||||
|
||||
@AllDone
|
||||
Add.w #spBlockSize,Sp ; Deallocate SpBlock.
|
||||
Movem.l (Sp)+,Quadra950SaveRegs ; Restore work registers.
|
||||
|
||||
@ExitNow ; Outta here, dudes.
|
||||
Rts
|
||||
|
||||
Endwith
|
||||
|
||||
Else
|
||||
|
||||
Rts
|
||||
|
||||
Endif
|
||||
UNLK A6
|
||||
RTS
|
||||
|
||||
END
|
||||
|
@ -28,8 +28,8 @@ CQDObjs = "{ObjDir}CheckDevicesINIT.a.o"
|
||||
Rez {StdROpts} -o "{Targ}" "{ColorQDDir}CQD.r" -i "{QDPatchesDir}"
|
||||
|
||||
|
||||
# "{LibDir}CQD.lib" Ä {CQDObjs}
|
||||
# Lib {StdLibOpts} -o "{Targ}" {CQDObjs}
|
||||
"{LibDir}CQD.lib" Ä {CQDObjs}
|
||||
Lib {StdLibOpts} -o "{Targ}" {CQDObjs}
|
||||
|
||||
|
||||
"{ObjDir}CheckDevicesINIT.a.o" Ä "{ColorQDDir}CheckDevicesINIT.a"
|
||||
|
@ -2861,6 +2861,7 @@ renderIt
|
||||
@singleByteFont
|
||||
endif
|
||||
|
||||
; 72624
|
||||
MOVE.L WidthTabHandle, -(SP) ;2) Push the Width Table Handle onto the stack
|
||||
PEA fontID(A6) ;1) Push the Glyph Rec Ptr
|
||||
TST.B FASTFLAG(A6) ;if slow no need for 32-bit stuff
|
||||
@ -2868,7 +2869,6 @@ renderIt
|
||||
TST.B needs32bit(A6) ;running 32 bit clean
|
||||
BEQ.S @skip32 ;NOPE, so skip it
|
||||
move.b MMUsave(a6),d0 ;get previous MMU state in d0
|
||||
_rSwapMMUMode ;get previous mode in d0.b (can trash a0/a1/a2, d0/d1/d2)
|
||||
_sbRetrieveGlyph ;Call the routine via SplineDispatch
|
||||
moveq #true32b,d0 ;switch to 32 bit addressing
|
||||
_rSwapMMUMode ;get previous mode in d0.b (can trash a0/a1/a2, d0/d1/d2)
|
||||
|
@ -201,8 +201,6 @@ MODE EQU REFNUM-4 ; LONG, Mode for video card
|
||||
CMP.L #-1,D0 ; if mode = -1, then don't init <C769>
|
||||
beq.s Done ; => go home <C769>
|
||||
|
||||
CMP.W #OneBitMode,D0 ; is it one bit per pixel?
|
||||
BEQ.S @Mono ; => yes, default to black and white
|
||||
Bsr TestForGray ; is it monochrome only?
|
||||
Bne.s @Mono ; => yes, leave GDevice mono
|
||||
BSET #GDDevType,GDFlags+1(A3) ; else default to color
|
||||
@ -210,7 +208,7 @@ MODE EQU REFNUM-4 ; LONG, Mode for video card
|
||||
@Mono MOVE.W REFNUM(A6),-(SP) ; pass device to initialize
|
||||
MOVE.L MODE(A6),-(SP) ; pass mode to initialize
|
||||
MOVE.L A2,-(SP) ; and pass gDevice handle
|
||||
_InitGDevice ; initialize the device port
|
||||
JSR ([$16B8]) ; initialize the device port
|
||||
|
||||
DONE MOVE.L (SP)+,theZone ; restore the zone
|
||||
MOVE.L A2,RESULT(A6) ; return graf device handle
|
||||
@ -372,6 +370,13 @@ VARSIZE DS.B 0 ; size of locals
|
||||
LINK A6,#VARSIZE ; allocate stack frame
|
||||
MOVEM.L D3/A2-A4,-(SP) ; save off work registers
|
||||
|
||||
MOVE.L ExpandMem,A0
|
||||
MOVE.L $1FC(A0),A1
|
||||
TST.B $B5(A1)
|
||||
BNE.S @true
|
||||
CLR $276(A0)
|
||||
@true
|
||||
|
||||
MOVE.L GDH(A6),A0 ; get the gDevice handle
|
||||
_HGetState ; get the current lock state
|
||||
MOVE D0,GDHState(A6) ; save the state
|
||||
@ -390,16 +395,13 @@ VARSIZE DS.B 0 ; size of locals
|
||||
BNE.S @noShield ; no, don't shield cursor
|
||||
BTST #screenDevice,gdFlags(A2) ; is it screen (check hi byte with #>8)
|
||||
BEQ.S @noShield
|
||||
;+++ PEA gdRect(A2)
|
||||
;+++ CLR.L -(SP) ; in global cošrds
|
||||
;+++ _ShieldCursor
|
||||
_HideCursor ; changed to Hide from Shield to fix
|
||||
; problems when cursor is on the move
|
||||
; during InitGDevice
|
||||
JSR ([$F48])
|
||||
|
||||
@noShield
|
||||
|
||||
; initialize the GDevice's mode and refnum
|
||||
|
||||
SF.B -$6E(A6)
|
||||
MOVE REFNUM(A6),GDRefNum(A2) ; set up RefNum
|
||||
MOVE.L MODE(A6),D0 ; get the mode
|
||||
CMP.L MinusOne,D0 ; is the mode -1?
|
||||
@ -415,7 +417,8 @@ VARSIZE DS.B 0 ; size of locals
|
||||
MOVE.L A1,csParam(A0) ; point to param list
|
||||
|
||||
CMP.L GDMode(A2),D0 ; has the mode changed?
|
||||
BEQ GrayOrColor ; => no, so don't set depth
|
||||
BEQ.S GrayOrColor ; => no, so don't set depth
|
||||
ST.B -$6E(A6)
|
||||
MOVE.L D0,GDMode(A2) ; set up mode
|
||||
|
||||
; setup the gDevice fields for the new screen depth
|
||||
@ -491,97 +494,29 @@ NoTbl
|
||||
MOVEQ #4,D0 ; make 4-4-4 inverse tables
|
||||
MOVE D0,GDResPref(A2) ; save in GDevice
|
||||
MOVE D0,-(SP) ; and push res
|
||||
_MakeITable ; and generate table
|
||||
JSR ([$16E4]) ; and generate table
|
||||
|
||||
; If this device has not been initialized from the system file, then copy the
|
||||
; bounds from the pixMap to the GDRect. Otherwise copy the GDRect to the Bounds.
|
||||
|
||||
ModeOK
|
||||
LEA BOUNDS(A3),A0 ; point to pixmap.bounds <C837>
|
||||
LEA GDRECT(A2),A1 ; point to device's global rect
|
||||
MOVE GDFlags(A2),D0 ; get the flags word
|
||||
BTST #RAMInit,D0 ; initialized from RAM?
|
||||
BEQ.S BndsOK ; => no, copy pixMap.bounds to GDRect
|
||||
EXG A0,A1 ; else copy GDRect to pixMap.bounds
|
||||
BndsOK MOVE.L (A0)+,(A1)+ ; copy topLeft
|
||||
MOVE.L (A0)+,(A1)+ ; copy botRight
|
||||
|
||||
; <dvb 3Jan89>
|
||||
; if we're about the main device, then fix all those
|
||||
; potentially errant ports.
|
||||
;
|
||||
TST.B QDExist ; (Unless QuickDraw don't exist)
|
||||
BNE @noQD
|
||||
MOVE.L portList,D1 ; or if portlist = 0 or -1
|
||||
BEQ @noQD
|
||||
ADDQ.L #1,D1
|
||||
BEQ @noQD
|
||||
|
||||
BTST #mainScreen,D0 ; is it the main scrn? (flags already in D0)
|
||||
BEQ @notMain
|
||||
|
||||
PEA oldPort(A6) ; Save the current port
|
||||
_GetPort
|
||||
MOVE.L mainDevice,theGDevice ; and set to the screen
|
||||
|
||||
MOVE.L PortList,A4 ; A4 = handle to list of ALL ports
|
||||
MOVE.L (A4),A4 ; A4->list of all ports
|
||||
MOVE (A4),D3 ; D3 = number of ports that exist
|
||||
BRA.S @portWalkEnd
|
||||
|
||||
@portWalkLoop
|
||||
MOVE.L PortList,A4
|
||||
MOVE.L (A4),A4
|
||||
MOVE.L 2(A4,D3.W*4),A4 ; A4 = this port
|
||||
MOVE.L A4,-(SP) ; Set to each port in the port list
|
||||
_SetPort
|
||||
ds.b $70664 - $702F8
|
||||
|
||||
MOVE.L oldBaseAddr(A6),D1 ; D1 = the scrnbase of ports to change
|
||||
BTST #7,portVersion(A4) ; high bit set?
|
||||
BEQ.S @oldPort
|
||||
MOVE.L portPixMap(A4),A4 ; A4 = handle to the port's pixmap
|
||||
MOVE.L (A4),A4 ; A4->port's pixmap
|
||||
CMP.L baseAddr(A4),D1 ; same as the screen's?
|
||||
BNE.S @portWalkEnd ; no, skip this port
|
||||
|
||||
MOVE.L baseAddr(A3),baseAddr(A4) ; replace a bunch of fields
|
||||
MOVE rowBytes(A3),rowBytes(A4)
|
||||
MOVE.L pixelType(A3),pixelType(A4) ; (gets pixelSize, too)
|
||||
MOVE.L cmpCount(A3),cmpCount(A4) ; (gets cmpSize, too)
|
||||
MOVE.L planeBytes(A3),planeBytes(A4)
|
||||
;702F8: problematic!
|
||||
|
||||
PEA oldColor(A6) ; placeholder for reinstantiating colors
|
||||
MOVE.L (SP),-(SP)
|
||||
MOVE.L (SP),-(SP)
|
||||
MOVE.L (SP),-(SP)
|
||||
_SaveFore ; Save and restore the foreground color
|
||||
_RestoreFore ; (Allowing for pmFore)
|
||||
_SaveBack ; And the same for the background
|
||||
_RestoreBack
|
||||
BRA.S @portWalkEnd
|
||||
|
||||
@oldPort
|
||||
CMP.L portBits+baseAddr(A4),D1 ; same base on old port?
|
||||
BNE.S @portWalkEnd
|
||||
MOVE.L baseAddr(A3),portBits+baseAddr(A4)
|
||||
MOVE rowBytes(A3),D1
|
||||
AND #nurbMask,D1 ; handle NURBs here
|
||||
MOVE D1,portBits+rowBytes(A4)
|
||||
|
||||
@portWalkEnd
|
||||
DBRA D3,@portWalkLoop
|
||||
MOVE.L oldPort(A6),-(SP) ; restore the pre-existing port
|
||||
_SetPort
|
||||
|
||||
MOVE.L oldBaseAddr(A6),D1
|
||||
CMP.L scrnBase,D1 ; fix scrnBase too, if neede
|
||||
BNE.S @notMain
|
||||
MOVE.L baseAddr(A3),scrnBase
|
||||
|
||||
@notMain
|
||||
_AllocCursor
|
||||
_ShowCursor
|
||||
@noQD
|
||||
|
||||
|
||||
;this part is all good: (70664)
|
||||
|
||||
|
||||
|
||||
;
|
||||
; notify the Palette Manager that the mode has changed
|
||||
@ -605,6 +540,22 @@ BndsOK MOVE.L (A0)+,(A1)+ ; copy topLeft
|
||||
UNLINK result-return-4,'INITGDEV'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; new func 7069A:7072C in here
|
||||
|
||||
|
||||
|
||||
|
||||
ds.b $70730 - $7069A
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GetDevPixMap PROC EXPORT
|
||||
IMPORT CopyHandle, GetCTSeed, RSetHSize
|
||||
;----------------------------------------------------------------
|
||||
@ -636,6 +587,7 @@ VARSIZE EQU PMHState ; size of locals
|
||||
|
||||
; lock down the pixMap and get pointer in A2
|
||||
|
||||
CLR.B -$D3(A6)
|
||||
MOVE.L PMH(A6),A0 ; get handle to pixMap
|
||||
_HGetState ; get the current state
|
||||
MOVE D0,PMHState(A6) ; save current state
|
||||
@ -651,6 +603,11 @@ VARSIZE EQU PMHState ; size of locals
|
||||
MOVE.L (A1,D0),A3 ; A3 = handle to the DCE
|
||||
MOVE.L (A3),A1 ; get pointer to the DCE
|
||||
|
||||
|
||||
ds.b $707F6-$7075C
|
||||
|
||||
|
||||
|
||||
; get the resource list for the specified device
|
||||
|
||||
LEA MYBLOCK(A6),A0 ; point to parameter block
|
||||
@ -731,11 +688,13 @@ VARSIZE EQU PMHState ; size of locals
|
||||
|
||||
MOVE.L vpPlaneBytes(A1),(A2)+ ; offset from one plane to another <C742>
|
||||
|
||||
|
||||
; dispose of the sBlock <C742>
|
||||
TST.B -$D3(A6)
|
||||
BNE.S @dont
|
||||
MOVE.L A1,spsPointer(A0) ; <C742>
|
||||
_sDisposePtr ; <C742>
|
||||
_SDisposePtr ; <C742>
|
||||
MOVE.L A4,spsPointer(A0) ; restore pointer to list <C742>
|
||||
@dont
|
||||
|
||||
; use DevType to initialize the color table
|
||||
|
||||
@ -748,14 +707,14 @@ VARSIZE EQU PMHState ; size of locals
|
||||
|
||||
GetClut CLR.L -(SP) ; make room for function result
|
||||
MOVE D5,-(SP) ; push resource ID
|
||||
_GetCTable ; load in the color table resource
|
||||
JSR ([$1660]) ; load in the color table resource
|
||||
MOVE.L (SP)+,D0 ; did we get one? <C769>
|
||||
BEQ TableOK ; => no, just punt <BAL 04Sep88>
|
||||
MOVE.L D0,-(SP) ; push new handle for dispose <C1/9>
|
||||
MOVE.L D0,-(SP) ; push source handle <C1/9>
|
||||
MOVE.L (A2),-(SP) ; push destination handle <C1/9>
|
||||
_CopyHandle ; copy table into our handle <C1/9>
|
||||
_DisposCTable ; and dispose of new color table <C1/9>
|
||||
JSR ([$1A14]) ; copy table into our handle
|
||||
JSR ([$1690]) ; and dispose of new color table
|
||||
BRA.S TableOK ; => and continue
|
||||
|
||||
;
|
||||
@ -788,10 +747,11 @@ GetFromSlot MOVE.B #mTable,spID(A0) ; the fixed table <2.3>
|
||||
CMPI.L #minSeed,D0 ; is it a resource ID? <H2>
|
||||
BLE.S @UseOriginalSeed ; -> yes, assume we know what we're doing <H2>
|
||||
@GetNewSeed SUBQ #4,SP ; make room for function result <2.3>
|
||||
_rGetCTSeed ; get a new, unique ctable seed <2.3>
|
||||
JSR ([$16A0]) ; get a new, unique ctable seed
|
||||
MOVE.L (SP)+,ctSeed(A1) ; put in the new seed <2.3>
|
||||
@UseOriginalSeed
|
||||
; transindex/ctflags set below <2.3>
|
||||
|
||||
;¥¥¥ <SM3> CSS end rollin GetDevPixMapPatch from Horror
|
||||
|
||||
MOVE.L A4,spsPointer(A0) ; Restore the pointer to mode list. <C742>
|
||||
@ -868,472 +828,7 @@ CheckDevices PROC EXPORT
|
||||
; CheckDevices is called by InitGraf.
|
||||
|
||||
|
||||
PARAMSIZE EQU 0
|
||||
|
||||
IOPBlk EQU -IOVQElSize ; [64] parameter blk for I/O calls
|
||||
SlotParms EQU IOPBlk-spBlock.SPBlockSize ; parameter block for slot manager calls <Cxxx>
|
||||
VidParms EQU SlotParms-12 ; [12] size of mode params
|
||||
StartList EQU VidParms-4 ; [long] pointer to start of resource
|
||||
VARSIZE EQU StartList ; size of locals
|
||||
|
||||
|
||||
LINK A6,#VARSIZE ; allocate local stack frame
|
||||
MOVEM.L D6-D7/A2-A4,-(SP) ; save work registers
|
||||
|
||||
; check to see if the device list needs to be initialized
|
||||
|
||||
MOVE.L DeviceList,A0 ; get handle to device list
|
||||
MOVE.L (A0),A0 ; point to head of device list
|
||||
MOVE GDFlags(A0),D0 ; get the flags word
|
||||
BTST #AllInit,D0 ; test initialize flag?
|
||||
BNE GoHome ; => devices already initialized
|
||||
|
||||
; test the scrnInval lo-mem to make sure the screen resource is valid.
|
||||
|
||||
TST.B scrnInval ; if this byte is cleared, then invalid
|
||||
BEQ GoHome ;
|
||||
|
||||
; try to load in the resource. If none, then exit
|
||||
|
||||
CLR.L -(SP) ; make room for function result
|
||||
MOVE.L #'scrn',-(SP) ; push desired resource type
|
||||
CLR -(SP) ; resource ID = 0
|
||||
_GetResource ; get the resource
|
||||
MOVE.L (SP)+,D0 ; get the resource handle
|
||||
BEQ GoHome ; => none, don't configure
|
||||
|
||||
; lock down the handle, and point at the data
|
||||
|
||||
MOVE.L DeviceList,A0 ; get handle to device list
|
||||
MOVE.L (A0),A0 ; point to head of device list
|
||||
BSET #AllInit,GDFlags(A0) ; say list has been initialized
|
||||
|
||||
MOVE.L D0,-(SP) ; save resource for ReleaseResource
|
||||
MOVE.L D0,A0 ; get the resource
|
||||
_HLock ; lock it down
|
||||
MOVE.L (A0),A4 ; A4 = resource pointer
|
||||
|
||||
; validate the 'scrn' resource. There must be a descriptor for every screen device.
|
||||
; I assume that there are no duplicate entries and that screens don't overlap.
|
||||
; In addition the devices in the 'scrn' resource must be in slot order.
|
||||
|
||||
MOVE.L A4,StartList(A6) ; save pointer to start of list
|
||||
MOVE (A4)+,D7 ; get the number of screens in resource
|
||||
|
||||
WITH spBlock,vpBlock
|
||||
|
||||
LEA SlotParms(A6),A0 ; get pointer to parameter block
|
||||
MOVE.L #((CatDisplay << 16) ++ TypVideo),spCategory(A0) ;<C741>
|
||||
; set category ID, type <C741>
|
||||
MOVE.W #DrSwApple,spDrvrSw(A0) ; set software, hardware ID <C741>
|
||||
MOVE.B #$01,spTBMask(A0) ; ignore spDrvrH
|
||||
MOVE.B #0,spSlot(A0) ; start with desired slot
|
||||
MOVE.B #0,spID(A0) ; start with first ID
|
||||
CLR.B spExtDev(A0) ;<C720>
|
||||
NxtDev LEA SlotParms(A6),A0 ; get pointer to parameter block
|
||||
_sNextTypesRsrc ; get next video device
|
||||
BEQ.S GotDev ; => there is one
|
||||
|
||||
; there are no more screens, are there more resources?
|
||||
|
||||
TST D7 ; there should have been one per device
|
||||
BEQ GoodRsrc ; => there was, go initialize them
|
||||
BRA.S BadScrn ;
|
||||
|
||||
; scan through scrn resource for this device
|
||||
|
||||
GotDev MOVE (A4)+,D0 ; get type
|
||||
CMP spDrvrHw(A0),D0 ; does it match?
|
||||
BNE.S badScrn ; => nope, bad screen resource
|
||||
MOVE (A4)+,D0 ; get slot
|
||||
CMP.B spSlot(A0),D0 ; does it match?
|
||||
BNE.S badScrn ; => nope, bad screen resource
|
||||
|
||||
; get the DCE entry for the device and check dCtlDevBase
|
||||
; if no match look for more devices in same slot
|
||||
|
||||
SlotOK MOVE spRefNum(A0),D0 ; get the refNum
|
||||
NOT D0 ; refNum -> unitnum
|
||||
ASL #2,D0 ; get offset in unitTable
|
||||
MOVE.L UTableBase,A1 ; get the base of the unit table
|
||||
MOVE.L (A1,D0),A3 ; A3 = handle to the DCE
|
||||
MOVE.L (A3),A1 ; get pointer to the DCE
|
||||
MOVE.L dCtlDevBase(A1),D0 ; get dCtlDevBase
|
||||
CMP.L (A4)+,D0 ; do they match?
|
||||
BNE.S badScrn ; => nope, bad screen resource
|
||||
|
||||
; to be completely compulsive about it, make sure there's a grafDevice for it
|
||||
|
||||
MOVE.L DeviceList,A3 ; A3 = first grafdevice in list
|
||||
MOVE spRefNum(A0),D1 ; get refnum
|
||||
@NxtGD MOVE.L (A3),A1 ; get pointer to device
|
||||
CMP GDRefNum(A1),D1 ; does refnum match?
|
||||
BEQ.S RectCheck ; => yes, this device matches!
|
||||
MOVE.L GDNextGD(A1),D0 ; get handle of next device
|
||||
MOVE.L D0,A3 ; get in A3
|
||||
BNE.S @NxtGD ; => check all grafDevices
|
||||
BRA.S badScrn ; => no such grafDevice, bad 'scrn'
|
||||
|
||||
;
|
||||
; compare the size of the remembered screen rect to the size of this gDevice's
|
||||
; gdRect. At this point, the GDRects are still topleft=(0,0) from InitGDevice
|
||||
; so we can just check 'scrn' rect against botRight.
|
||||
|
||||
RectCheck
|
||||
ADD #10,A4 ; skip to global rect in scrn
|
||||
MOVE.W bottom(A4),D0 ; get bottom
|
||||
SUB.W top(A4),D0 ; = height
|
||||
CMP.W GDRect+bottom(A1),D0 ; is it equal?
|
||||
BNE.S badScrn ; nope, we're out
|
||||
MOVE.W right(A4),D0 ; get right
|
||||
SUB.W left(A4),D0 ; = width
|
||||
CMP.W GDRect+right(A1),D0 ; is it equal?
|
||||
BNE.S badScrn ; nope, we're out
|
||||
|
||||
; this device matches! go check next one
|
||||
|
||||
SkipData ADD #8,A4 ; skip to control field
|
||||
MOVE (A4)+,D0 ; get number of control calls
|
||||
BRA.S SkipCtl ; skip control call
|
||||
SkipNxt MOVE.L (A4)+,D1 ; get control code, size of params
|
||||
ADD D1,A4 ; add size of params to skip block
|
||||
SkipCtl DBRA D0,SkipNxt ; => skip next control
|
||||
|
||||
SUBQ #1,D7 ; decrement device count
|
||||
BMI.S badScrn ; => oops, bad screen resource
|
||||
BRA NxtDev ; => check next device
|
||||
|
||||
BadScrn
|
||||
; If the screen resource is bad, then let's walk down the device list and offset
|
||||
; the invalid screens' GDRects so that they don't all pile up at (0,0). Let's keep
|
||||
; is simple- I just put them all edge to edge, top edge at 0 (unchanged) and to the
|
||||
; right of the previous guys. Offset the GDPMap's rect also.
|
||||
|
||||
MOVE.L DeviceList,A0 ; get the head of the list (the boot screen)
|
||||
MOVE.L (A0),A0 ; hndl->ptr
|
||||
MOVE.W GDRect+right(A0),D1 ; get the boot screen's right edge (if the scrn
|
||||
; is invalid, then this is the real right edge)
|
||||
@Loop MOVE.L GDNextGD(A0),D0 ; get handle to next screen
|
||||
BEQ Done ; if NIL, then we're out of here
|
||||
MOVE.L D0,A0 ; get this device
|
||||
MOVE.L (A0),A0 ; hndl->ptr
|
||||
ADD.W D1,GDRect+left(A0) ; offset the left edge (normally zero)
|
||||
ADD.W D1,GDRect+right(A0) ; offset the right edge
|
||||
MOVE.L gdPMap(A0),A1 ; get the GDPMap handle
|
||||
MOVE.L (A1),A1 ; get the gdPMap pointer
|
||||
ADD.W D1,pmBounds+left(A1) ; offset the left edge (normally zero)
|
||||
ADD.W D1,pmBounds+right(A1) ; offset the right edge
|
||||
|
||||
MOVE.W GDRect+right(A0),D1 ; get the new right edge for the next device
|
||||
BRA.S @Loop ; for each screen
|
||||
|
||||
GoodRsrc _HideCursor ; cursor must be hidden here
|
||||
MOVE.B #1,CRSRBUSY ; MARK CHANGE IN PROGRESS
|
||||
MOVE.L CRSRDEVICE,A0 ; GET HANDLE TO CURSOR DEVICE
|
||||
MOVE.L (A0),A0 ; POINT TO CURSOR DEVICE
|
||||
MOVE.L GDRECT+TOPLEFT(A0),D0 ; GET SCREEN TOPLEFT
|
||||
SUB D0,MOUSE+H ; CONVERT MOUSE TO SCREEN LOCAL
|
||||
SWAP D0 ; GET SCREEN TOP
|
||||
SUB D0,MOUSE+V ; CONVERT MOUSE TO SCREEN LOCAL
|
||||
MOVE.L MOUSE,MTEMP ; copy to mouse temp
|
||||
MOVE.L MOUSE,RAWMOUSE ; and to raw coordinates
|
||||
|
||||
; configure each entry in the scrn resource
|
||||
|
||||
MOVE.L StartList(A6),A4 ; save pointer to start of list
|
||||
MOVE (A4)+,D7 ; get the number of screens in resource
|
||||
SUBQ #1,D7 ; make it 0 based
|
||||
|
||||
DoNxt LEA SlotParms(A6),A0 ; get pointer to parameter block
|
||||
MOVE.L #((CatDisplay << 16) ++ TypVideo),spCategory(A0) ;<C741>
|
||||
; set category ID, type <C741>
|
||||
MOVE.W #DrSwApple,spDrvrSw(A0) ; <C741>
|
||||
; set software, (invalid) hardware ID <C741>
|
||||
MOVE (A4)+,spDrvrHw(A0) ; set driver hardware ID
|
||||
MOVE.B #$00,spTBMask(A0) ; all fields valid
|
||||
MOVE (A4)+,D0 ; get slot
|
||||
MOVE.B D0,spSlot(A0) ; does it match?
|
||||
MOVE.B #0,spID(A0) ; start with first ID
|
||||
CLR.B spExtDev(A0) ;<C720>
|
||||
_sNextTypesRsrc ; get next video device
|
||||
BNE BadScrn ; => this should never be taken
|
||||
|
||||
; we found a device that matches the given description! Find its GDevice and configure it
|
||||
|
||||
MOVE spRefNum(A0),D1 ; D1 = refnum
|
||||
|
||||
MOVE.L DeviceList,A3 ; A3 = first grafdevice in list
|
||||
@NxtGD MOVE.L (A3),A0 ; get pointer to device
|
||||
CMP GDRefNum(A0),D1 ; does refnum match?
|
||||
BEQ.S @GotGD ; => yes, got the grafDevice
|
||||
MOVE.L GDNextGD(A0),D0 ; get handle of next device
|
||||
MOVE.L D0,A3 ; get in A0
|
||||
BNE.S @NxtGD ; => check all grafDevices
|
||||
BRA BadScrn ; => this should never be taken
|
||||
|
||||
@GotGD MOVE.L (A4)+,D0 ; discard dCtlDevBase
|
||||
|
||||
; set up the GDFlags word before calling InitGDevice
|
||||
|
||||
@0 MOVE.L (A3),A1 ; point at the grafDevice
|
||||
MOVE GDFlags(A1),D0 ; get the flags word
|
||||
AND 2(A4),D0 ; turn off the bits that are used
|
||||
OR 4(A4),D0 ; turn on new bits
|
||||
BSET #RAMInit,D0 ; say we've initialized it
|
||||
BSET #ScreenDevice,D0 ; and flag it as a screen device
|
||||
MOVE D0,GDFlags(A1) ; set the flags word
|
||||
|
||||
; if main device, set up low-memory handles
|
||||
|
||||
ChkMain MOVE GDFlags(A1),D0 ; get the flags word
|
||||
BTST #mainScreen,D0 ; is it the main scrn? <2.2>
|
||||
BEQ.S @InitGD ; => no, go init device
|
||||
|
||||
MOVE.L A3,MainDevice ; set up as main screen device
|
||||
MOVE.L A3,TheGDevice ; set up as default destination device
|
||||
MOVE.L A3,SrcDevice ; set up as default source device
|
||||
; allocCursor called by initgraf to init cursor
|
||||
MOVE.L (A3),A0 ; point to gDevice
|
||||
MOVE.L gdPMap(A0),A0 ; get pixMap handle
|
||||
MOVE.L (A0),A0 ; point to pixMap
|
||||
MOVE.L baseAddr(A0),D0 ; get base address
|
||||
MOVE.L D0,scrnBase ; and set up screen base
|
||||
|
||||
LEA SlotParms(A6),A0 ; point at slot manager block again (it's still positioned from above)
|
||||
MOVE (A4),D0 ; get the requested mode
|
||||
;+++ MOVE.B D0,spID(A0) ; put in block <BAL 06Apr89>
|
||||
MOVE.B #128,spId(A0) ; pass the default mode (assumed to be 1-bit mode)
|
||||
_sFindStruct ; point to this mode information
|
||||
|
||||
MOVE.B #mVidParams,spID(A0) ; now get the device pixmap
|
||||
_sGetBlock ; on the system heap (I guess this is OK)
|
||||
MOVE.L spResult(A0),A1 ; get the result pointer
|
||||
MOVE.w vpRowBytes(A1),screenRow ; get the screen row bytes (WORD) <BAL 31Mar89>
|
||||
|
||||
; set up the lo-mem for screen resolution too. It's only WORD/WORD rather then FIXED/FIXED
|
||||
MOVE.W vpHRes(A1),ScrHRes ; Take the high word of vpHRes
|
||||
MOVE.W vpVRes(A1),ScrVRes ; Take the high word of vpVRes
|
||||
|
||||
MOVE.L A1,spsPointer(A0) ; now, release the sBlock
|
||||
_sDisposePtr ;
|
||||
|
||||
@InitGD
|
||||
MOVE D1,-(SP) ; push refnum
|
||||
MOVE (A4)+,-(SP) ; push mode
|
||||
CLR -(SP) ; which should be long
|
||||
MOVE.L A3,-(SP) ; push grafDevice
|
||||
_InitGDevice ; configure the grafDevice
|
||||
ADDQ #4,A4 ; mask and flags already used
|
||||
|
||||
;
|
||||
; if there is a gamma table resource id, get the gamma correction table and call the driver
|
||||
; We need to do this before the color table to make sure it takes effect right away.
|
||||
;
|
||||
|
||||
MOVE 2(A4),D0 ; get the gamma table resource id
|
||||
CMP #-1,D0 ; is it -1?
|
||||
BEQ.S ChkTbl ; => yes, no table
|
||||
|
||||
;
|
||||
; if the gamma table resource id = -2, then request linear gamma from the driver
|
||||
;
|
||||
|
||||
CMP #-2,D0 ; is it -2?
|
||||
BNE.S @GetFromSys ; nope, so load the system resource
|
||||
|
||||
LEA VidParms(A6),A1 ; point to parameter block
|
||||
CLR.L csGTable(A1) ; pass NIL to tell new drivers to set linear
|
||||
BSR.S GammaControl ; call a common routine to set gamma
|
||||
BRA.S ChkTbl ;
|
||||
|
||||
;
|
||||
; load the gamma resource from the system and set it
|
||||
;
|
||||
|
||||
@GetFromSys
|
||||
CLR.L -(SP) ; make room for function result
|
||||
MOVE.L #'gama',-(SP) ; push gamma table rsrc type
|
||||
MOVE D0,-(SP) ; else push resource id
|
||||
_GetResource ; try to read in gamma table
|
||||
MOVE.L (SP)+,D0 ; get the result
|
||||
BEQ.S ChkTbl ; => couldn't find it, use default
|
||||
MOVE.L D0,-(SP) ; save a copy for later
|
||||
MOVE.L D0,A0 ; setup for HLock
|
||||
_HLock ;
|
||||
LEA VidParms(A6),A1 ; point to params for SetGamma
|
||||
MOVE.L (A0),csGTable(A1) ; gamma table pointer is only param
|
||||
BSR.S GammaControl ; call a common routine
|
||||
MOVE.L (SP),A0 ; get the resource handle back
|
||||
_HUnlock ; free it
|
||||
_ReleaseResource ; and release it (fixing the stack)
|
||||
BRA.S ChkTbl ; continue on
|
||||
|
||||
;
|
||||
; here's an imbedded utility. I know I burn 2 bytes always BSRing around it, but I
|
||||
; would burn two with a word branch if the utility were outside. This routine sets
|
||||
; up the iopb and csParam block for a SetGamma control call. It expects the csGTable
|
||||
; field to be set up, the csParam block pointer in A1, and the gdevice pointer in A3.
|
||||
;
|
||||
|
||||
GammaControl
|
||||
LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
MOVE.W #4,csCode(A0) ; csc_SetGamma
|
||||
CLR.L ioCompletion(A0) ; no completion routine
|
||||
CLR.W ioVRefNum(A0) ; no volRefNum
|
||||
MOVE.L (A3),A1 ; point to gdevice
|
||||
MOVE GDRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
_Control ,IMMED ; SetGamma(GammaTable)
|
||||
; if error here (likely if -2 were passed to
|
||||
; and old driver) then just use default table
|
||||
RTS ; and back
|
||||
|
||||
;
|
||||
; Previously, if there was a color table resource id, this part loaded that table. Now,
|
||||
; it checks the state of the gdDevType bit. If it is monochrome (=0), then this routine
|
||||
; substitutes pixelSize+32 for the resID. If it is color (=1) and 2- or 4-bit mode, then
|
||||
; pixelSize+64 is substituted to yield a modified color table that includes the highlight
|
||||
; color.
|
||||
;
|
||||
; If we EVER have a gamma ID <> -1 (not default), then be sure to set the color table <2.3>
|
||||
; to flush this gamma into the CLUT hardware.
|
||||
;
|
||||
; The pointer to the gDevice is still in A1.
|
||||
;
|
||||
|
||||
ChkTbl
|
||||
MOVE.L (A3),A1 ; point to the gDevice again
|
||||
MOVE.L gdPMap(A1),A0 ; get pixmap
|
||||
MOVE.L (A0),A0 ; get pixmap ptr
|
||||
MOVE.W pmPixelSize(A0),D0 ; get depth
|
||||
|
||||
CMP #DirectType,gdType(A1) ; is it a direct device?
|
||||
BEQ SetGRect ; if so, then do nothing
|
||||
|
||||
BTST #gdDevType,gdFlags+1(A1) ; is it color or monochrome mode?
|
||||
BNE.S @ClrMode ; if set, then this is color
|
||||
cmp.w #2,d0 ; 1 or 2 bit/pixel? <2.1>
|
||||
ble.s @regClr ; don't do anything funky <2.1>
|
||||
@MonoMode
|
||||
ADD #32,D0 ; add 32 to pixelsize in all modes for linear gray
|
||||
BRA.S @GetClut ;
|
||||
@ClrMode
|
||||
MOVE.W D0,D1 ; copy the depth
|
||||
AND #9,D1 ; is it 1- or 8-bit mode?
|
||||
BNE.S @regClr ; if so, then do regular behavior
|
||||
@is2or4
|
||||
ADD #64,D0 ; for 2- or 4-bit, add 64 to pixel depth (gives color+highlight)
|
||||
BRA.S @GetClut ;
|
||||
|
||||
@regClr
|
||||
MOVE (A4),D1 ; get the color table resource id
|
||||
CMP #-1,D1 ; is it -1?
|
||||
BNE @GetClut ; if not, then set the CLUT <2.3>
|
||||
CMP #-1,2(A4) ; if CLUTid=-1, and gammaID<>-1, then set CLUT to flush <2.3>
|
||||
BEQ.S SetGRect ; if both are default, then continue <2.3>
|
||||
|
||||
@GetClut CLR.L -(SP) ; make room for function result
|
||||
MOVE D0,-(SP) ; else push resource id
|
||||
_GetCTable ; get a color table
|
||||
MOVE.L (SP)+,D0 ; get the result
|
||||
BEQ.S SetGRect ; => couldn't find it, use default
|
||||
|
||||
MOVE.L (A3),A0 ; point at the grafDevice
|
||||
MOVE.L GDPMap(A0),A0 ; get handle to its pixmap
|
||||
MOVE.L (A0),A0 ; point at the pixmap
|
||||
MOVE.L pmTable(A0),-(SP) ; push our color table for set entries <C1/9>
|
||||
MOVE.L D0,-(SP) ; push new table handle for dispose <C1/9>
|
||||
MOVE.L D0,-(SP) ; push source color table <C1/9>
|
||||
MOVE.L pmTable(A0),-(SP) ; push destination color table <C1/9>
|
||||
_CopyHandle ; copy new table into our handle <C1/9>
|
||||
_DisposCTable ; and dispose new handle <C1/9>
|
||||
|
||||
; now call the driver to set this color table (handle on stack)
|
||||
|
||||
MOVE.L (SP),A0 ; get handle to color table
|
||||
_HLock ; lock down the color table
|
||||
LEA VidParms(A6),A1 ; point to params for SetEntries
|
||||
MOVE.L (A0),A0 ; get ctabPtr <DAF>
|
||||
CLR.W csStart(A1) ; start at zero, use sequence mode <DAF>
|
||||
MOVE.W ctSize(A0),csCount(A1) ; for the length of the table <DAF>
|
||||
LEA ctTable(A0),A0 ; get pointer to colorspecs <DAF>
|
||||
MOVE.L A0,csTable(A1) ; color table pointer is first param <DAF>
|
||||
LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
MOVE.W #3,csCode(A0) ; csc_SetEntries
|
||||
CLR.L ioCompletion(A0) ; no completion routine
|
||||
CLR.W ioVRefNum(A0) ; no volRefNum
|
||||
MOVE.L (A3),A1 ; point to gdevice
|
||||
MOVE GDRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
_Control ,IMMED ; SetEntries(ColorTable);
|
||||
MOVE.L (SP),A0 ; get handle to color table
|
||||
_HUnLock ; unlock the color table
|
||||
|
||||
; finally, generate an inverse table for the table (handle on stack)
|
||||
|
||||
; color table handle on stack
|
||||
MOVE.L (A3),A1 ; point at the grafDevice
|
||||
MOVE.L GDITable(A1),-(SP) ; push inverse table handle
|
||||
MOVEQ #4,D0 ; make 4-4-4 inverse tables
|
||||
MOVE D0,GDResPref(A1) ; save in GDevice
|
||||
MOVE D0,-(SP) ; and push res
|
||||
_MakeITable ; and generate inverse table
|
||||
|
||||
; use the specified rectangle to determine the device's global coordinates
|
||||
|
||||
SetGRect
|
||||
ADDA #4,A4 ; skip the CLUT and gamma resID's
|
||||
MOVE.L (A3),A0 ; point to the grafDevice
|
||||
MOVE.L GDPMap(A0),A1 ; get handle to pixMap
|
||||
MOVE.L (A1),A1 ; get pointer to pixMap
|
||||
ADDQ #Bounds,A1 ; point to pixMap.bounds
|
||||
LEA GDRect(A0),A0 ; point to its rectangle
|
||||
MOVE.L (A4)+,D0 ; get topLeft for mouse offset
|
||||
MOVE.L D0,(A1)+ ; copy topLeft to pixMap.bounds
|
||||
MOVE.L D0,(A0)+ ; copy topLeft to GDRect
|
||||
MOVE.L (A4),(A1) ; copy botRight to pixMap.bounds
|
||||
MOVE.L (A4)+,(A0)+ ; copy botRight to GDRect
|
||||
|
||||
; parse and execute the additional control commands
|
||||
|
||||
MOVE (A4)+,D6 ; get number of control calls
|
||||
BRA.S ChkNxtCtl ; => jump into end of dbra loop
|
||||
DoCtl LEA IOPBlk(A6),A0 ; point to parameter block
|
||||
LEA 4(A4),A1 ; point to call parameters
|
||||
MOVE.L A1,csParam(A0) ; move addr of parms into block
|
||||
MOVE.W (A4)+,csCode(A0) ; set control code
|
||||
CLR.L ioCompletion(A0) ; no completion routine
|
||||
CLR.W ioVRefNum(A0) ; no volRefNum
|
||||
MOVE.L (A3),A1 ; point to gdevice
|
||||
MOVE GDRefNum(A1),ioRefNum(A0) ; set device's refnum
|
||||
_Control ,IMMED ; and issue the control call
|
||||
|
||||
MOVE (A4)+,D0 ; get size of param block
|
||||
ADD D0,A4 ; skip param block
|
||||
ChkNxtCtl DBRA D6,DoCtl ; loop for all control calls
|
||||
|
||||
ChkNxt DBRA D7,DoNxt ; loop for all screens in resource
|
||||
|
||||
; NOW UPDATE THE MOUSE TO THE COORDINATE SYSTEM OF ITS SCREEN AND DISPLAY IT
|
||||
|
||||
MOVE.L CRSRDEVICE,A0 ; GET HANDLE TO CURSOR DEVICE
|
||||
MOVE.L (A0),A0 ; POINT TO CURSOR DEVICE
|
||||
MOVE.L GDRECT+TOPLEFT(A0),D0 ; GET SCREEN TOPLEFT
|
||||
ADD D0,MOUSE+H ; CONVERT MOUSE TO GLOBAL
|
||||
SWAP D0 ; GET SCREEN TOP
|
||||
ADD D0,MOUSE+V ; CONVERT MOUSE TO GLOBAL
|
||||
MOVE.L MOUSE,MTEMP ; copy to mouse temp
|
||||
MOVE.L MOUSE,RAWMOUSE ; and to raw coordinates
|
||||
CLR.B CRSRBUSY ; end of change
|
||||
_AllocCursor ; make sure cache structures are OK <5+>
|
||||
_ShowCursor ; now redisplay cursor
|
||||
|
||||
DONE _ReleaseResource ; all done with the resource
|
||||
|
||||
GoHome MOVEM.L (SP)+,D6-D7/A2-A4 ; restore work registers
|
||||
UNLINK PARAMSIZE,'CHECKDEV'
|
||||
|
||||
ENDWITH
|
||||
RTS
|
||||
|
||||
;-------------------------------------------------------------
|
||||
;
|
||||
|
@ -72,7 +72,7 @@ SIZEOK _NewHandle ,CLEAR ; ask OS to do request
|
||||
; handle the memory full error by deep-shitting
|
||||
|
||||
MemFull MOVEQ #25,D0 ;Deep Shit memory full error code
|
||||
_SysError
|
||||
DC.W $A9C9 ;_SysError
|
||||
JacksonPollock
|
||||
DC.W $A9FF ;invoke debugger just in case it comes back
|
||||
|
||||
@ -315,7 +315,6 @@ CRSRLP MOVE.L (A0)+,(A4)+ ;COPY A LONG INTO GLOBALS
|
||||
|
||||
; IF SCREENS NOT INITIALIZED FROM 'scrn' RESOURCE, INIT THEM
|
||||
|
||||
bsr.l CheckDevices ; configure screens, if needed
|
||||
MOVE.L MainDevice,A0 ; get main device
|
||||
MOVE.L A0,theGDevice ; set gDevice
|
||||
MOVE.L A0,srcDevice ; and srcDevice just in case
|
||||
|
@ -163,6 +163,9 @@ ObscureCursor PROC EXPORT
|
||||
JMP (A0) ;and call it
|
||||
|
||||
|
||||
ds.b 32
|
||||
|
||||
|
||||
|
||||
|
||||
ENDPROC
|
||||
|
@ -2308,12 +2308,12 @@ VARSIZE EQU DstRgnPtr
|
||||
move.w dstPix+pixelSize(A6),d0 ; preload dst depth in case not screen
|
||||
sub.l a0,a0 ; clear maskrgn in case not screen
|
||||
move.w d2,d3 ; remember screen flag in d3
|
||||
beq.s NotScreen1
|
||||
beq NotScreen1
|
||||
|
||||
MOVE.L DEVICELIST,A2 ; GET FIRST ELEMENT IN DEVICE LIST
|
||||
MOVE.L (A2),A1 ; POINT TO DEVICE
|
||||
TST.L GDNEXTGD(A1) ; CHECK NEXT DEVICE
|
||||
beq.s NotScreen1 ; only 1 device so skip devloop
|
||||
beq NotScreen1 ; only 1 device so skip devloop
|
||||
|
||||
; Copy dst rect and convert to global coordinates
|
||||
|
||||
@ -2321,38 +2321,41 @@ VARSIZE EQU DstRgnPtr
|
||||
lea globalRect(a6),a1 ; point at our copy
|
||||
move.l (a0)+,(a1)+ ; copy topleft
|
||||
move.l (a0),(a1)+ ; copy botRight
|
||||
move.l dstPix+bounds+top(a6),d0 ; get topleft
|
||||
move.w d0,d1 ; get left
|
||||
swap d0 ; get top
|
||||
sub.w d1,-(a1) ; convert right to global
|
||||
sub.w d0,-(a1) ; convert bottom to global
|
||||
sub.w d1,-(a1) ; convert left to global
|
||||
sub.w d0,-(a1) ; convert top to global
|
||||
|
||||
lea DstRectRgn(a6),A0
|
||||
move.l a0,DstRgnPtr(a6) ; build master pointer
|
||||
move.w #10,(a0) ; set region size
|
||||
lea globalRect(a6),a1
|
||||
move.l a1,d0
|
||||
move.l a1,-(sp)
|
||||
jsr ([$FC0]) ; _LocalToGlobal?
|
||||
|
||||
NEXTGD MOVE.L (A2),A0 ; POINT TO DEVICE
|
||||
TST GDFLAGS(A0) ; IS IT ACTIVE?
|
||||
BPL.S SKIPGD ; =>NO, SKIP IT
|
||||
add #4,d0
|
||||
move.l d0,-(sp)
|
||||
jsr ([$FC0]) ; _LocalToGlobal?
|
||||
|
||||
lea.l DstRectRgn(a6),a0
|
||||
move.l a0,DstRgnPtr(a6)
|
||||
move #10,(a0)
|
||||
|
||||
NEXTGD move.l (a2),a0
|
||||
tst $14(a0)
|
||||
bpl.s SKIPGD
|
||||
|
||||
CLR.B -(SP) ; MAKE ROOM FOR BOOLEAN RESULT
|
||||
PEA globalRect(A6) ; PUSH SPECIFIED RECTANGLE
|
||||
PEA gdRect(A0) ; PUSH DEVICE'S RECTANGLE
|
||||
PEA dstRectRgn+rgnBBox(A6) ; PUSH DESTINATION RECT
|
||||
_SECTRECT ; IS THE RECT IN THE DEVICE
|
||||
JSR ([$10A8]) ; SECTRECT -- IS THE RECT IN THE DEVICE
|
||||
TST.B (SP)+ ; TEST RESULT
|
||||
BEQ.S SKIPGD ; => NO INTERSECTION
|
||||
|
||||
move.l dstPix+bounds+top(a6),d0 ; get topleft
|
||||
move.w d0,d1 ; get left
|
||||
swap d0 ; get top
|
||||
lea dstRectRgn+rgnBBox(a6),a0 ; point to rect
|
||||
add.w d0,(a0)+ ; convert top to local coords
|
||||
add.w d1,(a0)+ ; convert left to local coords
|
||||
add.w d0,(a0)+ ; convert bottom to local coords
|
||||
add.w d1,(a0) ; convert right to local coords
|
||||
lea dstRectRgn+rgnBBox(A6),a0
|
||||
move.l a0,d0
|
||||
move.l a0,-(sp)
|
||||
jsr ([$FC0]) ; _GlobalToLocal?
|
||||
|
||||
add #4,d0
|
||||
move.l d0,-(sp)
|
||||
jsr ([$FC0]) ; _GlobalToLocal?
|
||||
|
||||
MOVE.L (A2),A0 ; POINT TO DEVICE
|
||||
MOVE.L GDPMAP(A0),A0 ; GET PIXMAP
|
||||
MOVE.L (A0),A0 ; POINT TO PIXMAP
|
||||
|
@ -860,77 +860,6 @@ KillPicture PROC EXPORT
|
||||
_DisposHandle ;discard it
|
||||
JMP (A1) ;and return
|
||||
|
||||
;-----------------------Calc GCD <KON 07JAN90>---------------------
|
||||
CalcGCD PROC EXPORT
|
||||
; Routine returns GCD( d0, d1 ) using Euclidean method
|
||||
; On Entry: D0 and D1 contain word size values to reduce
|
||||
; On Exit: D0 and D1 both contain GCD
|
||||
;
|
||||
cmp.l d0,d1 ;while d0 != d1 (unsigned word compare)
|
||||
beq.s @FoundGCD
|
||||
bgt.s @D1isBigger ; if( d1 < d0 )
|
||||
exg d0,d1 ; swap( d1, d0 )
|
||||
@D1isBigger
|
||||
sub d0,d1 ; d1 = d1 - d0
|
||||
bra.s CalcGCD ;end while
|
||||
@FoundGCD
|
||||
rts ;d0 and d1 contain GCD
|
||||
ENDPROC
|
||||
|
||||
ReduceD3D4 PROC EXPORT
|
||||
IMPORT CalcGCD
|
||||
; Routine returns ReduceD3D4( d3, d4 ) reduces d3.w and d4.w by GCD for
|
||||
; both the low and high words
|
||||
;
|
||||
; On Entry: D3 and D4 contain two word size values to reduce
|
||||
; On Exit: D3 and D4 contain reduced values
|
||||
;
|
||||
;
|
||||
; Divide Numer and Denom for width and height by GCD to prevent overflow.
|
||||
;
|
||||
moveq #0,d0 ;make sure high word is zero for next 2 divides
|
||||
move.l d0,d1 ;CalcGCD exchanges regs, so both need to be cleared
|
||||
move.w d3,d0 ;D0 has denom.v, d1 has numer.v
|
||||
beq.s @Done ;abort if zero.
|
||||
move.w d4,d1 ;D0 has denom.v, d1 has numer.v
|
||||
beq.s @Done ;abort if zero.
|
||||
jsr CalcGCD ;returns GCD in d0
|
||||
move.w d3,d1 ;D0 has denom.v, d1 has numer.v
|
||||
divu.w d0,d1 ;dividing by GCD should never leave remainder
|
||||
move.w d1,d3 ;save reduced numer.v
|
||||
move.w d4,d1 ;D0 has denom.v, d1 has numer.v
|
||||
divu.w d0,d1
|
||||
move.w d1,d4 ;save reduced denom.v
|
||||
;
|
||||
; Now do width: Could have different scale factor than height did
|
||||
;
|
||||
swap d3 ;operate on high word
|
||||
swap d4
|
||||
move.w d3,d0 ;D0 has denom.h, d1 has numer.h
|
||||
beq.s @DoneSwap ;abort if zero.
|
||||
move.w d4,d1 ;D0 has denom.h, d1 has numer.h
|
||||
beq.s @DoneSwap ;abort if zero.
|
||||
jsr CalcGCD ;returns GCD in d0
|
||||
move.w d3,d1 ;D0 has denom.h, d1 has numer.h
|
||||
divu.w d0,d1 ;dividing by GCD should never leave remainder
|
||||
move.w d1,d3 ;save reduced numer.h
|
||||
move.w d4,d1 ;D0 has denom.h, d1 has numer.h
|
||||
divu.w d0,d1
|
||||
move.w d1,d4 ;save reduced denom.h
|
||||
@DoneSwap
|
||||
swap d3 ;put things back
|
||||
swap d4
|
||||
@Done
|
||||
rts ;all done
|
||||
;
|
||||
; End <KON 7/1/91>
|
||||
;
|
||||
ENDPROC
|
||||
|
||||
;-----------------------END GCD <KON 07JAN90>---------------------
|
||||
|
||||
; as seen in QDciPatchROM.a <sm 6/9/92>stb
|
||||
|
||||
DrawPicture PROC EXPORT
|
||||
IMPORT PicItem1,NewRgn,InitColorStuff,ReduceD3D4
|
||||
;------------------------------------------------------------------
|
||||
@ -4339,47 +4268,6 @@ DONE MOVE.L SAVEDSP(A6),SP ;RESTORE STACK POINTER
|
||||
;
|
||||
|
||||
|
||||
PutBigPicData PROC EXPORT ;17Jun88 BAL
|
||||
;------------------------------------------------------
|
||||
;
|
||||
; PROCEDURE PutBigPicData(dataPtr: QDPtr; byteCount:LONG);
|
||||
; ADD many BYTES TO THEPIC.
|
||||
;
|
||||
; This is the same as PutPicData except the byteCount is a long
|
||||
;
|
||||
partSize EQU $4000
|
||||
partShift EQU $E
|
||||
|
||||
MOVEM.L D7/A3-A4,-(SP) ;save a couple of registers
|
||||
|
||||
MOVE.L 20(SP),A3 ;get the pointer to data
|
||||
MOVE.L 16(SP),A4 ;get data length
|
||||
MOVE.L A4,D7 ;copy pointer
|
||||
MOVEQ #partShift,D0 ;get a constant for the upcoming shift
|
||||
LSR.L D0,D7 ;find the number of 16K "pages"
|
||||
BEQ.S LeftOvers ;no, so do the remaining part of the picture
|
||||
|
||||
@1
|
||||
MOVE.L A3,-(SP) ;PUSH DATA POINTER
|
||||
MOVE #partSize,-(SP) ;move 16K of data
|
||||
JSR PutPicData ;AND CALL GET PROC
|
||||
ADD.W #partSize,A3 ;move data start pointer up
|
||||
SUB.W #partSize,A4 ;subtract for remainder later
|
||||
SUBQ.L #1,D7 ;decrease the number of pages
|
||||
BNE.S @1 ;loop for each page
|
||||
|
||||
LeftOvers
|
||||
MOVE.L A3,-(SP) ;PUSH DATA POINTER
|
||||
MOVE.W A4,-(SP) ;move remainder
|
||||
JSR PutPicData ;AND CALL GET PROC
|
||||
|
||||
MOVEM.L (SP)+,D7/A2-A4 ;restore registers
|
||||
RTD #8 ;and return
|
||||
|
||||
;
|
||||
;GetPMData now included in GetPMData.a
|
||||
;
|
||||
|
||||
PutPMData PROC EXPORT
|
||||
IMPORT PutPicByte,PutPicWord,PutPicData
|
||||
;------------------------------------------------------
|
||||
@ -4956,53 +4844,6 @@ MapRect PROC EXPORT
|
||||
BRA MAPPT ;MAP BOTRIGHT AND RETURN
|
||||
|
||||
|
||||
MapRatio PROC EXPORT
|
||||
;-------------------------------------------------------------
|
||||
;
|
||||
; PROCEDURE MapRatio(VAR numer, denom: Point; fromRect: Rect);
|
||||
;
|
||||
; Map ratio so that denom.h/.v = height/width of fromRect.
|
||||
; This is so that later scaling of the numerator will have some
|
||||
; range to work within.
|
||||
;
|
||||
; NOTE: Only necessary because fractional numer, denom not used
|
||||
;
|
||||
; numer.h := numer.h * fromWidth / denom.h
|
||||
; denom.h := fromWidth
|
||||
; numer.v := numer.v * fromHeight / denom.v
|
||||
; denom.v := fromHeight
|
||||
|
||||
PARAMSIZE EQU 12 ; TOTAL BYTES OF PARAMS
|
||||
NUMER EQU PARAMSIZE+8-4 ; LONG, ADDR OF POINT
|
||||
DENOM EQU NUMER-4 ; LONG, ADDR OF POINT
|
||||
FROMRECT EQU DENOM-4 ; LONG, ADDR OF RECT
|
||||
|
||||
LINK A6,#0 ; NO LOCALS
|
||||
MOVEM.L D0-D1/A0-A2,-(SP) ; SAVE REGS
|
||||
MOVE.L NUMER(A6),A0 ; point to numer
|
||||
MOVE.L DENOM(A6),A1 ; point to denom
|
||||
MOVE.L FROMRECT(A6),A2 ; point to fromRect
|
||||
|
||||
MOVE.W right(A2),D0 ; get fromRect right
|
||||
SUB.W left(A2),D0 ; get fromWidth
|
||||
MOVE.W h(A0),D1 ; get numer.h
|
||||
MULU D0,D1 ; multiply by fromWidth
|
||||
DIVU h(A1),D1 ; divide by denom.h
|
||||
MOVE.W D1,h(A0) ; update numer.h
|
||||
MOVE.W D0,h(A1) ; update denom.h
|
||||
|
||||
MOVE.W bottom(A2),D0 ; get fromRect bottom
|
||||
SUB.W top(A2),D0 ; get fromHeight
|
||||
MOVE.W v(A0),D1 ; get numer.v
|
||||
MULU D0,D1 ; multiply by fromHeight
|
||||
DIVU v(A1),D1 ; divide by denom.v
|
||||
MOVE.W D1,v(A0) ; update numer.v
|
||||
MOVE.W D0,v(A1) ; update denom.v
|
||||
|
||||
DONE MOVEM.L (SP)+,D0-D1/A0-A2 ; RESTORE REGS
|
||||
UNLINK PARAMSIZE,'MAPRATIO'
|
||||
|
||||
|
||||
ENDPROC
|
||||
|
||||
|
||||
|
44
QuickDraw/QDExtensions2.a
Normal file
44
QuickDraw/QDExtensions2.a
Normal file
@ -0,0 +1,44 @@
|
||||
QDEXTENSIONS2 PROC EXPORT
|
||||
|
||||
|
||||
cmp #10,D0
|
||||
bhi @bad_selector
|
||||
jmp @jmptbl(D0.W * 4)
|
||||
|
||||
|
||||
@jmptbl
|
||||
import QDEXTENSIONS2_SELECTOR_0
|
||||
jmp QDEXTENSIONS2_SELECTOR_0
|
||||
import QDEXTENSIONS2_SELECTOR_1
|
||||
jmp QDEXTENSIONS2_SELECTOR_1
|
||||
import QDEXTENSIONS2_SELECTOR_2
|
||||
jmp QDEXTENSIONS2_SELECTOR_2
|
||||
import QDEXTENSIONS2_SELECTOR_3
|
||||
jmp QDEXTENSIONS2_SELECTOR_3
|
||||
import QDEXTENSIONS2_SELECTOR_4
|
||||
jmp QDEXTENSIONS2_SELECTOR_4
|
||||
import QDEXTENSIONS2_SELECTOR_5
|
||||
jmp QDEXTENSIONS2_SELECTOR_5
|
||||
import QDEXTENSIONS2_SELECTOR_6
|
||||
jmp QDEXTENSIONS2_SELECTOR_6
|
||||
import QDEXTENSIONS2_SELECTOR_7
|
||||
jmp QDEXTENSIONS2_SELECTOR_7
|
||||
import QDEXTENSIONS2_SELECTOR_8
|
||||
jmp QDEXTENSIONS2_SELECTOR_8
|
||||
import QDEXTENSIONS2_SELECTOR_9
|
||||
jmp QDEXTENSIONS2_SELECTOR_9
|
||||
import QDEXTENSIONS2_SELECTOR_10
|
||||
jmp QDEXTENSIONS2_SELECTOR_10
|
||||
|
||||
|
||||
@bad_selector
|
||||
; The upper half of D0 contains the number of bytes of parameters
|
||||
; on the stack
|
||||
|
||||
move.l (SP)+,A0
|
||||
swap D0
|
||||
ext.l D0
|
||||
add.l D0,SP
|
||||
move #paramErr,D0
|
||||
move D0,QDErr
|
||||
jmp (A0)
|
@ -1420,8 +1420,15 @@ OLDRB MOVE VLOC(A6),D4 ;GET VERTICAL
|
||||
MOVE D4,-(SP) ;PUSH GLOBAL TOP
|
||||
MOVE D5,-(SP) ;PUSH GLOBAL RIGHT
|
||||
MOVE D4,-(SP) ;PUSH GLOBAL BOTTOM
|
||||
MOVE.L JShieldCursor,A1 ;get lo mem vector
|
||||
JSR (A1) ;and call it
|
||||
|
||||
MOVE.L SP,A0
|
||||
CLR.L -(SP)
|
||||
MOVE.L A0,-(SP)
|
||||
CLR.L -(SP)
|
||||
MOVE.L #$80000,D0
|
||||
DC.W $ABE0 ;_QDExtensions2
|
||||
MOVE.L (SP)+,D6
|
||||
ADDQ #8,SP
|
||||
|
||||
MOVE.L DEVICELIST,A3 ;GET FIRST IN DEVICE LIST
|
||||
|
||||
@ -1518,9 +1525,11 @@ NOCOLOR cmp.w #16,pixelType(a3) ;direct device?
|
||||
|
||||
DONE tst.b (sp)+ ;pop and check crsrFlag
|
||||
beq.s @noShow ;need to show cursor?
|
||||
_SHOWCURSOR ;show it
|
||||
move.l D6,-(SP)
|
||||
move.l #$40001,D0
|
||||
dc.w $ABE0 ;_QDExtensions2
|
||||
@noShow MOVE.L (SP)+,THEGDEVICE ;RESTORE CURRENT GRAFDEVICE
|
||||
MOVEM.L (SP)+,D4-D5/A2-A3 ;RESTORE WORK REGISTERS
|
||||
MOVEM.L (SP)+,D4-D6/A2-A3 ;RESTORE WORK REGISTERS
|
||||
UNLINK PARAMSIZE,'GETCPIXEL'
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user