mirror of
https://github.com/elliotnunn/sys7.1-doc-wip.git
synced 2024-05-31 13:41:30 +00:00
142 lines
6.3 KiB
Plaintext
142 lines
6.3 KiB
Plaintext
;
|
||
; Hacks to match MacOS (most recent first):
|
||
;
|
||
; <Sys7.1> 8/3/92 Restored the routines that were split off in <SM2>.
|
||
; 9/2/94 SuperMario ROM source dump (header preserved below)
|
||
;
|
||
|
||
;
|
||
; File: InvalMenuBarPatch.a
|
||
;
|
||
; Contains: implementation of the InvalMenuBar trap as a patch
|
||
;
|
||
; Written by: Darin Adler
|
||
;
|
||
; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
|
||
;
|
||
; This file is used in these builds: BigBang
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <SM2> 5/20/92 TN Moved new InvalMenuBar routines to MenuMgrExtensions.a
|
||
; <7> 4/16/91 KSM dba,#86852: Add reentrancy bit to fix case where Think Pascal
|
||
; patches DrawMenuBar to call HiliteMenu and we die in a recursive
|
||
; patch conflict.
|
||
; <6> 3/29/91 JSM dba, #85831: Add support for MenuBarGlobalInvalidBit in
|
||
; ValidateMenuBarWhenDrawing and ValidateMenuBar.
|
||
; <5> 7/25/90 dba fix bug that shows up in THINK Pascal (which patches DrawMenuBar
|
||
; to call HiliteMenu) by clearing the invalid bit before calling
|
||
; DrawMenuBar; also get rid of the patch to CheckUpdate that calls
|
||
; validate, since the Layer Manager’s CheckUpdate has a call
|
||
; inside of it now
|
||
; <4> 7/13/90 KSM Add ValidateMenuBar call for WindowMgr's CheckUpdate comefrom
|
||
; patch and to save a tiny bit of code.
|
||
; <3> 7/9/90 KSM Changed InvalMenuBar proc to use opword.
|
||
; <2> 6/7/90 EMT Fix module names so they won’t be likely to conflict with other
|
||
; patches.
|
||
; <1> 4/9/90 dba new to the system today
|
||
;
|
||
; To Do:
|
||
; roll into Menu Manager and Window Manager source
|
||
;
|
||
|
||
load 'StandardEqu.d'
|
||
include 'LinkedPatchMacros.a'
|
||
include 'MenuMgrPriv.a'
|
||
|
||
|
||
; <Sys7.1> Restored verbatim from MenuMgrExtensions.a
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; InvalMenuBar
|
||
|
||
; Set the low memory bit
|
||
|
||
InvalMenuBar PatchProc _InvalMenuBar,(Plus,SE,II,Portable,IIci)
|
||
|
||
bset #MenuBarInvalidBit,MenuBarInvalidByte ; set the invalid bit
|
||
rts
|
||
|
||
EndProc
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; DrawMenuBar clear MenuBarInvalidBit and MenuBarGlobalInvalidBit
|
||
;
|
||
; Note: We depend on the fact that this patch gets invoked after the Process Mgr patch that
|
||
; determines whether or not to actually draw the menu bar. Otherwise, we could clear the global
|
||
; dirty even if the DrawMenuBar never happens, which we don’t want to do.
|
||
|
||
; Clear the low memory bits whenever we draw the menu bar.
|
||
|
||
ValidateMenuBarWhenDrawing PatchProc _DrawMenuBar,(Plus,SE,II,Portable,IIci)
|
||
|
||
bclr #MenuBarInvalidBit,MenuBarInvalidByte ; clear the local invalid bit
|
||
bclr #MenuBarGlobalInvalidBit,MenuBarGlobalInvalidByte ; clear the global invalid bit <6>
|
||
jmpOld
|
||
|
||
EndProc
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; MenuSelect draw menu bar if invalid
|
||
|
||
DrawMenuBarIfInvalidOnMenuSelect PatchProc _MenuSelect,(Plus,SE,II,Portable,IIci)
|
||
|
||
IMPORT ValidateMenuBar
|
||
jsr ValidateMenuBar
|
||
jmpOld
|
||
|
||
EndProc
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; HiliteMenu draw menu bar if invalid
|
||
|
||
DrawMenuBarIfInvalidOnHiliteMenu PatchProc _HiliteMenu,(Plus,SE,II,Portable,IIci)
|
||
|
||
IMPORT ValidateMenuBar
|
||
jsr ValidateMenuBar
|
||
jmpOld
|
||
|
||
EndProc
|
||
|
||
; <Sys7.1> Restored verbatim from MenuMgrExtensions.a
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; ValidateMenuBar is the routine that draws the menu bar only if necessary (local or global dirty bit set)
|
||
;
|
||
; Note that the Process Mgr will not let the _DrawMenuBar through if we’re not the frontmost process.
|
||
;
|
||
; For the local dirty bit, we don’t care, since we’ll get redrawn anyway when we come to the front. This
|
||
; means we can clear it here to eliminate multiple calls to _DrawMenuBar that won’t do anything.
|
||
;
|
||
; However, we want to only test (not clear) the global dirty bit here, which is set by DrawMBARString, since
|
||
; we want to make sure the menu bar gets redrawn eventually no matter which app is at the front.
|
||
;
|
||
; To avoid problems where apps patch any of DrawMenuBar, HiliteMenu, MenuSelect (i.e., the routines
|
||
; herein that utilize ValidateMenuBar) and recurse forever trying to validate the menu bar, we
|
||
; use a semaphore. (THINK Pascal 3.0 was our orignal culprit.) Note the InstallProc below to
|
||
; initialize the semaphore to zero (meaning we are not in ValidateMenuBar).
|
||
|
||
InitValidateMenuBarSemaphore InstallProc (Plus,SE,II,Portable,IIci) ; <7>
|
||
|
||
bclr #ValidateMenuBarSemaphoreBit,ValidateMenuBarSemaphoreByte ; clear semaphore at startup
|
||
rts
|
||
|
||
EndProc
|
||
|
||
ValidateMenuBar Proc EXPORT
|
||
|
||
bset #ValidateMenuBarSemaphoreBit,ValidateMenuBarSemaphoreByte ; Check and set semaphore <7>
|
||
bnz.s @dontRecurse ; If set, then do nothing. <7>
|
||
bclr #MenuBarInvalidBit,MenuBarInvalidByte ; clear the local invalid bit
|
||
bnz.s @dirty ; draw menu bar if set <6>
|
||
btst #MenuBarGlobalInvalidBit,MenuBarGlobalInvalidByte ; check the global invalid bit <6>
|
||
bz.s @notDirty ; exit if not set <6>
|
||
@dirty
|
||
_DrawMenuBar
|
||
@notDirty
|
||
bclr #ValidateMenuBarSemaphoreBit,ValidateMenuBarSemaphoreByte ; Clear semaphore at exit <7>
|
||
@dontRecurse
|
||
rts
|
||
|
||
EndProc
|
||
|
||
end
|