mirror of
https://github.com/elliotnunn/supermario.git
synced 2025-02-16 14:30:32 +00:00
77 lines
3.3 KiB
Plaintext
77 lines
3.3 KiB
Plaintext
;
|
||
; File: MenuMgrExtensions.a
|
||
;
|
||
; Contains: New Menu manager routines (stolen from InvalMenuBarPatch.a)
|
||
;
|
||
; Written by: Tim Nichols
|
||
;
|
||
; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
|
||
;
|
||
; This file is used in these builds: BigBang
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <1> 5/20/92 TN first checked in
|
||
;
|
||
; To Do:
|
||
;
|
||
|
||
load 'StandardEqu.d'
|
||
include 'LinkedPatchMacros.a'
|
||
include 'MenuMgrPriv.a'
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; InvalMenuBar
|
||
|
||
; Set the low memory bit
|
||
|
||
InvalMenuBar PatchProc _InvalMenuBar,(Plus,SE,II,Portable,IIci)
|
||
|
||
bset #MenuBarInvalidBit,MenuBarInvalidByte ; set the invalid bit
|
||
rts
|
||
|
||
EndProc
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; 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 |