mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-29 20:49:19 +00:00
549 lines
20 KiB
Plaintext
549 lines
20 KiB
Plaintext
;
|
||
; File: ScriptMgrMisc.a (formerly SMgrMisc.a)
|
||
;
|
||
; Contains: Miscellaneous Script Manager routines.
|
||
;
|
||
; Written by: JDT Joe Ternasky
|
||
; MED Mark Davis
|
||
; LDC Lee Collins
|
||
; PKE Peter Edberg
|
||
;
|
||
; Copyright: © 1986-1993 by Apple Computer, Inc., all rights reserved.
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <SM5> 5/21/93 CSS Delete body of SMgrCalRect as it is obsolete per P. Edberg's
|
||
; review. Leave an RTS so that the vector here still works.
|
||
; <SM4> 10/22/92 CSS Change some branch short instructions to word branches.
|
||
; <10> 6/12/92 FM Broke out the SMgrpostMunging routine into its own proc, and put
|
||
; it here. It used to be in ScriptMgrPatch.a. This way it can be
|
||
; used in the rom build without all the unecessary patch code for
|
||
; the GetOSEvent patch.
|
||
; <9> 5/31/92 FM Remove rom only version of PrintAction. It is in
|
||
; ScriptMgrExtensions now. I left in the forROM conditionals that
|
||
; cause the ScriptMgr to jump through vectors.
|
||
; <8> 4/29/92 JSM Get rid of conditionals: Don’t use smgrSysVers, smgrUseStdExit
|
||
; and ScriptMgrKeyboardMenu are always true. Leave forROM
|
||
; conditionals in for now until we fix the ROM build.
|
||
; <7> 12/10/91 PKE #1017754: Script Mgr Print Action dispatcher should leave
|
||
; ScriptRecord ptr in a0. For non-ROM builds, move PrintAction to
|
||
; ptch 27 for all CPUs. Delete some obsolete conditionalized code.
|
||
; <6> 12/15/90 PKE (gbm) Move ‘itlk’ loading from KeyScript into SwapKybd. Fixes
|
||
; bugs with some European keyboards when using Keyboard menu, etc.
|
||
; <5> 12/14/90 PKE (DC) Force SwapKybd to load 'KCHR' resources from System file.
|
||
; <4> 5/13/90 SMB Just ‘rts’ if SwapIcon is called. No one should still be calling
|
||
; it in 7.0, but just in case.... (better safe than sorry..)
|
||
; <3> 4/10/90 PKE Use smgrSysVers, smgrROMVers, forRom, doScriptMgrUseKscn, and
|
||
; doScriptMgrRstKCHRFix symbols instead of buildLevel. Deleted
|
||
; conditionalized def’n of forRom and SysVers. Fixed up header and
|
||
; tabs.
|
||
; <2> 3/20/90 EMT Removed unnecessary ROM85 references and oldMacTweek code.
|
||
; <1> 12/18/89 CCH Adding for the first time into BBS. Changed include 'inc.sum.a'
|
||
; to load 'StandardEqu.d'. Updated file name references.
|
||
;
|
||
; (BBS versions above, EASE versions below)
|
||
; <1.9> 11/17/89 PKE In ResetKCHR, clear KybdDriverData.deadKey as long, not word.
|
||
; <1.8> 9/18/89 PKE For 7.0, SwapIcon uses new type 'kscn' instead of 'SICN'.
|
||
; <1.7> 8/26/89 PKE Cleaned up conditionals.
|
||
; <1.6> 8/22/89 SES Removed references to nFiles.
|
||
; <1.5> 6/30/89 PKE NEEDED FOR AURORA: For ROM, SwapIcon & SwapKybd now dispatch
|
||
; through an internal vector.
|
||
; <1.4> 6/23/89 PKE Skip definition of buildLevel (done in ScriptPriv.a).
|
||
; <1.3> 2/21/89 PKE Replaced with RomProj version, which already had system and Rom
|
||
; sources merged.
|
||
; (EASE ROMproj versions below)
|
||
; <1.5> 2/21/89 PKE Fix up includes: always use include 'inc.sum.a'.
|
||
; <1.4> 2/14/89 PKE Updated to use MPW 3.0 final ScriptEqu.a equate names
|
||
; <1.3> 2/3/89 PKE Merged with current system sources (CCH's 01/16/1989 merge of
|
||
; 6.0.3 and 7.0 sources, done in RES.sys:smgr)
|
||
; <1.2> 11/14/88 PKE Synchronize EASE and Projector
|
||
; <1.1> 11/11/88 CCH Fixed Header.
|
||
; <1.0> 11/9/88 CCH Adding to EASE.
|
||
; (old EASE ROMproj versions below)
|
||
; <1.8> 10/31/88 CCH Added inside of ScriptPriv.a
|
||
; (EASE SYSproj versions below)
|
||
; <1.2> 2/14/89 PKE Updated to use MPW 3.0 final ScriptEqu.a equates
|
||
; <1.1> 1/16/89 CCH Merged 6.0.3 final sources into 7.0.
|
||
; <1.0> 11/16/88 CCH Added to EASE.
|
||
; (preEASE versions below)
|
||
; 10/13/88 ldc Added include of 'AppleDeskBusPriv.a'
|
||
; 10/10/88 ldc use inc.sum.a for rom
|
||
; 5/19/88 ldc standardized exit via StdUnlink
|
||
; ** changes above for ROM or sys $700 **
|
||
; 2/22/88 med Zap Ed’s keyboard if it is left around
|
||
; 8/21/87 med Used smgrGenFlags (field) as offset, not verb.
|
||
; 7/24/87 med SwapKybd was not saving D4
|
||
; 7/7/87 med Cleaned up adb equate usage
|
||
; 7/7/87 med Test for MBarHeight before drawing icon, test for smfShowIcon
|
||
; for showing icon always
|
||
; 5/21/87 med Was swapping keyboard using icon number
|
||
; 5/21/87 med Made fix to use adb.origADBAddr to test keyboard
|
||
; 3/9/87 med Minor equate change
|
||
; 2/28/87 med Expand keycache ptr if possible. Reset emKeyCache between copies.
|
||
; 2/27/87 med Changed test of ADB machine to be more robust, Used ExpandMem
|
||
; fields instead of SMgr fields
|
||
; 12/31/86 jdt Moved check on smgrEnabled <= 1 into SwapIcon.
|
||
; 12/28/86 jdt Fixed SwapIcon to save and restore the current GrafPort and the
|
||
; clipping region of the Window Manager port. Removed checks on
|
||
; ResErr after GetResources calls. Replaced resource constants
|
||
; with literals.
|
||
; 12/22/86 jdt Changed stack frames to include argument sizes. Removed WMgrPort
|
||
; clipping region stuff in SwapIcon. Replace event mask with
|
||
; constant.
|
||
; 12/9/86 jdt Created from initialization code..
|
||
;___________________________________________________________________________________________________
|
||
; To Do:
|
||
;
|
||
;___________________________________________________________________________________________________
|
||
|
||
load 'standardequ.d'
|
||
include 'ApplDeskBus.a'
|
||
include 'ScriptPriv.a'
|
||
|
||
hwCbADB EQU 10 ; Apple Desktop Bus present.
|
||
|
||
proc
|
||
blanks on
|
||
string asis
|
||
|
||
export SwapKybd ; swaps KCHR resource.
|
||
export SwapIcon ; swaps kscn resource.
|
||
|
||
import StdUnlink
|
||
|
||
export xSwapKybd,xSwapIcon ; <06/30/89 pke>
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; function: SwapIcon
|
||
; warning: This routine follows Pascal register conventions.
|
||
;
|
||
; SwapIcon blits the key script icon in the upper right corner of the screen,
|
||
; opposite the apple symbol in the menu bar. It only draws the icon if the
|
||
; menuList is not nil.
|
||
; ----------------------------------------------------------------------------
|
||
|
||
siRecord record {a6link},decr
|
||
return ds.l 1 ; return address.
|
||
a6link ds.l 1 ; old a6 register.
|
||
oldPort ds.l 1 ; saved GrafPtr.
|
||
oldClip ds.l 1 ; save region handle.
|
||
siLocals equ * ; size of local variables.
|
||
endr
|
||
SwapIconRegs reg a2-a3 ; swap regs
|
||
|
||
; Save the registers and link the stack. If the MenuBar handle is nil,
|
||
; the script manager is disabled, or there is only one script system, bail
|
||
; out without drawing the icon.
|
||
|
||
SwapIcon
|
||
IF forRom THEN ; <06/30/89 pke>
|
||
GetSMgrCore a0
|
||
move.l SmgrRecord.sVectSwapIcon(a0),a0 ; load address of routine
|
||
jmp (a0) ; jmp to it & return through it
|
||
ENDIF
|
||
|
||
xSwapIcon ; <06/30/89 pke>
|
||
rts
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; function: SwapKybd;
|
||
; warning: This routine follows Pascal register conventions.
|
||
;
|
||
; Loads the keyboard character table for the key script into the key cache.
|
||
; The keyboard is disabled while the swap is occurring, and all pending
|
||
; keyboard events are flushed from the queue before the keyboard is enabled
|
||
; again.
|
||
; ----------------------------------------------------------------------------
|
||
|
||
flushMask equ $0038 ; keyDwn, keyUp, and autoKey.
|
||
|
||
; Save the registers and load the script manager globals pointer.
|
||
;
|
||
; a3.l old Key Cache Pointer
|
||
; a2.l New KCHR handle.
|
||
; d4.l cache size ; <7/25/87med>
|
||
|
||
SwapKybdRegs reg a2/a3/d4 ; added d4 <7/25/87med>
|
||
|
||
SwapKybd
|
||
IF forRom THEN ; <06/30/89 pke>
|
||
GetSMgrCore a0
|
||
move.l SmgrRecord.sVectSwapKybd(a0),a0 ; load address of routine
|
||
jmp (a0) ; jmp to it & return through it
|
||
ENDIF
|
||
|
||
xSwapKybd ; <06/30/89 pke>
|
||
with smgrRecord,scriptRecord,ExpandMemRec
|
||
link a6,#0 ; link the stack.
|
||
movem.l SwapKybdRegs,-(sp) ; save the registers.
|
||
move.l expandMem,a3 ; load expandMemPtr
|
||
move.l emKeyCache(a3),a3 ; get pointer to key cache
|
||
|
||
; Load the new keyboard character resource from the system file. If we
|
||
; cannot find it, continue using the old keyboard character table.
|
||
|
||
@LoadKybd
|
||
move.w CurMap,-(sp) ; leave cur resfile refnum on stack <5>
|
||
clr.w -(sp) ; specify system file <5>
|
||
_UseResFile ; <5>
|
||
|
||
sub.l #4,sp ; make room for handle.
|
||
move.l #'KCHR',-(sp) ; push KCHR type.
|
||
GetSMgrCore a0 ; load smgrCore pointer.
|
||
move.w smgrKeyScript(a0),d0 ; get key script code.
|
||
lsl.w #2,d0 ; convert to long offset.
|
||
move.l smgrEntry(a0,d0.w),a0 ; get key script entry.
|
||
|
||
move.w scriptBundle.itlbKeys(a0),d4 ; save KCHR id number in d4… <6>
|
||
move.w d4,-(sp) ; and push it <6>
|
||
|
||
move.w #-1,RomMapInsert ; look for KCHR in ROM and load.
|
||
|
||
_GetResource ; get the KCHR resource.
|
||
move.l (sp)+,a2 ; load handle
|
||
move.l a2,d0 ; handle = nil?
|
||
|
||
bne.s @loadItlk ; no - go load itlk. Otherwise…
|
||
_UseResFile ; restore old resfile (refnum on stack) <5><6>
|
||
bra DoneKybd ; bail, keep old KCHR & itlk. <SM4> CSS
|
||
|
||
@loadItlk
|
||
; if we already have an itlk, dispose of it <6>
|
||
GetSMgrCore a0 ;
|
||
move.l smgrCurITLK(a0),d0 ; have old handle?
|
||
beq.s @noOld ; no -> skip dispose
|
||
clr.l smgrCurITLK(a0) ; clear the handle storage
|
||
move.l d0,a0 ; copy itlk handle
|
||
_DisposHandle ; dispose of the itlk
|
||
@noOld
|
||
; load the itlk resource, detach it, and store its handle <6>
|
||
subq #4,sp ; make room for handle
|
||
move.l #'itlk',-(sp) ; push resource type
|
||
move.w d4,-(sp) ; push resource ID number
|
||
_GetResource ; load the resource
|
||
move.l (sp)+,d0 ; found the itlk resource?
|
||
beq.s @noNew ; no -> skip installation
|
||
|
||
GetSMgrCore a0 ;
|
||
move.l d0,smgrCurITLK(a0) ; save new itlk handle
|
||
move.l d0,-(sp) ; push itlk handle
|
||
_DetachResource ; detach from system file
|
||
@noNew
|
||
; restore previous resource file
|
||
_UseResFile ; restore old resfile (refnum on stack) <5><6>
|
||
|
||
; Lock the KCHR down and reset all ADB keyboard devices to use it.
|
||
|
||
move.l a2,a0 ; load KCHR handle.
|
||
_HLock ; lock it down.
|
||
move.l (a2),-(sp) ; push pointer.
|
||
jsr ResetKCHR ; let ADB devices use it.
|
||
|
||
; Copy the new keyboard character table into the cache area. Then flush
|
||
; all pending keyboard events from the event queue. This can lead to a
|
||
; mysterious dropping of key presses, which has been known to upset Dave
|
||
; Kleinberg.
|
||
|
||
CopyKybd
|
||
move.l a2,a0 ; load resource handle.
|
||
_GetHandleSize ; find resource size.
|
||
|
||
; Check that we have enough room to copy.
|
||
|
||
move.l d0,d4 ; save size
|
||
move.l a3,a0 ; get the cache ptr
|
||
_GetPtrSize ; find size
|
||
cmp.l d0,d4 ; big enough?
|
||
blt.s @SkipResize ; yep, keep going
|
||
|
||
; cache too small: try getting enough room in the system heap
|
||
|
||
move.l d4,d0 ; pass new size
|
||
_NewHandle sys ; try to get it
|
||
bne.s @ResetKybd ; just not there, reset
|
||
_DisposHandle ; get rid of test handle
|
||
move.l a3,a0 ; get the cache ptr
|
||
_DisposPtr ; get rid of it
|
||
move.l d4,d0 ; get new size
|
||
_NewPtr sys,clear ; have to get it, since test succeeded
|
||
move.l a0,a3 ; set the cache ptr
|
||
|
||
@SkipResize
|
||
|
||
move.l (a2),a0 ; load resource pointer.
|
||
move.l a3,a1 ; load cache pointer.
|
||
move.l d4,d0 ; load size
|
||
_BlockMove ; copy keyboard table.
|
||
|
||
; Unlock the KCHR and tell the ADB keyboard devices to use the standard
|
||
; keyboard cache area.
|
||
|
||
@ResetKybd
|
||
|
||
move.l a3,-(sp) ; load cache pointer.
|
||
jsr ResetKCHR ; let ADB devices use it.
|
||
move.l a2,a0 ; load KCHR handle.
|
||
_HUnlock ; unlock it.
|
||
|
||
move.l #flushMask,d0 ; flush all keyboard events.
|
||
_FlushEvents ; die you wretched events.
|
||
|
||
; Restore the registers and return to the caller.
|
||
|
||
DoneKybd
|
||
movem.l (sp)+,SwapKybdRegs ; restore the registers.
|
||
unlk a6 ; unlink the stack.
|
||
rts ; return to the caller.
|
||
endWith ;
|
||
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; function: ResetKCHR(kchr: Ptr);
|
||
; input: (sp).l New KCHR pointer.
|
||
; warning: This routine follows Pascal register conventions.
|
||
;
|
||
; Steps through the ADB data structures and resets the KCHR pointer for all
|
||
; keyboard devices. This is only done if the current ROM supports the ADB.
|
||
; This code was ruthlessly stolen from Mark Davis.
|
||
; ----------------------------------------------------------------------------
|
||
|
||
rkRecord record {a6link},decr
|
||
rkArgs equ *-8 ; size of arguments.
|
||
pointer ds.l 1 ; new KCHR pointer.
|
||
return ds.l 1 ; return address.
|
||
a6link ds.l 1 ; old a6 register.
|
||
adb ds ADBDataBlock ; ADB data structure.
|
||
oldKeyboard ds.l 1 ; old keyboard pointer <2/22/88med>
|
||
rkLocals equ * ; size of local variables.
|
||
endr
|
||
|
||
ResetKCHRRegs reg d3
|
||
|
||
ResetKCHR
|
||
with rkRecord,expandMemRec
|
||
link a6,#rkLocals ; link the stack.
|
||
movem.l ResetKCHRRegs,-(sp) ; save the registers.
|
||
|
||
move.l ExpandMem,a0 ; get expanded memory
|
||
clr.l ExpandMemRec.emKeyDeadState(a0) ; clear dead key state. <7/7/87med>
|
||
move.l pointer(a6),ExpandMemRec.emKeyCache(a0) ; reset the pointer <7/7/87med>
|
||
|
||
move.l RomBase,a0 ; get rombase
|
||
tst.b 8(a0) ; possible ADB machine (>= 1)?
|
||
beq.s ResetDone ; no, bail
|
||
move.w HwCfgFlags,d0 ; hardware configuration
|
||
btst #HwCbADB,d0 ; is ADB present?
|
||
beq.s ResetDone ; no, bail
|
||
|
||
;; move.l ROMBase,a0 ; load ROM pointer.
|
||
;; cmp.w #$75,8(a0) ; newer than ROM75?
|
||
;; ble.s ResetDone ; no -> skip KCHR resetting.
|
||
|
||
; Loop through the ADB records, changing the KCHR pointer in all records
|
||
; belonging to keyboard devices.
|
||
|
||
_CountADBs ; load ADB count.
|
||
move.w d0,d3 ; copy count for loop.
|
||
bra.s @1 ; enter loop at bottom.
|
||
|
||
@0 move.w d3,d0 ; pass number.
|
||
add.w #1,d0 ; increment for 1 based number.
|
||
lea adb(a6),a0 ; pass record address.
|
||
_GetIndADB ; load device record.
|
||
cmp.b #kybdADBAddr,adb.origADBAddr(a6) ; is it a keyboard? Changed from D0 <5/14/87med>
|
||
bne.s @1 ; no -> skip it.
|
||
move.l adb.dbDataAreaAddr(a6),a0 ; load data area pointer. (adb+6) <7/7/87med>
|
||
|
||
clr.l KybdDriverData.deadKey(a0) ; clear dead state - long! <7/7/87med><1.9>
|
||
|
||
lea KybdDriverData.KCHRPtr(a0),a0 ; get pointer location <2/22/88med>
|
||
move.l (a0),oldKeyboard(a6) ; save old pointer <2/22/88med>
|
||
move.l pointer(a6),(a0) ; reset KCHR pointer. (20) <2/22/88med>
|
||
@1 dbra d3,@0 ; do the next ADB device.
|
||
|
||
; zap Tecot’s keyboard first time through <2/22/88med>
|
||
|
||
move.l expandMem,a1 ; globals
|
||
lea emFirstKeyboard(a1),a1 ; get location of byte
|
||
tst.b (a1) ; first time?
|
||
bne.s @FirstDone ; no, exit
|
||
st (a1) ; flag for posterity
|
||
move.l oldKeyboard(a6),a0 ; release
|
||
_RecoverHandle ; get back handle
|
||
tst.w MemErr ; any error?
|
||
bne.s @FirstDone ; if so, bail.
|
||
_DisposHandle ; get rid of it
|
||
@FirstDone
|
||
|
||
; Restore the registers, unlink the stack and return to the caller.
|
||
|
||
ResetDone
|
||
movem.l (sp)+,ResetKCHRRegs ; restore the registers.
|
||
|
||
;<5/19/88ldc> standardized exit
|
||
move.w #rkArgs, d0
|
||
bra StdUnlink
|
||
|
||
endProc
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; SMgrPostMunging
|
||
;
|
||
; This routine is called by both the xGetOSEvent patch in ptch 4 and from GetOSEvent in the
|
||
; ROM source.
|
||
;
|
||
; It expectes and EventPtr in A0
|
||
;
|
||
;
|
||
; This routine screens all events and determines when to change the key
|
||
; script. If it does change the key script, region symbol in the menu bar
|
||
; is redrawn.
|
||
; ----------------------------------------------------------------------------
|
||
modMask equ $fffb ; mask off capsLock key.
|
||
|
||
SMgrPostMunging proc export
|
||
with SMgrRecord
|
||
|
||
movem.l a0-a4/d0-d2,-(sp) ; save the registers.
|
||
GetSMgrCore a4 ; load SMgr globals. <4/26/88ldc>
|
||
move.l a0,a2 ; save the event pointer.
|
||
|
||
; If this is a keyDown event, check to see if the keyboard code and
|
||
; modifiers match any of the combinations in the keyboard swapping table.
|
||
|
||
FilterKey
|
||
cmp.w #keyDwnEvt,evtNum(a2) ; evtNum = keyDown?
|
||
beq.s @1 ; yes -> check message.
|
||
cmp.w #autoKeyEvt,evtNum(a2) ; evtNum = autoKey?
|
||
bne.s DoneEvent ; no -> bail out.
|
||
@1
|
||
move.l smgrKeySwap(a4),d0 ; swap table = nil?
|
||
beq.s DoneEvent ; yes -> skip key swapping.
|
||
move.l d0,a0 ; load swap table handle.
|
||
move.l (a0),a0 ; load swap table pointer.
|
||
move.l evtMessage(a2),d1 ; get event message
|
||
move.b evtMeta(a2),d1 ; get modifier keys.
|
||
and.w #modMask,d1 ; mask off alpha modifier.
|
||
@2
|
||
move.l (a0)+,d0 ; tuple = 0?
|
||
beq.s DoneEvent ; yes -> bail out.
|
||
cmp.w d0,d1 ; tuple = message?
|
||
bne.s @2 ; no -> try next tuple.
|
||
swap d0 ; get KeyScript verb.
|
||
|
||
; Change the current keyboard. Call KeyScript to load the new keyboard
|
||
; and to draw the keyboard icon in the menu bar. Remember to null out
|
||
; the event type and return that no events were available.
|
||
;
|
||
; Beginning with System 7, we only strip the event if it meaningful <12>
|
||
; in the current system - i.e., the KeyScript return code is true.
|
||
|
||
ScriptEvent
|
||
move.w d0,-(sp) ; push script code.
|
||
_KeyScript ; invoke the trap.
|
||
tst.b smgrKeyScriptResult(a4) ; Did KeyScript do something useful? <12>
|
||
beq.s DoneEvent ; if not, don't strip event <12>
|
||
move.w #nullEvt,evtNum(a2) ; null event type.
|
||
move.l MinusOne,(sp) ; return no event in d0. <was #MinusOne,
|
||
; fixed <02/28/89 pke>
|
||
; Restore the registers and return to the caller.
|
||
|
||
DoneEvent
|
||
movem.l (sp)+,a0-a4/d0-d2 ; restore the registers.
|
||
rts ; return to the caller.
|
||
|
||
endwith
|
||
endproc
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; routine: SMgrCalcRect
|
||
; input: none
|
||
; output: none
|
||
; trashes: a0 (in 7.0)
|
||
; warning: This routine is a trap patch for InitMenus.
|
||
; This routine saves all registers.
|
||
;
|
||
; This routine is obsolete.
|
||
; ----------------------------------------------------------------------------
|
||
|
||
SMgrCalcRect Proc Export
|
||
rts
|
||
endproc
|
||
|
||
; ----------------------------------------------------------------------------
|
||
; routine: SMgrFont
|
||
; input: none
|
||
; output: none
|
||
; warning: This routine is a trap patch for InitFonts.
|
||
; trashes none.
|
||
;
|
||
; This routine ensures that the system and application fonts are set to
|
||
; the fonts chosen by the system script.
|
||
; ----------------------------------------------------------------------------
|
||
|
||
fiSaveRegs reg a0/a2-a3/d0/d3
|
||
sGlb equ a2 ; register for Script Globals
|
||
disabCacheReq equ -2 ; disable cache request in CurFMInput
|
||
|
||
|
||
SMgrInitFonts proc export ; called from rom _InitFont
|
||
with smgrRecord,scriptRecord
|
||
|
||
movem.l fiSaveRegs,-(sp) ; save the registers.
|
||
GetSMgrCore sGlb ; get SM globals
|
||
|
||
IF forRom THEN
|
||
cmpa.l #-1,sGlb ; SMgr installed? <11/14/88 pke>
|
||
beq @skipInitFonts ; bail if not <11/14/88 pke>
|
||
ENDIF
|
||
|
||
; Set the system and application fonts from the script entry record of the system script.
|
||
; This is not done on original Macintosh ROMs.
|
||
|
||
move.b smgrFontForce(sGlb),-(sp) ; save the old value <3/4/87med>
|
||
sf smgrFontForce(sGlb) ; turn it off <3/4/87med>
|
||
|
||
tst.b smgrEnabled(sGlb) ; script manager disabled?
|
||
beq.s @noFonts ; yes -> bail out.
|
||
move.w smgrSysScript(sGlb),d3 ; get system script code.
|
||
move.w d3,d0 ; copy system script code.
|
||
lsl.w #2,d0 ; script code is long index.
|
||
move.l smgrEntry(sGlb,d0.w),a3 ; load system script entry.
|
||
|
||
clr.w -(sp) ; make room for script code.
|
||
move.w SysFontFam,-(sp) ; push system font number.
|
||
_Font2Script ; convert font to script.
|
||
cmp.w (sp)+,d3 ; code = system script?
|
||
|
||
bne.s @remapSysFont ; <06/05/89 pke, per med>
|
||
tst.b smgrDefault(sGlb) ; <06/05/89 pke, per med>
|
||
|
||
beq.s @noSysFont ; yes -> skip resetting.
|
||
@remapSysFont ; <06/05/89 pke>
|
||
move.w scriptSysFond(a3),SysFontFam ; set system font.
|
||
move.w #disabCacheReq,CurFMInput ; disable cache request <3/5/87med>
|
||
@noSysFont
|
||
clr.w -(sp) ; make room for script code.
|
||
move.w ApFontID,-(sp) ; push application font number.
|
||
_Font2Script ; convert font to script.
|
||
cmp.w (sp)+,d3 ; code = system script?
|
||
|
||
bne.s @remapAppFont ; <06/05/89 pke, per med>
|
||
tst.b smgrDefault(sGlb) ; <06/05/89 pke, per med>
|
||
|
||
beq.s @noAppFont ; yes -> skip resetting.
|
||
@remapAppFont ; <06/05/89 pke>
|
||
move.w scriptAppFond(a3),ApFontID ; set application font.
|
||
move.w #disabCacheReq,CurFMInput ; disable cache request <3/5/87med>
|
||
@noAppFont
|
||
@noFonts
|
||
|
||
move.b (sp)+,smgrFontForce(sGlb) ; restore the old value <3/4/87med>
|
||
@skipInitFonts ; <11/14/88 pke>
|
||
movem.l (sp)+,fiSaveRegs ; restore the registers.
|
||
rts ; return to the caller.
|
||
endWith
|
||
endProc
|
||
end
|
||
|