mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-26 03:32:33 +00:00
Reverse 68k Color QuickDraw
The ROM now round-trips with QuickDraw mostly built from source. (~30% of the ROM is now built from source.)
This commit is contained in:
parent
6764d35537
commit
9c249dafab
Binary file not shown.
BIN
BuildResults/RISC/Lib/MoreCQD.lib
Normal file
BIN
BuildResults/RISC/Lib/MoreCQD.lib
Normal file
Binary file not shown.
@ -202,7 +202,8 @@ processAppSpec EQU 56
|
||||
|
||||
MACRO
|
||||
_GetFrontProcess
|
||||
PEA $FFFFFFFF
|
||||
MOVEQ.L #$FFFFFFFF,D0
|
||||
MOVE.L D0,-(SP)
|
||||
MOVE.W #$39,-(SP)
|
||||
_OSDispatch
|
||||
ENDM
|
||||
|
@ -266,7 +266,7 @@ PMFlag EQU $8000 ; flag to say it's a new pixMap
|
||||
cPortFlag EQU $C000 ; isPixMap+isCPort
|
||||
pixVersion EQU $0000 ; isPixMap
|
||||
|
||||
qdStackXtra EQU $0640 ; stack space left for interrupts <1.4> BAL
|
||||
qdStackXtra EQU $0800 ; stack space left for interrupts <1.4> BAL
|
||||
|
||||
isPixMap EQU 15 ; for testing high bit of pRowbytes
|
||||
isCPort EQU 14 ; indicates that "bitmap" belongs to port
|
||||
@ -376,7 +376,7 @@ CCSTATEREGS EQU CCDEPTH+2 ;[16 BYTES] STATE INFO OF SAVED DATA
|
||||
CCBYTES EQU CCSTATEREGS+16 ;[WORD] ROWBYTES OF EXPANDED DATA
|
||||
CCMAXDEPTH EQU CCBYTES+2 ;[WORD] MAXIMUM SCREEN DEPTH
|
||||
|
||||
CCSAVEREC EQU CCMAXDEPTH+2 ;SIZE OF CURSOR SAVE AREA
|
||||
CCSAVEREC EQU CCMAXDEPTH+2+8 ;SIZE OF CURSOR SAVE AREA
|
||||
|
||||
; Font Manager low mem
|
||||
;
|
||||
|
@ -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>
|
||||
@ -1711,11 +1741,91 @@ DSTRECT EQU MASKRECT-4 ;long, addr of Rect
|
||||
MODE EQU DSTRECT-2 ;WORD
|
||||
MASKRGN EQU MODE-4 ;LONG, RGNHANDLE
|
||||
|
||||
VARSIZE EQU 0
|
||||
VARSIZE EQU -4
|
||||
|
||||
share LINK A6,#VARSIZE ;ALLOCATE STACK FRAME
|
||||
MOVEM.L D3-D7/A2-A4,-(SP) ;SAVE WORK REGISTERS FOR DEVLOOP
|
||||
|
||||
|
||||
CLR.L -4(A6)
|
||||
MOVE.L MASKBITS(A6), D0
|
||||
BEQ @skip
|
||||
MOVEA.L D0, A0
|
||||
CMPI #$1, $20(A0)
|
||||
BNE @skip
|
||||
MOVEA.L $16(A6), A0
|
||||
MOVEA.L $E(A6), A1
|
||||
MOVE $4(A0), D0
|
||||
SUB (A0), D0
|
||||
SUB $4(A1), D0
|
||||
ADD (A1), D0
|
||||
BGT.B @L0
|
||||
MOVE $6(A0), D0
|
||||
SUB $2(A0), D0
|
||||
SUB $6(A1), D0
|
||||
ADD $2(A0), D0
|
||||
BLE @skip
|
||||
@L0 SUBQ #$4, SP
|
||||
DC.W $AA18 ;_GetCTable
|
||||
MOVE.L (SP)+, D3
|
||||
BEQ @skip
|
||||
SUBQ #$2, SP
|
||||
PEA.L -4(A6)
|
||||
MOVE #$2, -(SP)
|
||||
PEA.L MASKRECT(A6)
|
||||
MOVE.L D3, -(SP)
|
||||
CLR.L -(SP)
|
||||
PEA 4
|
||||
MOVE.L #$160000,D0 ;_QDExtensions -> _NewGWorld
|
||||
DC.W $AB1D
|
||||
MOVE (SP)+, D4
|
||||
BNE.B @L1
|
||||
TST.L -4(A6)
|
||||
BNE.B @L2
|
||||
@L1 SUBQ #$2, SP
|
||||
PEA.L -4(A6)
|
||||
MOVE #$2, -(SP)
|
||||
PEA.L MASKRECT(A6)
|
||||
MOVE.L D3, -(SP)
|
||||
CLR.L -(SP)
|
||||
CLR.L -(SP)
|
||||
MOVE.L #$160000,D0 ;_QDExtensions -> _NewGWorld
|
||||
DC.W $AB1D
|
||||
MOVE (SP)+, D4
|
||||
@L2 MOVE.L D3, -(SP)
|
||||
DC.W $AA24 ;_DisposCTable
|
||||
TST D4
|
||||
BNE.B @skip
|
||||
MOVE.L -4(A6), D0
|
||||
BEQ.B @skip
|
||||
MOVEA.L D0, A3
|
||||
SUBQ #$8, SP
|
||||
PEA.L $4(SP)
|
||||
PEA.L $4(SP)
|
||||
MOVE.L #$80005,D0 ;_QDExtensions -> _GetGWorld
|
||||
DC.W $AB1D
|
||||
MOVE.L -4(A6), -(SP)
|
||||
CLR.L -(SP)
|
||||
MOVE.L #$80006,D0 ;_QDExtensions -> _SetGWorld
|
||||
DC.W $AB1D
|
||||
MOVE.L MASKBITS(A6), -(SP)
|
||||
PEA.L $2(A3)
|
||||
MOVE.L MASKRECT(A6), -(SP)
|
||||
PEA.L $10(A3)
|
||||
CLR -(SP)
|
||||
CLR.L -(SP)
|
||||
DC.W $A8EC ;_CopyBits
|
||||
SUBQ #$2, SP
|
||||
MOVE.L $2(A3), -(SP)
|
||||
MOVE.L #$40001,D0 ;_QDExtensions -> _LockPixels
|
||||
DC.W $AB1D
|
||||
ADDQ #$2, SP
|
||||
MOVEA.L $2(A3), A0
|
||||
_HLock
|
||||
MOVE.L (A0), MASKBITS(A6)
|
||||
MOVE.L #$80005,D0 ;_QDExtensions -> _GetGWorld
|
||||
DC.W $AB1D
|
||||
@skip
|
||||
|
||||
; SET UP REGISTERS FOR CALLING CMDEVLOOP
|
||||
|
||||
MOVE.L DSTBITS(A6),A1 ;GET DST BIT/PIXMAP
|
||||
@ -1763,7 +1873,15 @@ SRCOK MOVE.L DSTBITS(A6),A0 ;POINT TO DSTBITS
|
||||
|
||||
NOTPORT MOVE.L DSTBITS(A6),A1 ;Pass DSTBITS (not derefed) <BAL 28May89>
|
||||
JSR CMDevLoop ;AND DRAW THE IMAGE
|
||||
|
||||
|
||||
MOVE.L -4(A6),D0
|
||||
BEQ.S @skipQDCall
|
||||
|
||||
MOVE.L D0,-(SP)
|
||||
MOVE.L #$40004,D0 ;_QDExtensions -> _DisposeGWorld
|
||||
DC.W $AB1D
|
||||
@skipQDCall
|
||||
|
||||
MOVEM.L (SP)+,D3-D7/A2-A4 ;RESTORE WORK REGISTERS
|
||||
UNLINK PARAMSIZE,'KopyMask'
|
||||
|
||||
@ -2296,9 +2414,9 @@ cutOutDevices
|
||||
move.l pmTable(a0),a0 ;get handle to source color table
|
||||
move.l (a0),a0 ;deref it
|
||||
cmp.l ctSeed(a0),d1 ;do the color tables seeds match ?
|
||||
beq.s @next
|
||||
beq @next
|
||||
|
||||
movem.l d1/a1,-(sp) ;save our scratch registers
|
||||
movem.l d1/a1-a3,-(sp) ;save our scratch registers
|
||||
|
||||
clr.b -(sp) ;make space for boolean result
|
||||
pea tempRect1(a6) ;pointer to the SrcRect in global coordinates
|
||||
@ -2307,7 +2425,34 @@ cutOutDevices
|
||||
pea tempRect2(a6) ;pointer to the result
|
||||
_SectRect ;get the intersection
|
||||
tst.b (sp)+ ;if they didn't intersect at all, then skip to
|
||||
beq.s @skip ;..the next device
|
||||
beq @skip ;..the next device
|
||||
|
||||
move.l (a1),a0
|
||||
move.l GDPMap(a0),a0
|
||||
move.l (a0),a0
|
||||
move.l pmTable(a0),a0
|
||||
move.l (a0),a0
|
||||
move.l (DeviceList),a2
|
||||
@again move.l (a2),a2
|
||||
move.l GDPMap(a2),a3
|
||||
move.l (a3),a3
|
||||
move.l pmTable(a3),a3
|
||||
move.l (a3),a3
|
||||
move.l (a3),d0
|
||||
cmp.l (a0),d0
|
||||
bne @done
|
||||
sub.l #8,sp
|
||||
clr.b -(sp)
|
||||
pea.l tempRect1(a6)
|
||||
pea.l $22(a2)
|
||||
pea.l $a(sp)
|
||||
_SectRect
|
||||
tst.b (sp)+
|
||||
add.l #8,sp
|
||||
bne @skip
|
||||
@done move.l GDNextGD(a2),d0
|
||||
move.l d0,a2
|
||||
bne.s @again
|
||||
|
||||
lea tempRect2(a6),a0 ;point to our temp rect
|
||||
pea topleft(a0) ;convert the temp rect back to local coordinates
|
||||
@ -2323,7 +2468,7 @@ cutOutDevices
|
||||
move.l d6,-(sp)
|
||||
_DiffRgn
|
||||
|
||||
@skip movem.l (sp)+,d1/a1 ;restore our scratch registers
|
||||
@skip movem.l (sp)+,d1/a1-a3 ;restore our scratch registers
|
||||
|
||||
@next move.l (a1),a0 ;deref the current device list handle
|
||||
move.l GDNextGD(a0),d0 ;get the next device handle into D0
|
||||
|
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>
|
||||
|
||||
@ -155,6 +156,7 @@ BlockHead PROC EXPORT
|
||||
endif
|
||||
INCLUDE 'BITBLT.a'
|
||||
INCLUDE 'cCrsrCore.a'
|
||||
INCLUDE 'QDExtensions2.a'
|
||||
INCLUDE 'QDUtil.a'
|
||||
INCLUDE 'Colorasm.a'
|
||||
INCLUDE 'Patterns.a'
|
||||
|
@ -221,8 +221,8 @@ SlotParms EQU IOPBlk-spBlock.SPBlockSize ; parameter block for slot manag
|
||||
VidParms EQU SlotParms-12 ; [12] size of mode params
|
||||
StartList EQU VidParms-4 ; [long] pointer to start of resource
|
||||
|
||||
VARSIZE EQU StartList ; size of local vars for CheckDevices
|
||||
UTILVARS EQU VidParms ; size of local vars for utility routines
|
||||
VARSIZE EQU StartList-4 ; size of local vars for CheckDevices
|
||||
UTILVARS EQU VidParms-$30 ; size of local vars for utility routines
|
||||
|
||||
; ¥¥¥ Start of Code ¥¥¥
|
||||
;
|
||||
@ -317,557 +317,42 @@ SetDevGamma
|
||||
; ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
NewFunc
|
||||
|
||||
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
|
||||
MOVEM.L A0-A4/D0-D7,-(SP) ; so we donÕt screw up the boot process
|
||||
|
||||
;+++; 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 +364,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 +403,15 @@ 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 NewFunc
|
||||
Bne.s @reallyDont
|
||||
Bra.s @skipGD
|
||||
@dont
|
||||
|
||||
Lea SlotParms(A6),A0 ; Fill out SpBlock:
|
||||
Move.b D0,spSlot(A0) ; spSlot = slot number
|
||||
Clr.w spID(A0) ; spID = 0
|
||||
@ -947,6 +434,8 @@ NoGammaFix
|
||||
; We found a non-TFB card that contains no gamma table directory. So, we need to
|
||||
; employ our fix, which is to make a SetGamma and then a SetEntries call.
|
||||
|
||||
@reallyDont
|
||||
|
||||
Move.l A2,A0 ; Lock down the gammaTable Handle.
|
||||
_Hlock
|
||||
|
||||
@ -969,11 +458,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 ¥¥¥
|
||||
;
|
||||
;----------------------------------------------------------------
|
||||
@ -1139,7 +623,7 @@ DoDrvrPatches
|
||||
;
|
||||
; Save all registers to prevent problems with the ROM INIT running code.
|
||||
;
|
||||
MOVEM.L A0-A6/D0-D7,-(SP) ; so we donÕt screw up the boot process
|
||||
MOVEM.L A5-A6,-(SP) ; so we donÕt screw up the boot process
|
||||
|
||||
;
|
||||
; Point to UnitTable in A2.
|
||||
@ -1195,7 +679,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 +724,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 +825,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
|
||||
|
@ -637,7 +637,7 @@ Seed
|
||||
|
||||
MOVE.L D5,D4 ; copy total # of color (and cleared hi word)
|
||||
SUBQ #2,D4 ; this is the number of colors remaining
|
||||
BLE.S QVille ; if zero or negative, all done
|
||||
BLT.S QVille ; if zero or negative, all done
|
||||
MOVEQ #1,D5 ; start at color #1 (zero based)
|
||||
@TheRestOfUs ; a temporary label for the rest of us
|
||||
BSR.S QUtil ; queue it
|
||||
|
@ -21,6 +21,7 @@ QDPatchesDir = {ColorQDDir}Patches:
|
||||
|
||||
CQDObjs = "{ObjDir}CheckDevicesINIT.a.o" ¶
|
||||
"{ObjDir}CQD.a.o" ¶
|
||||
"{LibDir}MoreCQD.lib" ¶
|
||||
"{ObjDir}DeviceLoop.a.o"
|
||||
|
||||
|
||||
@ -28,8 +29,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"
|
||||
|
@ -105,8 +105,38 @@ LocalSize EQU *
|
||||
link A6, #LocalSize
|
||||
movem.l D3-D7/A2-A4, callerRegs(A6) ; save the callers registers
|
||||
|
||||
btst #6, ROM85 ; Color QuickDraw available?
|
||||
bnz @classicQD ; if not, handle old case
|
||||
machine MC68030
|
||||
move.l ([$2b6],$1fc),a0
|
||||
machine MC68020
|
||||
|
||||
tst.b $b5(a0)
|
||||
beq.s @noShield
|
||||
|
||||
move.l drawingRgn(a6),d0
|
||||
beq.s @noConversion
|
||||
|
||||
move.l d0,a0
|
||||
move.l (a0),a0
|
||||
move.l $2(a0),localRect+0(a6)
|
||||
move.l $6(a0),localRect+4(a6)
|
||||
|
||||
pea localRect+0(a6)
|
||||
_LocalToGlobal
|
||||
|
||||
pea localRect+4(a6)
|
||||
_LocalToGlobal
|
||||
|
||||
bra.s @proceedWithShield
|
||||
@noConversion
|
||||
|
||||
move.l #$80008000,localRect+0(a6)
|
||||
move.l #$7fff7fff,localRect+4(a6)
|
||||
|
||||
@proceedWithShield
|
||||
pea localRect+0(a6)
|
||||
clr.l -(sp)
|
||||
_ShieldCursor
|
||||
@noShield
|
||||
|
||||
move.l TheGDevice, D0 ; Get the handle to the current GDevice
|
||||
move.l MainDevice, D1 ; Get the handle to the main device
|
||||
@ -149,11 +179,11 @@ LocalSize EQU *
|
||||
beq @noMore ; if so, no more devices
|
||||
move.l (A4), A3 ; point at the GDevice record
|
||||
bsr TestAndIntersect ; is device good for drawing?
|
||||
bz.s @nextDevice ; if not, keep searching
|
||||
bz @nextDevice ; if not, keep searching
|
||||
|
||||
move.l flags(A6), D0 ; get the callerÕs options
|
||||
btst #allDevicesBit, D0 ; are we ignoring regions?
|
||||
bnz.s @visRgnSetup ; if so, donÕt change the visRgn
|
||||
bnz @visRgnSetup ; if so, donÕt change the visRgn
|
||||
|
||||
move.l D4, -(SP) ; rectangle region handle
|
||||
pea localRect(A6) ; this device (local coords)
|
||||
@ -175,10 +205,12 @@ LocalSize EQU *
|
||||
move.l ctSeed(A0), D7 ; stash deviceÕs ctab seed
|
||||
move.l flags(A6), D0 ; get callerÕs flags
|
||||
btst #singleDevicesBit, D0 ; should we group devices?
|
||||
bnz.s @groupingDone ; if not, donÕt call AddSimilar
|
||||
bnz @groupingDone ; if not, donÕt call AddSimilar
|
||||
bsr AddSimilarDevices ; find all the like devices
|
||||
@groupingDone
|
||||
movem.l D3-D7/A2-A4/A6, -(SP) ; save OUR registers
|
||||
bsr NewFunc1
|
||||
move D2,-(SP)
|
||||
swap D6
|
||||
move.l D6, -(SP) ; pass depth and flags
|
||||
move.l A4, -(SP) ; and the GDHandle
|
||||
@ -187,6 +219,8 @@ LocalSize EQU *
|
||||
movem.l callerRegs(A6), D3-D7/A2-A4 ; restore callerÕs registers
|
||||
move.l A6Link(A6), A6 ; and restore callerÕs A6
|
||||
jsr (A0) ; call the drawing procedure
|
||||
move (SP)+,D2
|
||||
bsr NewFunc2
|
||||
movem.l (SP)+, D3-D7/A2-A4/A6 ; get OUR register set back
|
||||
move.l (A4), A3 ; fix GDevicePtr
|
||||
@nextDevice
|
||||
@ -194,13 +228,6 @@ LocalSize EQU *
|
||||
addq #1, D3 ; increment device number
|
||||
bra.s @deviceIntersect ; try this one
|
||||
|
||||
@classicQD
|
||||
move.l A6, -(SP) ; save our stack frame ptr
|
||||
move.w #1, -(SP) ; pass depth (always 1)
|
||||
move.w #fakeDeviceFlags, -(SP) ; and gdflags (something reasonable)
|
||||
clr.l -(SP) ; NIL for GDHandle
|
||||
bra.s @simpleDeviceCommon
|
||||
|
||||
@oneDevice
|
||||
move.l A6, -(SP) ; save our stack frame ptr
|
||||
move.l gdPMap(A0), A1 ; PixMapHandle
|
||||
@ -230,6 +257,17 @@ LocalSize EQU *
|
||||
_DisposRgn
|
||||
move.l savedVis(A6), visRgn(A2) ; put original visRgn back
|
||||
@exit
|
||||
|
||||
machine MC68030
|
||||
move.l ([$2b6],$1fc),a0
|
||||
machine MC68020
|
||||
|
||||
tst.b $b5(a0)
|
||||
beq.s @noShow
|
||||
|
||||
_ShowCursor
|
||||
@noShow
|
||||
|
||||
movem.l callerRegs(A6), D3-D7/A2-A4 ; restore regs
|
||||
unlk A6
|
||||
move.l (SP)+, A0 ; clean stack and return
|
||||
@ -252,27 +290,30 @@ AddSimilarDevices
|
||||
|
||||
movem.l A3-A4/D3/D6, -(SP) ; save original state
|
||||
andi.w #importantFlagsMask, D6 ; keep only pertinent flags
|
||||
move.l A3, A1
|
||||
move.l gdNextGD(A3), A4 ; start with next device
|
||||
addq #1, D3 ; which is next in number, too
|
||||
@addLoop
|
||||
move.l A4, D0 ; is there a GDHandle?
|
||||
bz.s @noMore ; if NIL, then weÕre done
|
||||
bz @noMore ; if NIL, then weÕre done
|
||||
|
||||
move.l (A4), A3 ; handle->ptr
|
||||
bsr.s TestAndIntersect ; see if device is okay by itself
|
||||
bz.s @nextDevice ; if not, try next one
|
||||
move.l A1, -(SP)
|
||||
bsr TestAndIntersect ; see if device is okay by itself
|
||||
move.l (SP)+, A1
|
||||
bz @nextDevice ; if not, try next one
|
||||
|
||||
move.w gdFlags(A3), D0 ; get device attributes
|
||||
andi.w #importantFlagsMask, D0 ; strip unimportant ones
|
||||
cmp.w D0, D6 ; is this device similar to test device?
|
||||
bne.s @nextDevice ; if not, donÕt use it
|
||||
bne @nextDevice ; if not, donÕt use it
|
||||
|
||||
move.l gdPMap(A3), A0 ; get deviceÕs PixMapHandle
|
||||
move.l (A0), A0 ; get deviceÕs PixMapPtr
|
||||
move.l D6, D0 ; get depth and flags
|
||||
swap D0 ; get depth into low word
|
||||
cmp.w pmPixelSize(A0), D0 ; save depth as test device?
|
||||
bne.s @nextDevice ; if not, donÕt use it
|
||||
bne @nextDevice ; if not, donÕt use it
|
||||
|
||||
move.l flags(A6), D0 ; get the option flags
|
||||
btst #dontMatchSeedsBit, D0 ; should we check ctSeeds?
|
||||
@ -280,12 +321,49 @@ AddSimilarDevices
|
||||
move.l pmTable(A0), A0 ; handle to color table
|
||||
move.l (A0), A0
|
||||
cmp.l ctSeed(A0), D7 ; are the seeds the same?
|
||||
bne.s @nextDevice ; if not, donÕt use this one
|
||||
bne @nextDevice ; if not, donÕt use this one
|
||||
@seedsChecked
|
||||
|
||||
move.l A3, A0
|
||||
move.l $22(A1), D0
|
||||
cmp $24(A0), D0
|
||||
bgt.s @L4
|
||||
blt.s @L1
|
||||
swap D0
|
||||
cmp $22(A0), D0
|
||||
bgt.s @L5
|
||||
blt.s @L2
|
||||
move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
blt.s @L6
|
||||
bgt.s @L3
|
||||
bra.s @nextDevice
|
||||
@L1 swap D0
|
||||
cmp $22(A0), D0
|
||||
bgt.s @doneWhateverThatWas
|
||||
@L2 move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
blt.s @doneWhateverThatWas
|
||||
@L3 swap D0
|
||||
cmp $26(A0), D0
|
||||
blt.s @doneWhateverThatWas
|
||||
bra.s @nextDevice
|
||||
@L4 swap D0
|
||||
cmp $22(A0), D0
|
||||
blt.s @doneWhateverThatWas
|
||||
@L5 move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
bgt.s @doneWhateverThatWas
|
||||
@L6 swap D0
|
||||
cmp $26(A0), D0
|
||||
bgt.s @doneWhateverThatWas
|
||||
bra.s @nextDevice
|
||||
@doneWhateverThatWas
|
||||
|
||||
move.l flags(A6), D0 ; what are the current options?
|
||||
btst #allDevicesBit, D0 ; are we ignoring drawingRgn?
|
||||
bnz.s @visRgnSetup ; if so, no regions to setup
|
||||
move.l A1, -(SP)
|
||||
|
||||
move.l D4, -(SP) ; rectangle region handle
|
||||
pea localRect(A6) ; this device (local coords)
|
||||
@ -299,6 +377,7 @@ AddSimilarDevices
|
||||
move.l (SP), -(SP) ; get ORed together
|
||||
_XorRgn ; XOr is a fast way to Union when guaranteed no overlap
|
||||
move.l (A4), A3 ; fix GDevicePtr
|
||||
move.l (SP)+, A1
|
||||
|
||||
@visRgnSetup
|
||||
bset.l D3, D5 ; mark this device done
|
||||
@ -347,4 +426,73 @@ TestAndIntersect
|
||||
@exit
|
||||
rts
|
||||
|
||||
|
||||
NewFunc1
|
||||
moveq #0, D2
|
||||
move.l (DeviceList), D0
|
||||
beq.s @return
|
||||
moveq #0, D1
|
||||
@L0 movea.l D0, A0
|
||||
movea.l (A0), A0
|
||||
cmp D3, D1
|
||||
beq.s @L8
|
||||
tst $14(A0)
|
||||
bpl.s @L8
|
||||
movea.l (A4), A1
|
||||
move.l $22(A1), D0
|
||||
cmp $24(A0), D0
|
||||
bgt.s @L4
|
||||
blt.s @L1
|
||||
swap D0
|
||||
cmp $22(A0), D0
|
||||
bgt.s @L5
|
||||
blt.s @L2
|
||||
move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
blt.s @L6
|
||||
bgt.s @L3
|
||||
bra.s @L7
|
||||
@L1 swap D0
|
||||
cmp $22(A0), D0
|
||||
bgt.s @L8
|
||||
@L2 move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
blt.s @L8
|
||||
@L3 swap D0
|
||||
cmp $26(A0), D0
|
||||
blt.s @L8
|
||||
bra.s @L7
|
||||
@L4 swap D0
|
||||
cmp $22(A0), D0
|
||||
blt.s @L8
|
||||
@L5 move.l $26(A1), D0
|
||||
cmp $28(A0), D0
|
||||
bgt.s @L8
|
||||
@L6 swap D0
|
||||
cmp $26(A0), D0
|
||||
bgt.s @L8
|
||||
@L7 bclr.s #7, $14(A0)
|
||||
bset.l D1, D2
|
||||
@L8 addq #1, D1
|
||||
move.l $1E(A0), D0
|
||||
bne.s @L0
|
||||
@return Rts
|
||||
|
||||
|
||||
NewFunc2
|
||||
tst D2
|
||||
beq.s @return
|
||||
move.l (DeviceList), D0
|
||||
beq.s @return
|
||||
@L10 move.l D0, A0
|
||||
move.l (A0), A0
|
||||
lsr #1, D2
|
||||
bcc.s @L11
|
||||
bset.s #7, $14(A0)
|
||||
tst D2
|
||||
beq.s @return
|
||||
@L11 move.l $1E(A0), D0
|
||||
bne.s @L10
|
||||
@return Rts
|
||||
|
||||
END
|
||||
|
@ -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)
|
||||
|
@ -1005,7 +1005,7 @@ selectGetGray equ 25
|
||||
|
||||
MACRO
|
||||
_ZapLinks
|
||||
DoPaletteDispatch selectZapLinks,0
|
||||
DoPaletteDispatch selectZapLinks,4
|
||||
ENDM
|
||||
|
||||
MACRO
|
||||
@ -2921,6 +2921,7 @@ _EmptyHandle OPWORD $A000+43
|
||||
_InitApplZone OPWORD $A000+44
|
||||
_SetApplLimit OPWORD $A000+45
|
||||
_BlockMove OPWORD $A000+46
|
||||
_BlockMoveData OPWORD $A000+46+$200
|
||||
|
||||
; Here are the event manager routines
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -695,6 +695,9 @@ varSize equ localRect ; size of local variables
|
||||
|
||||
move #noErr,result(a6) ; flag a successful operation,
|
||||
|
||||
move.l offscreenGWorld(a6),a0
|
||||
clr.l (a0)
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Initialize all offscreen local variables to zero.
|
||||
; If an error happens during this function, we deallocate the memory for
|
||||
@ -765,6 +768,14 @@ varSize equ localRect ; size of local variables
|
||||
cmp #32,d7 ; illegal if > 32
|
||||
bhi badPixelDepth ; exit with error
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; Treat 24-bit color as 32-bit.
|
||||
|
||||
cmp #24,d7
|
||||
bne.s @dontSetTo32
|
||||
moveq #32,d7
|
||||
@dontSetTo32
|
||||
|
||||
;-------------------------------------------------------------------------
|
||||
; If pixelDepth is not 0, don't try to align offscreen pixmap to screen
|
||||
|
||||
@ -1003,6 +1014,17 @@ createPixMap
|
||||
moveq #5,d0 ; no, cmpSize = 5
|
||||
@0 move d0,pmCmpSize(a1) ; store cmpSize in pixmap
|
||||
|
||||
btst.l #$1,d3
|
||||
beq.s @skipthisnonsense
|
||||
move.l ([museDevice,a6]),a0
|
||||
move.l ([gdPMap,a0]),a0
|
||||
move.l gdMode(a0),a0
|
||||
move.l a0,offscreenCTable(a6)
|
||||
move.l ([offscreenPixMap,a6]),a1
|
||||
move.l a0,gdMode(a1)
|
||||
bra createDevice
|
||||
@skipthisnonsense
|
||||
|
||||
; Create an empty color table.
|
||||
|
||||
move #ctRec,d0 ; size of an empty color table
|
||||
@ -1025,7 +1047,7 @@ createPixMap
|
||||
|
||||
; Create a dummy inverse table (doesn't have to be a seed)
|
||||
|
||||
moveq #2,d0 ; small handle for dummy inverse table
|
||||
moveq #4,d0 ; small handle for dummy inverse table
|
||||
_NewHandle ,CLEAR ; allocate it
|
||||
bne reportError ; if Memory Manager error, report it and quit
|
||||
|
||||
@ -1149,7 +1171,7 @@ dontCloneCTab
|
||||
|
||||
; Allocate inverse table to its initial size
|
||||
|
||||
moveq #2,d0 ; initial size is 2
|
||||
moveq #4,d0 ; initial size is 2
|
||||
_NewHandle ,CLEAR ; allocate it
|
||||
bne reportError ; if Memory Manager error, report it and quit
|
||||
|
||||
@ -1393,9 +1415,9 @@ disposOffscreenHandles
|
||||
move portVersion(a0),d0 ; get portVersion
|
||||
and #cPortFlag,d0 ; check if cPortFlag set
|
||||
cmp #cPortFlag,d0 ; is it set?
|
||||
bne @0 ; if not set, don't close port
|
||||
bne.s @0 ; if not set, don't close port
|
||||
move.l (a0),-(sp) ; push pointer to port
|
||||
_ClosePort ; close it down
|
||||
_CloseCPort ; close it down
|
||||
@0
|
||||
move.l d7,a0 ; get handle to offscreen port
|
||||
_DisposHandle ; dispose it
|
||||
@ -1732,7 +1754,7 @@ dontDisposeBaseAddr
|
||||
|
||||
dontDisposeGDevice
|
||||
move.l offscreenGWorld(sp),-(sp) ; push pointer to offscreen port
|
||||
_ClosePort ; get rid of all substructures
|
||||
_CloseCPort ; get rid of all substructures
|
||||
|
||||
move.l offscreenGWorld(sp),a0 ; get pointer to grafport
|
||||
_RecoverHandle ; find handle to grafport
|
||||
|
@ -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
|
||||
|
@ -40,11 +40,7 @@ AllocCursor PROC EXPORT
|
||||
; PROCEDURE AllocCursor;
|
||||
;
|
||||
|
||||
LEA AllocCrsr,A0 ;get default cursor routine
|
||||
MOVE.L JAllocCrsr,D0 ;has vector been initialized?
|
||||
BEQ.S @0 ;=>no, use default routine
|
||||
MOVE.L D0,A0 ;else use routine in vector
|
||||
@0 JMP (A0) ;and call it
|
||||
JMP AllocCrsr
|
||||
|
||||
|
||||
InitCursor PROC EXPORT
|
||||
@ -55,8 +51,8 @@ InitCursor PROC EXPORT
|
||||
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
||||
PEA ARROW(A0) ;PUSH ADDR OF ARROW
|
||||
_SetCursor ;INSTALL ARROW CURSOR
|
||||
MOVE.L JInitCrsr,A0 ;get lo mem pointer
|
||||
JMP (A0) ;and call it
|
||||
IMPORT _InitCursor
|
||||
JMP _InitCursor
|
||||
|
||||
|
||||
|
||||
@ -70,8 +66,8 @@ SetCursor PROC EXPORT
|
||||
MOVE #16,-(SP) ;HEIGHT:=16
|
||||
PEA DATA(A0) ;PUSH ADDR OF DATA
|
||||
PEA MASK(A0) ;PUSH ADDR OF MASK
|
||||
MOVE.L JSetCrsr,A0 ;get lo mem vector
|
||||
JSR (A0) ;call vector
|
||||
IMPORT _SetCursor
|
||||
JSR _SetCursor
|
||||
MOVE.L (SP)+,(SP) ;strip param
|
||||
RTS ;and return
|
||||
|
||||
@ -92,8 +88,8 @@ SetCCursor PROC EXPORT
|
||||
; _SetCursor ; and set it the old way
|
||||
|
||||
MOVE.L 4(SP),-(SP) ; Push handle to color cursor
|
||||
MOVE.L JSetCCrsr,A0 ; get lo mem vector
|
||||
JSR (A0) ; call vector (but don't call him hector)
|
||||
IMPORT _SetCCursor
|
||||
JSR _SetCCursor
|
||||
; _ShowCursor ; balance is a virtue
|
||||
MOVE.L (SP)+,(SP) ; strip param
|
||||
RTS ; and return
|
||||
@ -107,8 +103,8 @@ HideCursor PROC EXPORT
|
||||
;
|
||||
; ALL REGS PRESERVED.
|
||||
;
|
||||
MOVE.L JHideCursor,-(SP) ;get lo mem vector
|
||||
RTS ;and call it
|
||||
IMPORT _HideCursor
|
||||
JMP _HideCursor
|
||||
|
||||
|
||||
|
||||
@ -119,36 +115,8 @@ ShowCursor PROC EXPORT
|
||||
;
|
||||
; ALL REGS PRESERVED.
|
||||
;
|
||||
MOVE.L JShowCursor,-(SP) ;get lo mem vector
|
||||
RTS ;and call it
|
||||
|
||||
|
||||
|
||||
ShieldCursor PROC EXPORT
|
||||
;---------------------------------------------------------
|
||||
;
|
||||
; PROCEDURE ShieldCursor(shieldRect: Rect; offset: Point);
|
||||
;
|
||||
; ALL REGS PRESERVED.
|
||||
;
|
||||
MOVEM.L D0-D3/A0-A1,-(SP) ;SAVE REGS
|
||||
MOVE.L 32(SP),A0 ;POINT TO SHIELDRECT
|
||||
MOVEM.W (A0)+,D0/D1/D2/D3 ;GET TOP ... RIGHT
|
||||
LEA 28(SP),A1
|
||||
SUB (A1),D0 ;TOP - OFFSET.V
|
||||
SUB (A1)+,D2 ;BOTTOM - OFFSET.V
|
||||
SUB (A1),D1 ;LEFT - OFFSET.H
|
||||
SUB (A1),D3 ;RIGHT - OFFSET.H
|
||||
MOVE D1,-(SP) ;PUSH GLOBAL LEFT
|
||||
MOVE D0,-(SP) ;PUSH GLOBAL TOP
|
||||
MOVE D3,-(SP) ;PUSH GLOBAL RIGHT
|
||||
MOVE D2,-(SP) ;PUSH GLOBAL BOTTOM
|
||||
MOVE.L JShieldCursor,A0 ;get lo mem vector
|
||||
JSR (A0) ;and call it
|
||||
MOVEM.L (SP)+,D0-D3/A0-A1 ;RESTORE REGS
|
||||
MOVE.L (SP)+,(SP)
|
||||
MOVE.L (SP)+,(SP) ;STRIP 8 BYTES
|
||||
RTS ;AND RETURN
|
||||
IMPORT _ShowCursor
|
||||
JMP _ShowCursor
|
||||
|
||||
|
||||
|
||||
@ -159,10 +127,8 @@ ObscureCursor PROC EXPORT
|
||||
;
|
||||
; Hide the cursor image until the next time the mouse moves.
|
||||
;
|
||||
MOVE.L JCrsrObscure,A0 ;get lo mem vector
|
||||
JMP (A0) ;and call it
|
||||
|
||||
|
||||
IMPORT _ObscureCursor
|
||||
JMP _ObscureCursor
|
||||
|
||||
|
||||
ENDPROC
|
||||
|
@ -172,7 +172,7 @@ plttUpdates Equ $0002 ; value passed to SetPalette [short] AWC.PB457
|
||||
;ctReserveBit EQU 6
|
||||
;ctReserveVal EQU $4000
|
||||
|
||||
PMgrVersNum EQU $0202 ; Version number (VVss: version subversion)
|
||||
PMgrVersNum EQU $0203 ; Version number (VVss: version subversion)
|
||||
;-----------------------------------------------------------
|
||||
; Let's talk about PMgrVersNum --
|
||||
;
|
||||
@ -228,6 +228,46 @@ PMgrVersNum EQU $0202 ; Version number (VVss: version subversion)
|
||||
; GetNewCWindow which is patched in PatchIIROM.a
|
||||
|
||||
|
||||
FlushPalettes PROC EXPORT ; THIEVED FROM THE MEMORY MGR
|
||||
;-----------------------------------------------------------------------
|
||||
; Call DisposePalette for all palettes in the app heap.
|
||||
;
|
||||
; Registers: D0-D2/A0-A1
|
||||
; Called by vIAZInit.
|
||||
;----------------------------------------------------------------------
|
||||
IMPORT AppZoneAddr
|
||||
|
||||
MOVEM.L A2-A3/D3,-(SP) ; save work registers
|
||||
MOVE.L PMgrHandle,A2 ; get paletteMgr handle
|
||||
CMP.L MinusOne,A2 ; is it there?
|
||||
BEQ.S @DONE ; => no, just return
|
||||
MOVE.L (A2),A1 ; point to data structure
|
||||
MOVE.L PListHandle(A1),A0 ; get handle to palette list
|
||||
_HLock ; and lock it down
|
||||
MOVE.L (A0),A3 ; point to palette list
|
||||
|
||||
Move APalettes(A1),D3 ; get number of active handles
|
||||
Beq.s @NoPals ; no friends => go home
|
||||
Add FreeSpaces(A1),D3 ; calculate total number of entries
|
||||
BRA.S @FindEnd ; => check for no entries
|
||||
|
||||
@FindLoop Move.L PaletteRef(A3),D1 ; get first entry
|
||||
BEQ.S @FindNext ; => no palette in entry
|
||||
MOVE.L D1,D0 ; and get for routine
|
||||
JSR AppZoneAddr ; in application area (or zero)? <SM30 BT>
|
||||
BNE.S @FindNext ; => not in app heap
|
||||
MOVE.L D1,-(SP) ; push palette handle
|
||||
DC.W $AA93 ; _DisposePalette ; and dispose it in place
|
||||
@FindNext AddQ #PLstEntrySz,A3 ; bump to the next entry
|
||||
@FindEnd DBra D3,@FindLoop ; repeat for all spaces
|
||||
|
||||
@NoPals MOVE.L (A2),A1 ; point to palette stuff
|
||||
MOVE.L PListHandle(A1),A0 ; get handle to palette list
|
||||
_HUnlock ; and unlock it
|
||||
|
||||
@DONE MOVEM.L (SP)+,A2-A3/D3 ; restore work registers
|
||||
RTS
|
||||
|
||||
;---------------------------------------------------
|
||||
;
|
||||
; PROCEDURE ActivatePalette(dstWindow: WindowPtr); INLINE $AA94;
|
||||
@ -584,14 +624,8 @@ gLoopEnd DBRA D3,gLoop ; loop for all devices <dvb5>
|
||||
; return Z-flag Clear if the process mgr is here (BNE ProcMgrTrue)
|
||||
|
||||
CheckForProcessMgr PROC EXPORT
|
||||
MOVE.L #'os ',D0 ; type of question
|
||||
_Gestalt
|
||||
TST D0 ; OSErr from Gestalt?
|
||||
BEQ.S @a ; No=>test result
|
||||
SUBA A0,A0 ; Yes=>assume there's no procMgr
|
||||
@a
|
||||
MOVE.L A0,D0
|
||||
BTST #gestaltLaunchControl,D0 ; clear the Z-flag if procmgr here
|
||||
MOVE.L ExpandMem,A0
|
||||
TST $128(A0)
|
||||
RTS
|
||||
|
||||
;---------------------------------------------------
|
||||
@ -624,7 +658,7 @@ linkSize DS.B 0 ; linky number
|
||||
|
||||
movem.l a0-a2/d0-d2,-(sp) ; Those pesky c routines <mc8>
|
||||
sub.l a0,a0 ; Pass the current process (0)
|
||||
move.w #12,d0 ; _TrashProcess
|
||||
moveq #12,d0 ; _TrashProcess
|
||||
;_FigmentDispatch ; let everyone know this stuff is gone
|
||||
dc.w $A0A4
|
||||
movem.l (sp)+,a0-a2/d0-d2 ; Restore em
|
||||
@ -660,7 +694,7 @@ linkSize DS.B 0 ; linky number
|
||||
PEA inFront(A6)
|
||||
_SameProcess ; are we the front process?
|
||||
ADDQ #2,SP ; OSErr leaves inFront true from above
|
||||
TST inFront(A6)
|
||||
TST.B inFront(A6)
|
||||
BEQ.S @doNothing
|
||||
@front
|
||||
|
||||
@ -1805,8 +1839,9 @@ linkSize DS.B 0 ;linky number
|
||||
MOVE.L (A2),A3 ; A3->gDevice
|
||||
TST gdType(A3) ; a clut device? <dvb5>
|
||||
BNE.S GoHome ; No=> go home w/false
|
||||
TST gdFlags(A3) ; Device active?
|
||||
BPL.S GoHome ; No=> ditto
|
||||
MOVE $14(A3),D0
|
||||
AND #$8010,D0
|
||||
BEQ.S GoHome ; No=> ditto
|
||||
SUBQ #4,SP ; space for result <dvb5>
|
||||
MOVE.L A2,-(SP) ; push gDevice handle <dvb5>
|
||||
JSR GetClut ; get the appropriate default clut <dvb5>
|
||||
@ -2505,8 +2540,9 @@ FoundAPltt Move.L A2,srcPalette(A6) ; save it so we can unlock it AWC.PB520
|
||||
BEQ.s @a ; is it a clut device? <dvb12>
|
||||
SUBQ #1,D1 ; fixed type? <dvb12>
|
||||
BNE.S UnlockPltt ; no => we're almost done <dvb3>
|
||||
@a TST gdFlags(A0) ; is it active?
|
||||
BPL.S UnlockPltt ; no => ditto
|
||||
@a MOVE $14(A3),D0
|
||||
AND #$8010,D0
|
||||
BEQ.S UnlockPltt
|
||||
Move ciUsage(A3),D1 ; get flags
|
||||
MoveQ #0,D0 ; clear high word
|
||||
Move srcEntry(A6),D0 ; set D0 in case it is an explicit index
|
||||
@ -3152,8 +3188,9 @@ SetDev
|
||||
Move.L (A0),A0 ; dereference it
|
||||
TST gdType(A0) ; is it CLUT type (zero)? dvb1
|
||||
BNE GoHome ; No => do nothing
|
||||
TST gdFlags(A0) ; is it active
|
||||
BPL GoHome ; No=>go home
|
||||
MOVE $14(A0),D0
|
||||
AND #$8010,D0
|
||||
BEQ GoHome ; No=>go home
|
||||
Move.L gdPMap(A0),A0 ; get handle to pixmap
|
||||
Move.L (A0),A0 ; dereference pixmap
|
||||
Move.L pmTable(A0),A0 ; get handle to CTab
|
||||
@ -4542,66 +4579,7 @@ ReleaseList PROC EXPORT
|
||||
;
|
||||
FindModeID FUNC Export
|
||||
|
||||
WITH SpBlock,VPBlock
|
||||
|
||||
FMVars RECORD {A6Link},Decrement
|
||||
result DS.B 2 ; integer result
|
||||
gd DS.B 4 ; input: GDevice
|
||||
depth DS.B 2 ; input: depth
|
||||
return DS.B 4 ; return address
|
||||
A6Link DS.B 4 ; link
|
||||
spBlk DS.B spBlockSize ; slot parameter block
|
||||
vpPtr DS.B 4 ; pointer to vidParams block
|
||||
linkSize DS.B 0 ; size of record
|
||||
ENDR
|
||||
|
||||
WITH FMVars
|
||||
|
||||
LINK A6,#linkSize
|
||||
MOVEM.L A2/D3,-(SP) ; save 'em
|
||||
|
||||
CLR result(A6) ; default to failure!
|
||||
|
||||
MOVE.L gd(A6),A0 ; A0 = gDevice handle
|
||||
MOVE.L (A0),A1 ; A1->gDevice
|
||||
|
||||
MOVE.L UTableBase,A0 ; A0->unit table
|
||||
MOVE gdRefNum(A1),D0 ; D0 = refnum
|
||||
NEG D0
|
||||
SUBQ #1,D0
|
||||
MOVE.L (A0,D0.W*4),A1 ; A1 = AuxDCEHandle for gDevice
|
||||
MOVE.L (A1),A1 ; A1 = AuxDCEPtr for gDevice
|
||||
LEA spBlk(A6),A0 ; A0 -> spBlock
|
||||
MOVE.B dCtlSlot(A1),spSlot(A0) ; stash gDevice slot
|
||||
CLR.B spID(A0) ; clear the ID
|
||||
MOVE #catDisplay,spCategory(A0) ; category: display
|
||||
MOVE #typVideo,spCType(A0)
|
||||
MOVE #drSwApple,spDrvrSW(A0) ; Appleª style driver
|
||||
MOVE.B #1,spTBMask(A0)
|
||||
_sNextTypeSRsrc
|
||||
BNE.S @goHome ; failure
|
||||
|
||||
MOVE.L spsPointer(A0),A2 ; keep saving it here
|
||||
MOVE #127,D3 ; the 0th mode we'll look for
|
||||
|
||||
@depthScan
|
||||
ADDQ #1,D3 ; bump to next mode
|
||||
MOVE.B D3,spID(A0) ; look for the next mode
|
||||
MOVE.L A2,spsPointer(A0) ; sFindStruct wipes out each time
|
||||
_sFindStruct ; look for it
|
||||
BNE.S @goHome ; failure
|
||||
MOVE.B #mVidParams,spID(A0) ; now we look for video params
|
||||
_sGetBlock
|
||||
BNE.S @goHome ; failure
|
||||
MOVE.L spResult(A0),A1 ; A1->vidParam block, finally
|
||||
MOVE vpPixelSize(A1),D0 ; D0 = depth for this description
|
||||
CMP depth(A6),D0 ; the one we want?
|
||||
BNE.S @depthScan ; scan 'til found, or slot error
|
||||
|
||||
MOVE D3,result(A6)
|
||||
@goHome MOVEM.L (SP)+,A2/D3
|
||||
UNLK A6
|
||||
RTD #result-return-4
|
||||
RTS
|
||||
|
||||
|
||||
|
||||
@ -4625,6 +4603,7 @@ A6Link DS.B 4 ; link
|
||||
r DS.B 4 ; regionhandle
|
||||
oldPort DS.B 4 ; previous port
|
||||
myRect DS.B 8 ; rectangle for little black corners
|
||||
moreStuff DS.B 10 ; not sure what for?
|
||||
linkSize DS.B 0 ; size of record
|
||||
ENDR
|
||||
|
||||
@ -4634,10 +4613,31 @@ linkSize DS.B 0 ; size of record
|
||||
MOVEM.L A2-A3/D3-D5,-(SP) ; <6>
|
||||
|
||||
MOVE #paramErr,result(A6) ; default to failure!
|
||||
MOVE.B #1,myRect+6(A6)
|
||||
MOVEQ #0,D0
|
||||
MOVE depth(A6),D0
|
||||
MOVE.L D0,r(A6)
|
||||
|
||||
MOVE.L gd(A6),A0 ; A0 = gDevice handle
|
||||
MOVE.L (A0),A1 ; A1->gDevice
|
||||
CLR -(SP)
|
||||
MOVE.L gd(A6),-(SP)
|
||||
CLR.L -(SP)
|
||||
MOVE.L r(A6),-(SP)
|
||||
PEA oldPort(A6)
|
||||
CLR.L -(SP)
|
||||
PEA myRect+7(A6)
|
||||
|
||||
MOVE #$C12,D0 ; _DMRemoveDisplay
|
||||
DC.W $ABEB
|
||||
|
||||
TST (SP)+
|
||||
BNE.S @goHome
|
||||
|
||||
MOVE.L oldPort(A6),D0
|
||||
BTST.L #1,D0
|
||||
BNE.S @goHome
|
||||
|
||||
MOVE.L gd(A6),A1
|
||||
MOVE.L (A1),A1
|
||||
MOVE whichFlags(A6),D0 ; D0 = mask of flags to change
|
||||
ANDI #whichMask,D0 ; D0 = only the ones we let them change
|
||||
MOVE D0,D1 ; D1 = mask of flags to change
|
||||
@ -4646,137 +4646,21 @@ linkSize DS.B 0 ; size of record
|
||||
AND gdFlags(A1),D0 ; D0 = all the unchanged gdFlags
|
||||
OR D1,D0 ; D0 = new gdFlags word
|
||||
MOVE D0,gdFlags(A1) ; Put back into gDevice
|
||||
MOVE gdRefNum(A1),D3 ; D3 = refnum, for later use
|
||||
|
||||
MOVE depth(A6),D4 ; get the depth or mode
|
||||
TST.B D4 ; see which it is
|
||||
BMI.S @gotMode
|
||||
|
||||
SUBQ #2,SP
|
||||
CLR -(SP)
|
||||
MOVE.L gd(A6),-(SP)
|
||||
MOVE D4,-(SP)
|
||||
Import FindModeID
|
||||
BSR FindModeID ; find the mode number, if it exists
|
||||
MOVE (SP)+,D4 ; did we find one?
|
||||
BEQ @goHome
|
||||
|
||||
@gotMode Movea.l gd(A6),A2 ; Get GDHandle into A2.
|
||||
Movea.l (A2),A2 ; Get a GDPtr into A2.
|
||||
Btst #mainScreen,gdFlags(A2) ; If weÕre not on the menubar screen,
|
||||
Beq.s @NotMain1 ; then just keep going.
|
||||
Move.w theMenu,D5 ; Get the currently hilited menuID.
|
||||
Clr.w -(Sp) ; And unhilite it.
|
||||
_HiliteMenu
|
||||
@NotMain1
|
||||
|
||||
; Originally, DVB wasnÕt getting the current port until corner-rounding code
|
||||
; was about to be executed (below). That seemed to cause port problems, so
|
||||
; I move the port getting/setting code to here (which is the way Monitors
|
||||
; does it).
|
||||
;
|
||||
; -- jmp --
|
||||
|
||||
PEA oldPort(A6) ; Save the current port
|
||||
_GetPort
|
||||
MOVE.L WMgrPort,-(SP) ; We want to use the WMgrPort
|
||||
_SetPort
|
||||
|
||||
MOVE D3,-(SP) ; push refnum
|
||||
EXT.L D4
|
||||
MOVE.L D4,-(SP) ; push new gdev mode
|
||||
MOVE.L gd(A6),-(SP) ; push the handle
|
||||
_InitGDevice
|
||||
|
||||
Btst #mainScreen,gdFlags(A2) ; If weÕre not on the menubar screen,
|
||||
Beq.s @NotMain2 ; then just keep going.
|
||||
Move.w D5,-(Sp) ; Get the hilite state.
|
||||
_HiliteMenu ; Restore it.
|
||||
_DrawMenuBar ; Draw the MenuBar.
|
||||
@NotMain2
|
||||
|
||||
CLR.L -(SP) ; Activate the front palette
|
||||
_FrontWindow ; before drawing anything.
|
||||
_ActivatePalette
|
||||
|
||||
; In Monitors (the cdev) this is the point in the code where
|
||||
; the PortList is walked to update all the CGrafPorts to the
|
||||
; new depth. We donÕt need to do that here because InitGDevice
|
||||
; does that for us with Save/ResoreFore and Save/RestoreBack
|
||||
; calls.
|
||||
;
|
||||
; -- jmp --
|
||||
|
||||
; If the LayerManger is around, we need to start at the root, otherwise
|
||||
; we just use FrontWindow. Originally, DVB had PaintOne instead of
|
||||
; PaintBehind here but VL said that was wrong. Also, Monitors uses the
|
||||
; PaintOne/PaintBehind method instead of PaintOne/PaintOne method.
|
||||
;
|
||||
; -- jmp --
|
||||
|
||||
If HasLayers Then
|
||||
_RedrawAll ; CheckUpdate on all layers <42>
|
||||
Else
|
||||
SUBQ #4,SP
|
||||
_NewRgn
|
||||
MOVE.L (SP),r(A6) ; get a fresh region, LEAVE ON STACK
|
||||
|
||||
MOVE.L gd(A6),A0 ; A0 = gd handle
|
||||
MOVE.L (A0),A0 ; A0->gdevice
|
||||
PEA gdRect(A0) ; push rectangle to RectRgn
|
||||
_RectRgn ; r is now our region
|
||||
|
||||
CLR.L -(SP)
|
||||
MOVE.L r(A6),-(SP)
|
||||
_PaintOne
|
||||
PEA r(A6)
|
||||
CLR.L -(SP)
|
||||
CLR.L -(SP)
|
||||
|
||||
SUBQ #4,SP
|
||||
_FrontWindow
|
||||
MOVE.L r(A6),-(SP)
|
||||
_PaintBehind
|
||||
MOVE #$A11,D0 ; _DMEnableDisplay
|
||||
DC.W $ABEB
|
||||
|
||||
MOVE.L r(A6),-(SP) ; Done with region
|
||||
_DisposRgn
|
||||
Endif
|
||||
|
||||
CLR.L myRect+topLeft(A6) ; Set the empty rect
|
||||
CLR.L myRect+botRight(A6)
|
||||
MOVE.L deviceList,A2 ; A2 = 1st GDHandle
|
||||
@dloop MOVE.L (A2),A2 ; A2 -> GDevice
|
||||
BTST #screenActive,gdFlags(A2) ; bit 15 in upper byte of word
|
||||
BEQ.S @dloopEnd ; Inactive screen?
|
||||
PEA gdRect(A2)
|
||||
PEA myRect(A6)
|
||||
MOVE.L (SP),-(SP)
|
||||
_UnionRect
|
||||
@dloopEnd MOVE.L gdNextGD(A2),A2
|
||||
MOVE.L A2,D0
|
||||
BNE.S @dloop
|
||||
MOVE (SP)+,result(A6)
|
||||
|
||||
PEA myRect(A6) ; Set a nice big clip
|
||||
_ClipRect
|
||||
PEA myRect(A6)
|
||||
MOVE.L #$FFFDFFFD,-(SP) ; outset by three
|
||||
_InsetRect
|
||||
MOVE.L #$00030003,-(SP) ; pensize is three
|
||||
_PenSize
|
||||
PEA myRect(A6)
|
||||
MOVE.L #$00160016,-(SP) ; and a radius for nice rounding
|
||||
_FrameRoundRect ; and black out the corners
|
||||
|
||||
_PenNormal
|
||||
|
||||
MOVE.L oldPort(A6),-(SP) ; restore the previous port
|
||||
_SetPort
|
||||
|
||||
MOVE.L gd(A6),A0
|
||||
MOVE.L (A0),A0
|
||||
BTST #mainScreen,gdFlags(A0) ; (mainScreen=11, in upper byte)
|
||||
BEQ.S @notMain
|
||||
_DrawMenuBar
|
||||
@notMain
|
||||
CLR result(A6) ; success
|
||||
@goHome
|
||||
MOVEM.L (SP)+,A2/D3-D5
|
||||
MOVEM.L (SP)+,A2-A3/D3-D5
|
||||
UNLK A6
|
||||
RTD #result-return-4
|
||||
|
||||
@ -4790,13 +4674,15 @@ HasDepth FUNC EXPORT
|
||||
whichMask EQU $FFFE ; the lowest bit is settable, else fail
|
||||
|
||||
SDVars RECORD {A6Link},DECREMENT
|
||||
result DS.B 2 ; boolean result
|
||||
gd DS.B 4 ; input: GDevice to set
|
||||
depth DS.B 2 ; input: depth to set to
|
||||
whichFlags DS.B 2 ; which GDFlags to affect
|
||||
flags DS.B 2 ; input: various flags
|
||||
return DS.B 4 ; return address on stack
|
||||
result DS.B 2 ; 18 $12 boolean result
|
||||
gd DS.B 4 ; 14 $E input: GDevice to set
|
||||
depth DS.B 2 ; 12 $C input: depth to set to
|
||||
whichFlags DS.B 2 ; 10 $A which GDFlags to affect
|
||||
flags DS.B 2 ; 8 $8 input: various flags
|
||||
return DS.B 4 ; 4 $4 return address on stack
|
||||
A6Link DS.B 4 ; link
|
||||
myDepth DS.B 4
|
||||
moreStuff DS.B 24
|
||||
linkSize DS.B 0 ; size of record
|
||||
ENDR
|
||||
|
||||
@ -4809,13 +4695,43 @@ linkSize DS.B 0 ; size of record
|
||||
MOVE whichFlags(A6),D0 ; D0 = mask of flags to change
|
||||
AND flags(A6),D0 ; D0 = new flags to set
|
||||
AND #whichMask,D0 ; D0 = all the bits we can't change
|
||||
BNE.S @goHome ; User tried to set bits we don't yet do!
|
||||
BNE @goHome ; User tried to set bits we don't yet do!
|
||||
|
||||
MOVEQ #0,D0
|
||||
MOVE depth(A6),D0
|
||||
MOVE.L D0,myDepth(A6)
|
||||
|
||||
CLR moreStuff+0(A6)
|
||||
CLR.L moreStuff+2(A6)
|
||||
CLR moreStuff+6(A6)
|
||||
CLR.L moreStuff+8(A6)
|
||||
CLR.L moreStuff+12(A6)
|
||||
|
||||
CLR -(SP)
|
||||
MOVE.L gd(A6), -(SP)
|
||||
PEA moreStuff(A6)
|
||||
MOVE.L myDepth(A6), -(SP)
|
||||
PEA -$C(A6)
|
||||
CLR.L -(SP)
|
||||
|
||||
MOVE #$AF3,D0 ; unknown _DisplayDispatch selector
|
||||
DC.W $ABEB
|
||||
|
||||
TST (SP)+
|
||||
BNE.B @goHome
|
||||
|
||||
MOVEQ.L #$7F, D0
|
||||
MOVEQ.L #0, D1
|
||||
MOVE depth(A6), D1
|
||||
CMP.L D1, D0
|
||||
BLT.B @whaaa
|
||||
|
||||
MOVE $C(A6), D0
|
||||
CMP -$C(A6), D0
|
||||
BNE.B @goHome
|
||||
|
||||
@whaaa MOVE -$1C(A6), $12(A6)
|
||||
|
||||
SUBQ #2,SP
|
||||
MOVE.L gd(A6),-(SP)
|
||||
MOVE depth(A6),-(SP)
|
||||
BSR FindModeID ; find the mode number, if it exists
|
||||
MOVE (SP)+,result(A6) ; did we find one?
|
||||
@goHome
|
||||
UNLK A6
|
||||
RTD #result-return-4
|
||||
@ -5087,6 +5003,7 @@ linkSize DS.B 0 ; size of record
|
||||
_HLock
|
||||
MOVE.L (A0),A2 ; A2->color table to check
|
||||
MOVE ctSize(A2),D3 ; D3 = last color in table
|
||||
BEQ.S @goHome
|
||||
MOVEQ #0, D5 ; initialized number of colors checked
|
||||
; MOVE D3,D0
|
||||
; ADDQ #1,D0
|
||||
@ -5108,6 +5025,9 @@ linkSize DS.B 0 ; size of record
|
||||
@next ADDQ #8,A2 ; Bump to next color
|
||||
DBRA D3,@loop ; loop through all colors
|
||||
|
||||
TST D5
|
||||
BEQ.S @goHome
|
||||
|
||||
DIVU D5,D7 ; compute average tolerance
|
||||
; DIVU colorCount(A6),D7 ; compute average tolerance
|
||||
CMP maxAveTol(A6),D7 ; in range?
|
||||
|
@ -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 ([$FC4]) ; _GlobalToLocal?
|
||||
|
||||
add #4,d0
|
||||
move.l d0,-(sp)
|
||||
jsr ([$FC4]) ; _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
|
||||
;------------------------------------------------------------------
|
||||
@ -4316,7 +4245,7 @@ MORE1
|
||||
MOVE.L A3,A0 ;PTR TO FIRST byte of src
|
||||
move.l d5,d0 ;get rowbytes in d0
|
||||
|
||||
_BlockMove ;copy from there to here
|
||||
_BlockMoveData ;copy from there to here
|
||||
;assumes here is a 24 bit address
|
||||
|
||||
moveq #false32b,d0 ;switch back before calling PutPicProc <BAL 02Feb90>
|
||||
@ -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)
|
@ -1389,7 +1389,7 @@ GETPIXEL
|
||||
MOVEQ #0,D2 ;ROUTINE = GETPIXEL
|
||||
|
||||
SHARE LINK A6,#VARSIZE ;ALLOCATE STACKFRAME
|
||||
MOVEM.L D4-D5/A2-A3,-(SP) ;SAVE WORK REGISTERS
|
||||
MOVEM.L D4-D6/A2-A3,-(SP) ;SAVE WORK REGISTERS
|
||||
MOVE.L THEGDEVICE,-(SP) ;SAVE CURRENT GRAFDEVICE
|
||||
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
||||
MOVE.L THEPORT(A0),A0 ;GET THEPORT
|
||||
@ -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'
|
||||
|
||||
|
||||
@ -4722,7 +4731,7 @@ DSTH EQU SRCH-4
|
||||
MOVE.L (A0),A0 ; get SRC pointer
|
||||
MOVE.L (A1),A1 ; get DST pointer
|
||||
MOVE.L D1,D0 ; D0 = size
|
||||
_BlockMove ; copy the data
|
||||
_BlockMoveData ; copy the data
|
||||
|
||||
DONE MOVE.L (SP)+,A0 ; get return address
|
||||
ADDQ #8,SP ; strip parameters
|
||||
|
@ -127,7 +127,7 @@ multColor EQU RGNC-2 ;byte, set if source contains nonblack/white colors
|
||||
;
|
||||
_StackAvail ;GET STACK AVAIL IN D0.L
|
||||
LSR.L #2,D0 ;CONVERT BYTES TO LONGS
|
||||
SUB.L #qdStackXtra,D0 ;SUBTRACT SLOP FACTOR <1.2> BAL
|
||||
SUB.L #$200,D0 ;SUBTRACT SLOP FACTOR <1.2> BAL
|
||||
MOVE.L D0,STACKFREE(A6) ;AND SAVE FREE LONGS ON STACK
|
||||
bpl.s @stkOK
|
||||
_stNoStack ;=>NOT ENOUGH STACK, QUIT
|
||||
|
@ -9589,32 +9589,107 @@ Scale32to16 PROC EXPORT
|
||||
; CLOBBERS A0-A1/D0-D5
|
||||
;
|
||||
|
||||
tst.b -$a5(a6)
|
||||
bne.s @different_implementation
|
||||
|
||||
lea @sexy_code,a4
|
||||
move.l a4,-$228(a6)
|
||||
|
||||
@sexy_code
|
||||
move.l a2,d2 ;get ptr to end
|
||||
sub.l a1,d2 ;sub ptr to beginning
|
||||
lsr.l #2,d2 ;get long cnt in d1
|
||||
subq #1,d2 ;make zero based
|
||||
|
||||
move.l #$7fff7fff,d3
|
||||
|
||||
@NXTSLNG
|
||||
MOVE.L (A0)+,D0 ;GET NEXT LONG OF SRC
|
||||
ror.l #8,d0
|
||||
lsr.w #3,d0
|
||||
ror.l #5,d0
|
||||
lsr.w #3,d0
|
||||
ror.l #6,d0 ;16 bit pixel in high word
|
||||
lsr.l #3,d0
|
||||
lsl.b #3,d0
|
||||
lsl #3,d0
|
||||
lsr.l #6,d0
|
||||
swap d0
|
||||
|
||||
MOVE.L (A0)+,D1 ;GET NEXT LONG OF SRC
|
||||
ror.l #8,d1
|
||||
lsr.w #3,d1
|
||||
ror.l #5,d1
|
||||
lsr.w #3,d1
|
||||
ror.l #6,d1 ;16 bit pixel in high word
|
||||
lsr.l #3,d1
|
||||
lsl.b #3,d1
|
||||
lsl #3,d1
|
||||
lsr.l #6,d1
|
||||
|
||||
swap d1 ;merge pixels
|
||||
move.w d1,d0
|
||||
and.l d3,d0
|
||||
move.l d0,(a1)+ ;write out 2 pixels
|
||||
dbra d2,@NXTSLNG ;loop for all longs in dst scanline
|
||||
RTS
|
||||
|
||||
@different_implementation
|
||||
clr.b -$2a9(a6)
|
||||
lea @sexy_code_2,a4
|
||||
move.l a4,-$228(a6)
|
||||
|
||||
@sexy_code_2
|
||||
move.l a2,d2
|
||||
sub.l a1,d2
|
||||
lsr.l #2,d2
|
||||
subq #1,d2
|
||||
moveq.l #3,d0
|
||||
and.b -$2a9(a6),d0
|
||||
move.l @data_tbl(d0.w*4),d3
|
||||
addq.b #1,-$2a9(a6)
|
||||
|
||||
@loop
|
||||
moveq.l #0,d1
|
||||
move.l (a0)+,d0
|
||||
swap d0
|
||||
add.b d3,d0
|
||||
scs.b d1
|
||||
or.b d0,d1
|
||||
lsl.l #5,d1
|
||||
swap d0
|
||||
move.b d0,d4
|
||||
lsr #8,d0
|
||||
add.b d3,d0
|
||||
scs.b d1
|
||||
or.b d0,d1
|
||||
lsl.l #5,d1
|
||||
add.b d3,d4
|
||||
scs.b d1
|
||||
or.b d4,d1
|
||||
lsr.l #3,d1
|
||||
move d1,d5
|
||||
rol.l #8,d3
|
||||
swap d5
|
||||
moveq.l #0,d1
|
||||
move.l (a0)+,d0
|
||||
swap d0
|
||||
add.b d3,d0
|
||||
scs.b d1
|
||||
or.b d0,d1
|
||||
lsl.l #5,d1
|
||||
swap d0
|
||||
move.b d0,d4
|
||||
lsr #8,d0
|
||||
add.b d3,d0
|
||||
scs.b d1
|
||||
or.b d0,d1
|
||||
lsl.l #5,d1
|
||||
add.b d3,d4
|
||||
scs.b d1
|
||||
or.b d4,d1
|
||||
lsr.l #3,d1
|
||||
move d1,d5
|
||||
move.l d5,(a1)+
|
||||
rol.l #8,d3
|
||||
dbf d2,@loop
|
||||
rts
|
||||
|
||||
@data_tbl
|
||||
dc.l $05010400
|
||||
dc.l $03070206
|
||||
dc.l $04000501
|
||||
dc.l $02060307
|
||||
|
||||
|
||||
; from QDciPatchROM.a verbatim <sm 6/9/92>stb
|
||||
|
||||
|
@ -687,6 +687,7 @@ int main(int argc, char **argv)
|
||||
my_name = patchstack[pi]->name;
|
||||
|
||||
original_size = longfrom(mod_sizeobj + 2);
|
||||
if(original_size & 1) original_size ++; /* even-align the patches -- found this bug while reversing QuickDraw */
|
||||
|
||||
if(l) fprintf(l, " File \"{RomDump}\"; Line 0; File \"{RomDump}\"; Find /Entry=¶\"%.*s¶\"/ # patch ID %d, ", *my_name, my_name+1, patchstack[pi]->clean_id);
|
||||
if(l) debug_print_about_patch(l, patchstack[pi]->data, patchstack[pi]->len);
|
||||
|
Loading…
Reference in New Issue
Block a user