home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-05-14 | 34.5 KB | 1,880 lines |
- 11-May-88 21:28:05-MDT,37118;000000000000
- Return-Path: <u-lchoqu%sunset@cs.utah.edu>
- Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Wed, 11 May 88 21:27:02 MDT
- Received: by cs.utah.edu (5.54/utah-2.0-cs)
- id AA04024; Wed, 11 May 88 21:27:26 MDT
- Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
- id AA29307; Wed, 11 May 88 21:27:18 MDT
- Date: Wed, 11 May 88 21:27:18 MDT
- From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
- Message-Id: <8805120327.AA29307@sunset.utah.edu>
- To: rthum@simtel20.arpa
- Subject: SkipFinder.asm
-
- ;SkipFinder, version 6.1
- ;
- ;Copyright 1986 Darin Adler
- ;
- ;Permission is given to distribute or modify
- ;this code for non-commercial purposes.
- ;
- ;This desk accessory installs a Finder avoider.
-
- INCLUDE SysEquX.D
- INCLUDE ToolEquX.D
- INCLUDE QuickEquX.D
- INCLUDE MacTraps.D
-
-
- ;----------
- ;SkipFinder equates
- ;----------
-
- stashed EQU $AE4 ;(a secret place to stash this stuff)
-
- FBit EQU 1 ;option bits
- HBit EQU 0
-
- ;Dialog filter equates
-
- itemHit EQU 8
- theEvent EQU 12
- theDialog EQU 16
- filtered EQU 20
-
- ;Macros
-
- MACRO LONG value =
- DC {value}>>16,{value}&$FFFF
- |
-
-
- ;----------
- ;SkipFinder desk accessory (SkipLoader)
- ;----------
-
- RESOURCE 'DRVR' 12 'SkipFinder' 32
-
- Skip
- DC.W 0 ;need nothing
- DC.W 0 ;doesn't need time
- DC.W 0 ;no events
- DC.W 0 ;no menu
-
- DC.W DoIt-Skip ;open
- DC.W Done-Skip ;prime
- DC.W Done-Skip ;control
- DC.W Done-Skip ;status
- DC.W Done-Skip ;close
-
- DoIt
- MOVE.W dCtlRefNum(A1),D3 ;get the refNum
- EOR.W #$FFFF,D3 ;convert it to a resource ID
- LSL.W #5,D3 ;adjust it
- OR.W #$C000,D3 ;make it an owned resource
-
- MOVE.L stashed,D0 ;stashed?
- BCLR #31,D0
- MOVE.L D0,A0
-
- MOVE.L SysZone,A1
- CMP.L A1,A0 ;is it already installed?
- BLO NotInAlready
- CMP.L bkLim(A1),A0
- BHS NotInAlready
-
- ADDQ.W #1,D3 ;#1 is "this is in already"
-
- SUBQ #4,SP ;room for return
- MOVE.L #'DLOG',-(SP) ;get the dialog template in here
- MOVE.W D3,-(SP)
- _GetResource
- MOVE.L (SP)+,A0 ;get the resource handle
- _HNoPurge
- MOVE.L (A0),A0 ;dereference
- MOVE.W D3,dItems(A0) ;fix itemList ID
-
- TST.L dBounds+topLeft(A0) ;if topLeft is 0,0 then center it
- BNE.S DontCenter
-
- MOVE.L (A5),A1 ;get QuickDraw globals
-
- MOVEQ #0,D0 ;set up for centering (menu bar)
- ADD.W screenBits+bounds+bottom(A1),D0 ;calculate centering info
- SUB.W dBounds+bottom(A0),D0 ;by subtracting (ignore the menu bar)
- ADD.W #20,D0
- ASR.W #1,D0 ;and shifting
-
- SWAP D0 ;move the Y coordinate to high word
-
- MOVE.W screenBits+bounds+right(A1),D0 ;do the same for X
- SUB.W dBounds+right(A0),D0
- ASR.W #1,D0
-
- PEA dBounds(A0)
- MOVE.L D0,-(SP) ;ready for an _OffsetRect
- _OffsetRect
-
- DontCenter
- SUBQ #4,SP ;reserve room for port ptr
- PEA (SP) ;push pointer
- _GetPort
-
- SUBQ #4,SP
- MOVE.W D3,-(SP) ;put on the resource ID
-
- SUBQ #4,SP ;make room
- MOVE.L #'SKIP',-(SP) ;ask for resource
- MOVE.W #1,-(SP)
- _GetIndResource
- MOVE.L (SP)+,A4 ;get resource handle
- MOVE.L (A4),A0 ;de-ref it
- MOVE.W 2(A0),D4 ;get bits
-
- CLR.L -(SP) ;allocate storage on heap
- MOVE.L #-1,-(SP) ;put window on top
- _GetNewDialog ;get the dialog
-
- MOVE.L (SP),-(SP)
- MOVE.W #2,-(SP)
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
- MOVE.L scratch20+2,A2 ;get the handle for control #2
-
- MOVE.L (SP),-(SP)
- MOVE.W #3,-(SP)
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
- MOVE.L scratch20+2,A3 ;get the handle for control #3
-
- MOVEQ #0,D0
- BTST #FBit,D4 ;test F bit
- BEQ.S @1
- ADDQ.W #1,D0
- @1
- MOVE.L A2,-(SP)
- MOVE.W D0,-(SP)
- _SetCtlValue
-
- MOVEQ #0,D0
- BTST #HBit,D4 ;test H bit
- BEQ.S @2
- ADDQ.W #1,D0
- @2
- MOVE.L A3,-(SP)
- MOVE.W D0,-(SP)
- _SetCtlValue
-
- BTST #7,stashed
- BEQ.S ModalDialogLoop
-
- MOVE.L A2,-(SP)
- MOVE.W #255,-(SP)
- _HiliteControl
-
- MOVE.L A3,-(SP)
- MOVE.W #255,-(SP)
- _HiliteControl
-
- ModalDialogLoop
- MOVE.L (SP),-(SP)
- _ShowWindow
-
- SUBQ #2,SP
- PEA FilterProc
- PEA 4(SP) ;pass an address for the item number
- _ModalDialog
- MOVE.W (SP)+,D0 ;get the item number
-
- CMP.W #2,D0 ;the F check box
- BNE.S NotF
-
- MOVEQ #0,D0
- BCHG #FBit,D4 ;flip F bit
- BNE.S @1
- ADDQ.W #1,D0
- @1
- MOVE.L A2,-(SPj
- MOVE.W D0,-(SP)
- _SetCtlValue
- BRA.S ModalDialogLoop
- NotF
-
- CMP.W #3,D0 ;the H check box
- BNE.S NotH
-
- MOVEQ #0,D0
- BCHG #HBit,D4 ;flip H bit
- BNE.S @1
- ADDQ.W #1,D0
- @1
- MOVE.L A3,-(SP)
- MOVE.W D0,-(SP)
- _SetCtlValue
- BRA.S ModalDialogLoop
- NotH
-
- _DisposDialog ;get rid of the dialog
-
- SUBQ #4,SP ;room for return
- MOVE.L #'DLOG',-(SP) ;get the dialog template in here
- MOVE.W D3,-(SP)
- _GetResource
- MOVE.L (SP)+,A0 ;get the resource handle
- _HPurge
-
- MOVE.L (A4),A0 ;de-ref the handle
- CMP.W 2(A0),D4 ;changed?
- BEQ.S NoChange
- MOVE.W D4,2(A0)
- MOVE.L A4,-(SP)
- _ChangedResource
- MOVE.L A4,-(SP)
- _WriteResource
- NoChange
- MOVE.L A4,A0
- _HPurge
-
- _SetPort
-
- Done
- MOVEQ #0,D0 ;return no error
- RTS
-
- ;----------
- ;FilterProc - fancy filtering for the SkipFinder dialog
- ;----------
-
- FilterProc
- LINK A6,#0
-
- CLR.B filtered(A6)
-
- MOVE.L theEvent(A6),A0
-
- CMP.W #updatEvt,(A0)
- BNE.S NotUpdateEvent
-
- MOVE.L theDialog(A6),D0
-
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
-
- _BeginUpdate
- _DrawDialog
- _SetPort
-
- MOVE.W #1,-(SP) ;item 1 is always default
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
-
- LEA scratch8,A0 ;rectangle
- MOVEQ #3,D0 ;width of outline
- MOVEQ #16,D1 ;rounding factor of outline
- MOVEQ #-4,D2 ;inset of outline
-
- MOVE.L A0,-(SP) ;FrameRoundRect
- MOVE.W D1,-(SP)
- MOVE.W D1,-(SP)
-
- MOVE.L A0,-(SP) ;InsetRect
- MOVE.W D2,-(SP)
- MOVE.W D2,-(SP)
-
- MOVE.W D0,-(SP) ;PenSize
- MOVE.W D0,-(SP)
-
- _PenSize
- _InsetRect
- _FrameRoundRect
-
- _EndUpdate
-
- MOVE.L theEvent(A6),A0
- CLR.W (A0)
- BRA.S DoneFilterProc
-
- NotUpdateEvent
- CMP.W #keyDwnEvt,(A0)
- BNE.S DoneFilterProc
-
- CMP.B #3,evtMessage+3(A0)
- BEQ.S HitButton
-
- CMP.B #13,evtMessage+3(A0)
- BNE.S DoneFilterProc
- HitButton
- MOVE.L theDialog(A6),-(SP)
- MOVE.W #1,-(SP)
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
-
- MOVE.L scratch20+2,-(SP)
- MOVE.W #1,-(SP)
- _HiliteControl
-
- MOVE.W #8,A0
- _Delay
-
- MOVE.L scratch20+2,-(SP)
- CLR.W -(SP)
- _HiliteControl ;UnHilite the control
-
- MOVE.L itemHit(A6),A0
- MOVE.W #1,(A0)
- ADDQ.B #1,filtered(A6)
-
- DoneFilterProc
- UNLK A6
- MOVE.L (SP)+,A0 ;get return address
- ADD #12,SP ;pop off parameters
- JMP (A0)
-
-
- ;----------
- ;NotInAlready - installs SkipFinder since it is not in yet
- ;----------
-
- OpenResFile EQU $197 ;_OpenResFile trap number
-
- NotInAlready
- MOVE.L #PatchEnd-PatchStart+4,D1 ;figure a size for the handle
-
- MOVE.L D1,D0
- _NewPtr ,SYS
-
- MOVE.L A0,stashed
-
- MOVE.L A0,A1
-
- MOVE.W #OpenResFile,D0 ;get the old trap address
- _GetTrapAddress
- MOVE.L A0,(A1)+ ;put this pointer on there
-
- LEA PatchStart,A0 ;into the new handle
- MOVE.L #PatchEnd-PatchStart,D0 ;figure a size for the patch
- _BlockMove
-
- MOVE.L A1,A0 ;set the new trap address
- MOVE.W #OpenResFile,D0 ;for _InitApplZone
- _SetTrapAddress
-
- BRA Done ;that's all folks
-
-
- ;----------
- ;PatchStart - this (until PatchEnd) sits on the system heap
- ;----------
-
- PatchStart
- MOVE.L (A7),A0
- CMP.L ROMBase,A0 ;are we in ROM now?
- BHS.S SkipTheFinder
-
- DontSkip
- MOVE.L PatchStart-4,-(SP) ;old OpenResFile address
- RTS
-
- SkipTheFinder
- LEA CurApName,A0
- CMP.L 4(A7),A0
- BNE.S DontSkip ;Launch?
-
- MOVEQ #0,D0
- LEA FinderName,A0
- LEA CurApName,A1
- MOVE.B (A0)+,D0
- SWAP D0
- MOVE.B (A1)+,D0
- _CmpString ;Finder launch?
- BNE.S DontSkip
-
- BCLR #7,stashed ;is this a special skip?
- BNE.S DontSkip
-
- BTST #2,$17B ;This is the Option key!
- BNE.S DontSkip
-
- SUBQ #4,SP ;make room
- MOVE.L #'SKIP',-(SP) ;ask for resource
- MOVE.W #1,-(SP)
- _GetIndResource
- MOVE.L (SP)+,D0 ;get the result
- BEQ.S DontSkip
-
- TST.W ResErr
- BNE.S DontSkip ;uh oh!
-
- MOVE.L D0,A0
- MOVE.L (A0),D0 ;dereference it
- AND.L Lo3Bytes,D0
- MOVE.L D0,A0
- JMP (A0)
- PatchEnd
-
-
- ;-------------------------------------------------------------------------
-
-
- RESOURCE 'SKIP' 65536-16000 '' 0
-
- INCLUDE Corvus:MDS:.D:FSEqu.D
- INCLUDE Corvus:MDS:.Txt:PackMacs.Txt
-
- ;----------
- ;New Equates - not yet in equate files
- ;----------
-
- ROM85 EQU $28E
- FSFCBLen EQU $3F6
-
- .TRAP _HOpen $A200+0
- .TRAP _HGetVInfo $A200+7
- .TRAP _HCreate $A200+8
- .TRAP _HDelete $A200+9
- .TRAP _HOpenRF $A200+10
- .TRAP _HRename $A200+11
- .TRAP _HGetFileInfo $A200+12
- .TRAP _HSetFileInfo $A200+13
- .TRAP _AllocContig $A200+16
- .TRAP _SetPEOF $A200+18
- .TRAP _HGetVol $A200+20
- .TRAP _HSetVol $A200+21
- .TRAP _HSetFLock $A200+65
- .TRAP _HRstFLock $A200+66
- .TRAP _HFSDispatch $A200+96
- .TRAP _MoveHHi $A000+100
-
- MACRO _OpenWD =
- MOVEQ #1,D0
- _HFSDispatch
- |
-
- MACRO _GetWDInfo =
- MOVEQ #7,D0
- _HFSDispatch
- |
-
- ;New fields for _GetWDInfo:
- ioWDIndex EQU $1A ;Working Directory index for _GetWDInfo
- ioWDProcID EQU $1C ;WD's ProcID (long)
- ioWDVRefNum EQU $20 ;WD's Volume RefNum (word)
- ioWDDirID EQU $30 ;WD's DirID (long)
-
- ;New field for _HGetVolInfo:
- ioVFndrInfo EQU $5A ;Finder information for volume
-
-
- ;----------
- ;SkipFinder equates
- ;----------
-
- ;menu constants
-
- AppleMenuID EQU 128
- EditMenuID EQU 129
-
- ;get file dialog constants
-
- getSetup EQU -1 ;setup number
- ;getOpen EQU 1 ;open button
- getOpenDoc EQU 2 ;open doc button
- ;getCancel EQU 3 ;cancel button
- ;getEject EQU 5 ;eject button
- ;getDrive EQU 6 ;drive button
- getShutDown EQU 12 ;shut down button
- getStop EQU 13 ;stop skipping button
- getNothing EQU 100 ;null event number
- getRebuild EQU 101 ;rebuild list number
- getOpenFolder EQU 103 ;open folder number
-
- ;trap constants
-
- Pack3 EQU $A9EA ;trap number for _Pack3
- MoveWindow EQU $A91B ;trap number for _MoveWindow
-
- ;globals
-
- quickGlobals EQU -4
- endQuickGlobals EQU -grafSize ;QuickDraw globals
-
- currentReply EQU endQuickGlobals-4 ;current reply record
- applicationReply EQU currentReply-rName-64 ;application reply record
- documentReply EQU applicationReply-rName-64 ;document reply record
-
- Pack3Address EQU documentReply-4 ;old address of trap for Pack3
- MoveAddress EQU Pack3Address-4 ;old address of trap for MoveWindow
- returnAddress EQU MoveAddress-4 ;old return address for Pack3
-
- owned EQU returnAddress-2 ;id of first owned resource
-
- AppleMenuHandle EQU owned-4 ;handles to the two menus
- EditMenuHandle EQU AppleMenuHandle-4
-
- dismissButton EQU EditMenuHandle-2 ;button used to dismiss the last SFPPutFile Dialog
- dormant EQU dismissButton-4 ;saving place for dormant dialogs
- signature EQU dormant-4 ;signature of chosen application
- stopSkipping EQU signature-1 ;stop skipping the Finder?
- allFiles EQU stopSkipping-1 ;option key shenanigans
-
- totalGlobals EQU -allFiles
-
- ;----------
- ;SkipFinder - branch right into the skipping code
- ;----------
-
- FirstThingsFirst
- BRA.S DoTheSkipping
-
- Options DC.W %0000000000000010 ;flags word
-
- ;----------
- ;constants
- ;----------
-
- AppleMenu DC.B 1,appleMark ;title of Apple menu
- vowels DC.B 'AEIOUaeiou' ;list of vowels, terminated by ...
- nullString DC.B 0 ;zero byte (also for use as a null string '')
- .ALIGN 2
-
- ;----------
- ;DoTheSkipping - code starts here
- ;----------
-
- DoTheSkipping
- MOVE.L BufPtr,SP
- SUB #32,SP ;make room for above A5
- MOVE.L SP,A5 ;set up A5
- SUB #totalGlobals,SP ;make room for below A5
- MOVE.L A5,CurrentA5
- MOVE.L SP,CurStackBase
- MOVE.L SP,StkLowPt
- MOVE.L SP,A0
- SUB.L DefltStack,A0
- _SetApplLimit
-
- CLR.B CurApName ;current application has no name
-
- LEA FirstThingsFirst,A0
- _RecoverHandle ;get the handle to this resource
- _HLock ;lock us in for the duration
- MOVE.L A0,-(SP) ;and detach things
- MOVE.L A0,-(SP)
- PEA applicationReply(A5) ;point to place for returned values
- PEA applicationReply+2(A5)
- PEA documentReply(A5)
- _GetResInfo
- MOVE.W applicationReply(A5),owned(A5)
- _DetachResource
-
- ;----------
- ;now that basic setup is done, initialize the "application"
- ;----------
-
- PEA quickGlobals(A5)
- _InitGraf
- _InitFonts
- _InitWindows
- _InitMenus
- CLR.L -(SP)
- _InitDialogs
- _TEInit
-
- SUBQ #4,SP
- MOVE.W #watchCursor,-(SP) ;get the watch
- _GetCursor
- MOVE.L (SP)+,A0 ;keep it in memory
- _HNoPurge
- MOVE.L (A0),-(SP)
- _InitCursor ;clear off the cursor
- _SetCursor
-
- CLR.L dormant(A5)
- CLR.B stopSkipping(A5)
-
- SUBQ #4,SP
- MOVE.W #AppleMenuID,-(SP) ;menu ID
- PEA AppleMenu ;point to string
- _NewMenu
- MOVE.L (SP)+,A2
-
- SUBQ #4,SP
- MOVEQ #4,D0
- ADD.W owned(A5),D0
- MOVE.W D0,-(SP)
- _GetString
- MOVE.L (SP)+,A3
-
- MOVE.L A2,-(SP)
- MOVE.L (A3),-(SP)
- _AppendMenu
-
- MOVE.L A3,-(SP)
- _ReleaseResource
-
- MOVE.L A2,-(SP)
- MOVE.L #'DRVR',-(SP)
- _AddResMenu
-
- MOVE.L A2,-(SP)
- CLR.W -(SP)
- _InsertMenu
-
- MOVE.L A2,AppleMenuHandle(A5)
-
- SUBQ #4,SP
- MOVEQ #2,D0
- ADD.W owned(A5),D0
- MOVE.W D0,-(SP)
- _GetString
- MOVE.L (SP)+,A3
-
- SUBQ #4,SP
- MOVE.W #EditMenuID,-(SP)
- MOVE.L (A3),-(SP)
- _NewMenu
- MOVE.L (SP)+,A2
-
- MOVE.L A3,-(SP)
- _ReleaseResource
-
- SUBQ #4,SP
- MOVEQ #3,D0
- ADD.W owned(A5),D0
- MOVE.W D0,-(SP)
- _GetString
- MOVE.L (SP)+,A3
-
- MOVE.L A2,-(SP)
- MOVE.L (A3),-(SP)
- _AppendMenu
-
- MOVE.L A3,-(SP)
- _ReleaseResource
-
- MOVE.L A2,-(SP)
- CLR.W -(SP)
- _InsertMenu
-
- MOVE.L A2,-(SP)
- CLR.W -(SP)
- _DisableItem ;disable Edit menu
-
- MOVE.L A2,EditMenuHandle(A5)
-
- _DrawMenuBar
-
- ;----------
- ;now that the application is set up and the menu is drawn, set up the files
- ;----------
-
- longestQElSize EQU $80 ;no param block is longer than $80
-
- MOVEQ #(longestQElSize/2)-1,D0 ;clear off a param block
- @1 CLR.W -(SP)
- DBRA D0,@1
-
- MOVE.L SP,A0
-
- StartOver
- MOVE.L VCBQHdr+qHead,A1 ;point to queue
- CLR.L ioFileName(A0)
- NextVolume
- MOVE.W VCBVRefNum(A1),ioVRefNum(A0) ;put the refNum in the block
-
- TST.W VCBDrvNum(A1) ;if in a drive, just flush
- BNE.S @1
-
- TST.W VCBDRefNum(A1) ;if not off line, just flush
- BMI.S @1
-
- _UnmountVol
- BRA.S StartOver
- @1
- _FlushVol
- MOVE.L (A1),A1 ;advance through the queue
- MOVE.L A1,D0
- BNE.S NextVolume
-
- ;----------
- ;DoDialog - load in the standard file dialogs and do the stuff
- ;----------
-
- DoDialog
- MOVE.W owned(A5),-(SP)
- _CouldDialog
-
- MOVE.W owned(A5),D0 ;get the other ID (for the second dialog)
- ADDQ.W #2,D0
- MOVE.W D0,-(SP)
- _CouldDialog
-
- CLR.L -(SP) ;offset 0,0
- PEA nullString ;no prompt
- PEA ApplicationFilter ;no file filter
- MOVE.W #-1,-(SP) ;all file types allowed
- CLR.L -(SP)
- PEA ButtonHook ;hook for extra controls
- PEA applicationReply(A5) ;put the reply area
- MOVE.L (SP),currentReply(A5) ;remind the reply
- MOVE.W owned(A5),-(SP) ;id for the dialog
- PEA MenuFilter ;menu filter procedure
- BSR CheckAllFiles
- BSR .SFPGetFile
-
- MOVE.W dismissButton(A5),D0 ;shut down?
- CMP.W #getShutDown,D0
- BEQ PowerDown
-
- TST.B stopSkipping(A5) ;stop skipping?
- BNE.S NoMoreSkipping
-
- MOVE.W dismissButton(A5),D0 ;Finder button?
- CMP.W #getCancel,D0
- BNE.S KeepSkipping
-
- BTST #FBit,Options+1 ;keep skipping after Finder?
- BEQ.S NoMoreSkipping
-
- BSET #7,stashed ;keep skipping, go to Finder
- BRA.S KeepSkipping
-
- NoMoreSkipping
- MOVE.L stashed,A0
- MOVE.L (A0),A0 ;get the old trap address
- MOVE.W #OpenResFile,D0 ;for _OpenResFile
- _SetTrapAddress
-
- MOVE.L stashed,A0
- _DisposPtr
- CLR.L stashed
-
- KeepSkipping
- CLR.B documentReply+rGood(A5) ;documentReply is not good if we never do it
-
- MOVE.W dismissButton(A5),D0 ;check if we need a document
- CMP.W #getOpenDoc,D0
- BNE ContinueSkipping
-
- ;----------
- ;if a document is needed, find the application signature and bring up the second dialog
- ;----------
-
- MOVE.L SP,A0
-
- MOVE.W applicationReply+rVolume(A5),ioVRefNum(A0)
- CLR.W ioRefNum(A0)
- LEA applicationReply+rName(A5),A1
- MOVE.L A1,ioFileName(A0)
- _GetFileInfo
- MOVE.L ioFlUsrWds+4(A0),signature(A5) ;store the signature
-
- PEA applicationReply+rName(A5) ;put the application's name
-
- MOVE.B applicationReply+rName+1(A5),D0 ;get a character
- LEA vowels,A0
- NextVowel
- MOVE.B (A0)+,D1
- BEQ.S NotAVowel
- CMP.B D0,D1
- BNE.S NextVowel
- IsAVowel
- PEA 'n'
- BRA.S FinishVowel
- NotAVowel
- CLR.L -(SP)
- FinishVowel
- CLR.L -(SP)
- CLR.L -(SP)
- _ParamText
-
- CLR.L -(SP) ;move onto the stack
- PEA nullString ;no prompt
- PEA DocumentFilter ;document only filter
- MOVE.W #-1,-(SP) ;all file types allowed
- CLR.L -(SP)
- PEA ButtonHook ;hook for check box
- PEA documentReply(A5) ;put the reply area
- MOVE.L (SP),currentReply(A5) ;remember the reply
- MOVE.W owned(A5),D0
- ADDQ.W #2,D0
- MOVE.W D0,-(SP) ;id for the dialog
- PEA MenuFilter ;no filter procedure
- BSR CheckAllFiles
- BSR .SFPGetFile
-
- TST.B documentReply+rGood(A5) ;check the result
- BEQ DoDialog
-
- ;----------
- ;ContinueSkipping - now, build the Finder information and do the skip
- ;----------
-
- ContinueSkipping
- SUBQ #4,SP
- MOVE.W #watchCursor,-(SP) ;get the watch
- _GetCursor
- MOVE.L (SP)+,A0 ;deref it onto stack
- MOVE.L (A0),-(SP)
- _SetCursor
-
- MOVE.L AppParmHandle,A0 ;get the handle
-
- MOVEQ #4,D0 ;size it down to indicate no parameters
- TST.B documentReply+rGood(A5) ;check if there are parameters
- BEQ.S NoDocument
- MOVE.B documentReply+rName(A5),D0 ;get the size
- ADD.W #13,D0 ;+13
- NoDocument
- _SetHandleSize
- BNE.S DidFinderInfo ;if no error:
- TST.W ROM85
- BMI.S @1
- _MoveHHi
- @1
- MOVE.L (A0),A0 ;dereference and
- CLR.L (A0) ;clear it
- TST.B documentReply+rGood(A5) ;was it good?
- BEQ.S DidFinderInfo
- MOVE.W dismissButton(A5),D0
- CMP.W #getOpenDoc,D0 ;was it a print?
- BNE.S NotPrint
- ADDQ.W #1,(A0) ;set for print
- NotPrint
- ADDQ.L #1,(A0)+ ;set for 1 file
- MOVE.W documentReply+rVolume(A5),(A0)+
- MOVE.L documentReply+rType(A5),(A0)+
- MOVE.W documentReply+rVersion(A5),(A0)+
- MOVEQ #0,D0
- LEA documentReply+rName(A5),A1
- MOVE.B (A1),D0
- @1
- MOVE.B (A1)+,(A0)+ ;move the name in
- DBRA D0,@1
- DidFinderInfo
-
- ;----------
- ;now that the finder info is built, switch systems if we want to
- ;----------
-
- MOVE.W applicationReply+rVolume(A5),D3
- CMP.W BootDrive,D3 ;boot disk is already OK
- BEQ DontSwitchSystems
-
- BTST #HBit,Options+1 ;options say don't switch
- BEQ DontSwitchSystems
-
- MOVE.L SP,A0 ;point to param block
- MOVE.W applicationReply+rVolume(A5),ioVRefNum(A0)
- _SetVol
-
- TST.W FSFCBLen
- BMI.S GotVRefNum
-
- CLR.W ioWDIndex(A0)
- _GetWDInfo ;get the volume ID
- BMI.S GotVRefNum
-
- CLR.L ioFileName(A0)
- CLR.W ioVolIndex(A0)
- _HGetVInfo ;get the system volume
- BMI.S GotVRefNum
-
- MOVE.L ioVFndrInfo(A0),ioWDDirID(A0)
- _HSetVol
- GotVRefNum
- CLR.W ioVRefNum(A0)
-
- MOVE.L #SysResName,ioFileName(A0)
- _GetFileInfo
- BNE.S DontSwitchSystems ;doesn't exist, don't switch
-
- TST.W ioRefNum(A0) ;check if already open
- BNE.S DontSwitchSystems
-
- MOVE.L #FinderName,ioFileName(A0)
- _GetFileInfo
- BNE.S DontSwitchSystems
-
- SUBQ #4,SP
- _LodeScrap
- ADDQ #4,SP
-
- CLR.W -(SP)
- _CloseResFile ;close all the resource files
-
- MOVE.L SP,A0
-
- CLR.L ioFileName(A0)
- _GetVol ;find the boot volume
-
- TST.W FSFCBLen
- BMI.S SetBootDrive
-
- _HGetVol ;get that volume
-
- CLR.L ioFileName(A0)
- MOVE.L #'SKIP',ioWDProcID(A0)
- _OpenWD ;open it as a WD
-
- _SetVol ;point to it
- SetBootDrive
- MOVE.W ioVRefNum(A0),BootDrive ;set the boot drive correctly
-
- SUBQ #2,SP ;open the new system file
- _InitResources
- ADDQ #2,SP ;discard returned integer
-
- _InitFonts
- DontSwitchSystems
-
- ;----------
- ;now that we have switched systems if desired do a Finder launch or other launch
- ;----------
-
- MOVE.W dismissButton(A5),D0
- CMP.W #getCancel,D0 ;did he press the Finder button?
- BNE.S NotFinder
-
- ;----------
- ;Finder launch
- ;----------
-
- MOVE.L SP,A0
- MOVE.W BootDrive,ioVRefNum(A0)
- _SetVol ;run the Finder on the correct volume
-
- CLR.W -(SP)
- PEA FinderName
- MOVE.L SP,A0
- _Launch ;Launch away!
-
- ;----------
- ;other application launch
- ;----------
-
- NotFinder
- MOVE.L SP,A0
- MOVE.W applicationReply+rVolume(A5),ioVRefNum(A0)
- _SetVol ;run the application on the correct volume
-
- CLR.W -(SP)
- PEA applicationReply+rName(A5)
- MOVE.L SP,A0
- _Launch ;Launch away!
-
- ;----------
- ;PowerDown - shut down the Mac
- ;----------
-
- PowerDown
- CLR.W -(SP) ;close all resource files
- _CloseResFile
-
- MOVE.L SP,A0 ;point to the io block
- EjectVolume
- MOVE.L VCBQHdr+qHead,A1 ;get the first VCB Queue entry
- MOVE.L A1,D0 ;check A1
- BEQ.S Restart
-
- MOVE.W VCBVRefNum(A1),ioVRefNum(A0) ;eject a volume
- _Eject
- _UnmountVol
-
- BRA.S EjectVolume
- Restart
- MOVE.L ROMBase,A0
- RESET
- JMP 10(A0)
-
-
- ;----------
- ;ApplicationFilter - selects only applications, or all documents if we are not as picky
- ;----------
-
- ApplicationFilter
- MOVE.L (SP)+,A0 ;get the return address
-
- MOVE.L (SP)+,A1 ;get the param block pointer
- CLR.W (SP) ;clear the result by default
-
- MOVE.B allFiles(A5),D0 ;if all files, bypass APPL check
- BNE.S IsApplication
-
- CMP.L #'APPL',ioFlUsrWds(A1) ;check file type = APPL
- BEQ.S IsApplication
- ST (SP) ;an non application shouldn't be
- IsApplication
- JMP (A0)
-
-
- ;----------
- ;DocumentFilter - selects only documents with the right creator, unless we are not very picky
- ;----------
-
- DocumentFilter
- MOVE.L (SP)+,A0 ;get the return address
-
- MOVE.L (SP)+,A1 ;get the param block pointer
- CLR.W (SP) ;clear the result by default
-
- CMP.L #'APPL',ioFlUsrWds(A1) ;check file type = APPL
- BEQ.S NotDocument
-
- MOVE.B allFiles(A5),D0 ;if all files, bypass signature check
- BNE.S IsDocument
-
- MOVE.L ioFlUsrWds+4(A1),D0 ;get the creator
- CMP.L signature(A5),D0 ;is it equal?
- BEQ.S IsDocument
- NotDocument
- ST (SP) ;an application shouldn't be
- IsDocument
- JMP (A0)
-
-
- ;----------
- ;ButtonHook - handle all the niceties of the standard file dialog
- ;----------
-
- dialogPtr EQU 8
- item EQU 12
- result EQU 14
-
- type EQU -2
- box EQU type-8
- controlHandle EQU box-4
-
- needed EQU controlHandle
-
- TrackButton
- MOVE.W D0,result(A6)
-
- MOVE.L dialogPtr(A6),-(SP)
- MOVE.W D0,-(SP)
- PEA type(A6)
- PEA controlHandle(A6)
- PEA box(A6)
- _GetDItem
-
- MOVE.L controlHandle(A6),A0
- MOVE.L (A0),A0
- MOVE.B contrlHilite(A0),D0
- CMP.B #254,D0
- BLO.S FlashButton
-
- CLR.W result(A6)
- BRA.S AlmostDone
- FlashButton
- MOVE.L controlHandle(A6),-(SP)
- BSR FlashControl ;flash the control
-
- AlmostDone
- MOVE.W result(A6),D0
- BRA RescanButton
-
- EnterKey
- MOVEQ #getOpenDoc,D0 ;Open.../Print
- BRA.S TrackButton
-
- BackspaceKey
- MOVEQ #getCancel,D0 ;Finder/Cancel
- BRA.S TrackButton
-
- TabKey
- CmdDKey
- MOVEQ #getDrive,D0 ;Drive
- BRA.S TrackButton
-
- ReturnKey
- MOVEQ #getOpen,D0 ;Open
- BRA TrackButton
-
- CmdTabKey
- CmdEKey
- MOVEQ #getEject,D0 ;Eject
- BSR TrackButton
-
- Cmd.Key
- CmdQKey
- MOVEQ #getShutDown,D0 ;Shut Down
- BSR TrackButton
-
- ButtonHook
- LINK A6,#needed
-
- MOVE.W item(A6),D0
- RescanButton
- MOVE.W D0,dismissButton(A5)
- LEA ButtonTable,A0
- NextButton
- TST.W (A0)
- BEQ.S StuffResult
- MOVE.L (A0)+,D1
- SWAP D1
- CMP.W D1,D0
- BNE NextButton
- SWAP D1
- JMP ButtonTable(D1.W)
-
- ButtonTable
- DC.W $1003,EnterKey-ButtonTable
- DC.W $1008,BackspaceKey-ButtonTable
- DC.W $1009,TabKey-ButtonTable
- DC.W $1109,CmdTabKey-ButtonTable
- DC.W $100D,ReturnKey-ButtonTable
- DC.W $112E,Cmd.Key-ButtonTable
- DC.W $1144,CmdDKey-ButtonTable
- DC.W $1164,CmdDKey-ButtonTable
- DC.W $1145,CmdEKey-ButtonTable
- DC.W $1165,CmdEKey-ButtonTable
- DC.W $1151,CmdQKey-ButtonTable
- DC.W $1171,CmdQKey-ButtonTable
-
- DC.W getOpen,OpenButton-ButtonTable
- DC.W getOpenDoc,OpenDocButton-ButtonTable
- DC.W getShutDown,ShutDownButton-ButtonTable
- DC.W getStop,StopButton-ButtonTable
- DC.W getNothing,Nothing-ButtonTable
-
- DC.W 0
-
- StuffResult
- CMP.W #$1100,D0 ;it does not understand>1100!
- BLO.S @1
- MOVEQ #0,D0
- @1
- MOVE.W D0,result(A6)
- DoneButton
- UNLK A6
- MOVE.L (SP)+,A0 ;get return address
- ADDQ #6,SP ;pop off parameters
- JMP (A0)
-
- OpenButton
- MOVE.L currentReply(A5),A0
- TST.B rName(A0)
- BNE.S StuffResult
- MOVEQ #getOpenFolder,D0 ;Open folder
- BRA.S StuffResult
-
- OpenDocButton
- MOVE.L dialogPtr(A6),-(SP)
- MOVE.W #getOpen,-(SP)
- PEA type(A6)
- PEA controlHandle(A6)
- PEA box(A6)
- _GetDItem
-
- MOVE.L controlHandle(A6),A0
- MOVE.L (A0),A0
- MOVE.B contrlHilite(A0),D0
- CMP.B #254,D0
- BHS.S NoButton
-
- ; BRA.S FakeOpenButton
-
- ShutDownButton
- ; BRA.S FakeOpenButton
-
- FakeOpenButton
- MOVEQ #getOpen,D0 ;simulate an open
- BRA.S StuffResult
-
- StopButton
- MOVE.L dialogPtr(A6),-(SP)
- MOVE.W D0,-(SP) ;item number
- PEA type(A6)
- PEA controlHandle(A6)
- PEA box(A6)
- _GetDItem
-
- SUBQ #4,SP
- MOVE.W owned(A5),D0
-
- LEA stopSkipping(A5),A0
- TST.B (A0)
- SEQ (A0)
- BNE.S @1
- ADDQ.W #1,D0
- @1
- MOVE.W D0,-(SP)
- _GetString
- MOVE.L (SP),A0
- MOVE.L controlHandle(A6),-(SP)
- MOVE.L (A0),-(SP)
- _SetCTitle
- _ReleaseResource
- ; BRA.S NoButton
-
- NoButton
- MOVE.W #getNothing,D0
- BRA StuffResult
-
- Nothing
- BSR.S CheckAllFiles
- BEQ StuffResult
- MOVE.W #getRebuild,D0
- BRA StuffResult
-
- CheckAllFiles
- LEA allFiles(A5),A0
- MOVEQ #0,D0
- BTST #2,$17B ;This is the Option key!
- BEQ.S NotAllFIles
- MOVEQ #-1,D0
- NotAllFiles
- MOVE.B (A0),D1
- MOVE.B D0,(A0)
- CMP.B D0,D1
- RTS
-
-
- ;----------
- ;MenuFiler - handle all the things associated with the menu and the Open.../Print button
- ;----------
-
- MenuFilter
- LINK A6,#0
-
- ;before we start the menu, fix the Open.../Print button
-
- MOVE.L theDialog(A6),-(SP)
- MOVE.W #getOpen,-(SP)
- PEA scratch20
- PEA scratch20+2 ;getOpen in scratch20+2
- PEA scratch8
- _GetDItem
-
- MOVE.L theDialog(A6),-(SP)
- MOVE.W #getOpenDoc,-(SP)
- PEA scratch20
- PEA scratch20+6 ;getOpenDoc in scratch20+6
- PEA scratch8
- _GetDItem
-
- MOVEQ #0,D0
-
- MOVE.L scratch20+2,A0
- MOVE.L (A0),A0
- TST.B contrlHilite(A0)
- BNE.S DoUnHilite ;decide whether to hilite
-
- MOVE.L currentReply(A5),A0
- TST.B rName(A0)
- BNE.S DoHilite ;decide whether to hilite
- DoUnHilite
- MOVE.B #255,D0
- DoHilite
- MOVE.L scratch20+6,A0
- MOVE.L (A0),A0
- CMP.B contrlHilite(A0),D0
- BEQ.S DontHiliteOpenDoc
-
- MOVE.L scratch20+6,-(SP)
- MOVE.W D0,-(SP)
- _HiliteControl
- DontHiliteOpenDoc
-
- NextFilter
- CLR.B filtered(A6)
-
- MOVE.L theEvent(A6),A0
-
- CMP.W #mButDwnEvt,(A0)
- BNE.S NotMouseDown
-
- SUBQ #2,SP
- MOVE.L evtMouse(A0),-(SP)
- PEA scratch20
- _FindWindow
- MOVE.W (SP)+,D0
-
- CMP.W #inMenuBar,D0
- BNE.S NotMouseMenu
-
- MOVE.L theEvent(A6),A0
-
- SUBQ #4,SP
- MOVE.L evtMouse(A0),-(SP)
- _MenuSelect
-
- BSR DoMenuItem
-
- BRA.S DoneMouseDown
- NotMouseMenu
- CMP.W #inSysWindow,D0
- BNE.S NotMouseDA
-
- MOVE.L theEvent(A6),-(SP)
- MOVE.L scratch20,-(SP)
- _SystemClick
- BRA.S DoneMouseDown
- NotMouseDA
- CMP.W #inDesk,D0
- BNE DoneMenuFilter
- DoneMouseDown
- DoneKeyDown
- DoneUpdate
- MOVE.L theEvent(A6),A0
- CLR.W (A0)
- BRA DoneMenuFilter
- NotMouseDown
- CMP.W #keyDwnEvt,(A0)
- BNE.S NotKeyDown
-
- MOVE.L evtMessage(A0),D0
- AND.W #$FF,D0
-
- BTST #cmdKey-8,evtMeta(A0)
- BEQ.S NotCmdKey
-
- SUBQ #4,SP
- MOVE.W D0,-(SP)
- _MenuKey
-
- TST.W (SP)
- BEQ.S IsCmdKey
-
- BSR DoMenuItem
- BRA.S DoneKeyDown
- IsCmdKey
- ADDQ #4,SP
- MOVE.L theEvent(A6),A0
- MOVE.L evtMessage(A0),D0
- AND.W #$FF,D0
-
- CMP.W #9,D0
- BEQ.S @1
-
- CMP.W #$20,D0
- BLO.S DoneMenuFilter
- @1
- ADD.W #$1100,D0
- BRA.S FilterKey
- NotCmdKey
- CMP.W #$20,D0
- BHS.S DoneMenuFilter
-
- ADD.W #$1000,D0
- FilterKey
- MOVE.L itemHit(A6),A0
- MOVE.W D0,(A0)
- ADDQ.B #1,filtered(A6)
- BRA.S DoneKeyDown
- NotKeyDown
- CMP.W #updatEvt,(A0)
- BNE.S DoneMenuFilter
-
- MOVE.L theDialog(A6),D0
-
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
-
- _BeginUpdate
- _DrawDialog
- BSR OutlineButton
-
- TST.L dormant(A5)
- BEQ.S @1
-
- MOVE.L (SP),-(SP)
- BSR DimWindow
- @1
- _EndUpdate
-
- BRA DoneUpdate
-
- DoneMenuFilter
- SUBQ #4,SP
- _FrontWindow
- LEA dormant(A5),A1
- MOVE.L (SP)+,D0
-
- CMP.L theDialog(A6),D0
- BEQ.S BringBackDialog
- TST.L (A1)
- BEQ.S DimDownDialog
- BRA.S NextEvent
-
- DimDownDialog
- MOVE.L theDialog(A6),A0
- MOVE.L A0,(A1)
- MOVE.L A0,-(SP)
- BSR DimWindow
-
- MOVE.L EditMenuHandle(A5),-(SP)
- CLR.W -(SP)
- _EnableItem
- _DrawMenuBar
-
- NextEvent
- _SystemTask
-
- SUBQ #2,SP
- MOVE.W #-1,-(SP)
- MOVE.L theEvent(A6),-(SP)
- _GetNextEvent
- TST.B (SP)+
- BEQ.S NextEvent
-
- BRA NextFilter
-
- BringBackDialog
- MOVE.L (A1),D0
- BEQ.S @1
- CLR.L (A1)
-
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
-
- _DrawDialog
- BSR OutlineButton
-
- MOVE.L (SP)+,A0
- MOVE.L visRgn(A0),-(SP)
- _ValidRgn
-
- MOVE.L EditMenuHandle(A5),-(SP)
- CLR.W -(SP)
- _DisableItem
- _DrawMenuBar
- @1
- UNLK A6
- MOVE.L (SP)+,A0 ;get return address
- ADD #12,SP ;pop off parameters
- JMP (A0)
-
-
- DoMenuItem
- MOVE.L (SP)+,A0
- MOVE.W (SP)+,D0 ;get the menu number
- MOVE.W (SP)+,D1 ;get the item number
- MOVE.L A0,-(SP)
-
- CMP.W #AppleMenuID,D0
- BNE NotAppleMenu
-
- CMP.W #2,D1
- BHI OpenDeskAccessory
-
- ;----------
- ;AboutScreen - bring up the about screen
- ;----------
-
- AboutScreen
- SUBQ #4,SP
- MOVE.W owned(A5),-(SP)
- _GetPicture
- MOVE.L (SP),A0 ;get the resource handle
- MOVE.L (A0),A0 ;dereference
-
- MOVE.L picFrame+topLeft(A0),scratch20+topLeft
- MOVE.L picFrame+botRight(A0),scratch20+botRight
-
- SUBQ #4,SP
- CLR.L -(SP)
- PEA scratch20
- PEA nullString
- MOVE.B #0,-(SP)
- MOVE.W #dBoxProc,-(SP)
- MOVE.L MinusOne,-(SP)
- CLR.B -(SP)
- CLR.L -(SP)
- _NewWindow
-
- MOVE.L (SP)+,A0 ;get window
- MOVE.L (SP)+,A1 ;get picture
-
- MOVE.L A0,-(SP) ;put window
- MOVE.L A1,-(SP) ;put picture
- MOVE.L A1,-(SP) ;put picture
- MOVE.L A0,-(SP) ;put window
- MOVE.L A0,-(SP) ;put window
- MOVE.L A0,-(SP) ;put window
-
- BSR CenterWindow ;use window
- _ShowWindow ;use window
- _SetPort ;use window
- PEA scratch20
- _DrawPicture ;use picture
- _ReleaseResource ;use picture
- AboutLoop
- SUBQ #2,SP
- MOVE.W #$003F,-(SP)
- PEA scratch20
- _GetNextEvent
- TST.B (SP)+
- BEQ.S AboutLoop
-
- CMP.W #mButDwnEvt,scratch20+evtNum
- BEQ.S DoneAbout
-
- CMP.W #keyDwnEvt,scratch20+evtNum
- BNE.S AboutLoop
-
- CMP.B #3,scratch20+evtMessage+3
- BEQ.S DoneAbout
-
- CMP.B #13,scratch20+evtMessage+3
- BNE.S AboutLoop
-
- DoneAbout
- _DisposWindow ;use window
-
- BRA.S DoneMenuItem
-
- ;----------
- ;OpenDeskAccessory - open a desk accessory
- ;----------
-
- OpenDeskAccessory
- SUB #256,SP
- MOVE.L AppleMenuHandle(A5),-(SP)
- MOVE.W D1,-(SP)
- PEA 6(SP)
- _GetItem
-
- BSET #7,stashed
- SUBQ #2,SP
- PEA 2(SP)
- _OpenDeskAcc
- ADD #256+2,SP
- BCLR #7,stashed
-
- CLR.W -(SP)
- _HiliteMenu
- _DrawMenuBar
- RTS
-
-
- NotAppleMenu
- CMP.W #EditMenuID,D0
- BNE.S DoneMenuItem
-
- SUBQ.W #1,D1
- SUBQ #2,SP
- MOVE.W D1,-(SP)
- _SysEdit
- ADDQ #2,SP
- DoneMenuItem
- CLR.W -(SP)
- _HiliteMenu
- RTS
-
-
- ;----------
- ;DimWindow - dim down the contents of a window
- ;----------
-
- DimWindow
- MOVE.L (SP)+,A1
- MOVE.L (SP)+,A0
- MOVE.L A1,-(SP)
-
- PEA portRect(A0)
- MOVE.L A0,-(SP)
- _SetPort
- MOVE.L (A5),A0
- PEA gray(A0)
- _PenPat
- MOVE.W #patBic,-(SP)
- _PenMode
- _PaintRect
- _PenNormal
- RTS
-
-
- ;----------
- ;OutlineButton - outline the button that is default (button #1)
- ;----------
-
- OutlineButton
- MOVE.L 4(SP),-(SP)
- _SetPort
-
- MOVE.L 4(SP),-(SP)
- MOVE.W #1,-(SP) ;item 1 is always default
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
-
- LEA scratch8,A0 ;rectangle
- MOVEQ #3,D0 ;width of outline
- MOVEQ #16,D1 ;rounding factor of outline
- MOVEQ #-4,D2 ;inset of outline
-
- MOVE.L A0,-(SP) ;FrameRoundRect
- MOVE.W D1,-(SP)
- MOVE.W D1,-(SP)
-
- MOVE.L A0,-(SP) ;InsetRect
- MOVE.W D2,-(SP)
- MOVE.W D2,-(SP)
-
- MOVE.W D0,-(SP) ;PenSize
- MOVE.W D0,-(SP)
-
- _PenSize
- _InsetRect
- _FrameRoundRect
-
- MOVE.L (SP)+,(SP)
- RTS
-
-
- ;----------
- ;.SFPGetFile - this is the substitute _SFPGetFile that prevents anything
- ; from calling standard file while it is running
- ;----------
-
- .SFPGetFile
- MOVE.L (SP)+,returnAddress(A5)
-
- MOVE.W #Pack3,D0
- _GetTrapAddress
- MOVE.L A0,Pack3Address(A5)
- MOVE.L A0,A1
-
- MOVE.W #MoveWindow,D0
- _GetTrapAddress
- MOVE.L A0,MoveAddress(A5)
-
- MOVEQ #6,D0
- _NewPtr ,SYS
- MOVE.W #Pack3,D0
- _SetTrapAddress
- MOVE.W #$4EF9,(A0)+ ;JMP ABS.L
- PEA PatchStdFile
- MOVE.L (SP)+,(A0)+
-
- MOVEQ #6,D0
- _NewPtr ,SYS
- MOVE.W #MoveWindow,D0
- _SetTrapAddress
- MOVE.W #$4EF9,(A0)+ ;JMP ABS.L
- PEA PatchMoveWindow
- MOVE.L (SP)+,(A0)+
-
- MOVE.W #sfPGetFile,-(SP) ;put selector on stack
- JSR (A1)
-
- MOVE.W #Pack3,D0
- _GetTrapAddress
- _DisposPtr
-
- MOVE.W #Pack3,D0
- MOVE.L Pack3Address(A5),A0
- _SetTrapAddress
-
- MOVE.L returnAddress(A5),-(SP)
- RTS
-
-
- ;----------
- ;PatchStdFile - what PACK 3 calls while .SFPGetFile is working
- ;----------
-
- PatchStdFile
- MOVE.L (SP)+,A0
-
- MOVE.W (SP)+,D0 ;get the selector
- CMP.W #sfPutFile,D0
- BEQ.S SFPutFile.
- CMP.W #sfPPutFile,D0
- BEQ.S SFPPutFile.
- CMP.W #sfGetFile,D0
- BEQ.S SFGetFile.
- CMP.W #sfPGetFile,D0
- BEQ.S SFPGetFile.
- MOVEQ #20,D0 ;dsNoPk3
- _SysError
- SFPPutFile.
- ADDQ #6,SP
- SFPutFile.
- MOVE.L (SP)+,A1
- ADD #16,SP
- BRA.S FinishStdFile
- SFPGetFile.
- ADDQ #6,SP
- SFGetFile.
- MOVE.L (SP)+,A1
- ADD #22,SP
- ; BRA.S FinishStdFile
- FinishStdFile
- CLR.B (A1)
- MOVE.L A0,-(SP)
-
- MOVE.W owned(A5),D0
- ADDQ.W #3,D0
-
- SUBQ #4,SP
- MOVE.W D0,-(SP)
- CLR.L -(SP)
- MOVE.L #-1,-(SP)
- _GetNewDialog
-
- MOVE.L (SP),-(SP)
- BSR CenterWindow
-
- MOVE.L (SP),-(SP)
- _ShowWindow
-
- PEA SFFilter
- PEA scratch20
- _ModalDialog
-
- _DisposDialog
-
- RTS
-
-
- ;----------
- ;PatchMoveWindow - what MoveWindow calls the first time after SF is called
- ;----------
-
- PatchMoveWindow
- MOVE.W #MoveWindow,D0
- _GetTrapAddress
- _DisposPtr
-
- MOVE.W #MoveWindow,D0
- MOVE.L MoveAddress(A5),A0
- _SetTrapAddress
-
- MOVE.L (SP)+,A0
- ADDQ #6,SP
- MOVE.L A0,-(SP)
- ; BRA.S CenterWindow
-
-
- ;----------
- ;CenterWindow - center a window on the screen
- ;----------
-
- CenterWindow
- MOVE.L (SP)+,A1 ;get the return address
- MOVE.L (SP)+,A0
- MOVE.L A1,-(SP)
-
- MOVEQ #0,D1 ;get ready for centering
-
- MOVE.W quickGlobals+screenBits+bounds+bottom(A5),D1 ;calculate centering info
- SUB.W portRect+bottom(A0),D1 ;by subtracting (ignore the menu bar)
- ADD.W #20,D1
- ASR.W #1,D1 ;and shifting
-
- SWAP D1 ;move the Y coordinate to high word
-
- MOVE.W quickGlobals+screenBits+bounds+right(A5),D1 ;do the same for X
- SUB.W portRect+right(A0),D1
- ASR.W #1,D1
-
- MOVE.L A0,-(SP)
- MOVE.L D1,-(SP)
- MOVE.B #1,-(SP)
- _MoveWindow ;move the window into position
-
- RTS
-
-
- ;----------
- ;SFFilter - fancy filtering for the SF nastiness dialog
- ;----------
-
- SFFilter
- LINK A6,#0
-
- CLR.B filtered(A6)
-
- MOVE.L theEvent(A6),A0
-
- CMP.W #updatEvt,(A0)
- BNE.S SFNotUpdate
-
- MOVE.L theDialog(A6),D0
-
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
- MOVE.L D0,-(SP)
-
- _BeginUpdate
- _DrawDialog
- BSR OutlineButton
- _EndUpdate
-
- MOVE.L theEvent(A6),A0
- CLR.W (A0)
- BRA.S SFDoneFilter
-
- SFNotUpdate
- CMP.W #keyDwnEvt,(A0)
- BNE.S SFDoneFilter
-
- CMP.B #3,evtMessage+3(A0)
- BEQ.S SFHitButton
-
- CMP.B #13,evtMessage+3(A0)
- BNE.S SFDoneFilter
- SFHitButton
- MOVE.L theDialog(A6),-(SP)
- MOVE.W #1,-(SP)
- PEA scratch20
- PEA scratch20+2
- PEA scratch8
- _GetDItem
-
- MOVE.L scratch20+2,-(SP)
- BSR FlashControl
-
- MOVE.L itemHit(A6),A0
- MOVE.W #1,(A0)
- ADDQ.B #1,filtered(A6)
-
- SFDoneFilter
- UNLK A6
- MOVE.L (SP)+,A0 ;get return address
- ADD #12,SP ;pop off parameters
- JMP (A0)
-
-
- ;----------
- ;FlashControl - blink a control for 8 ticks
- ;----------
-
- FlashControl
- MOVE.L (SP)+,A0
- MOVE.L (SP)+,A1
- MOVE.L A0,-(SP)
-
- MOVE.L A1,-(SP)
- MOVE.L A1,-(SP)
-
- MOVE.W #1,-(SP)
- _HiliteControl
-
- MOVE.W #8,A0
- CLR.W -(SP)
- _HiliteControl ;Un-hilite the control
-
- RTS
-
- END
-
-