supermario/base/SuperMarioProj.1994-02-09/Toolbox/ScriptMgr/ScriptMgrUtil.a
2019-06-29 23:17:50 +08:00

217 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; File: ScriptMgrUtil.a (formerly SMgrUtil.a)
;
; Contains: Script Manager dispatcher and utility routines
;
; Written by: Joe Ternasky, September 13, 1986
;
; Copyright: © 1986-1990, 1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <8> 4/30/92 JSM ScriptMgrDispatch.a and ScriptMgrKeyGetSet.a now compiled
; separately for ROM builds, dont include them here, get rid of
; conditionals: smgrUseStdExit is always true. This file has no
; more conditionals.
; <7> 5/24/90 PKE Reorganized files: Moved ScriptUtil dispatcher and FontScript,
; Font2Script, IntlScript to new file ScriptMgrDispatch.a. This is
; included here (ptch 4) for 6.x, and included in
; ScriptMgrExtTail.a (ptch 27) for 7.0. In the latter case, we
; still have the BitBucket routines here because they are used by
; the RomanUtil dispatcher.
; <6> 5/11/90 PKE Expand dispatch table for new internal routine _AddScriptFonts.
; <5> 5/5/90 PKE Expand dispatch table for new internal routines InitScripts and
; InitKeybdMenu.
; <4> 4/10/90 PKE Use smgrSysVers, smgrROMVers, and forRom symbols instead of
; buildLevel. Deleted conditionalized definition of SysVers. Moved
; KeyScript, Get/SetEnvirons, and Get/SetScript into separate file
; ScriptMgrKeyGetSet.a which is included here. Started organizing
; for ROMification of 7.0 extensions. Add export of FontScript,
; IntlScript, Font2Script.
; <3> 3/20/90 EMT Removed unnecessary ROM85 references and oldMacTweek code.
; <2> 3/19/90 PKE Always export BitBucket and BitBucketReg. Use new feature
; conditionals smgrUseStdExit and smgrUseDispTablePtr. Deleted old
; definition: if forRom undefined, then forRom equ 0. Updated
; header to BBS format and fixed tabs.
; <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:)
; <2.7> 9/18/89 PKE Move KeyScript to ptch 27 so we can make a bug fix in itlk
; processing for both old and new ROMs. Change its vector here to
; be a dummy and stuff real address in ptch 27.
; <2.6> 9/17/89 PKE For 7.0, move Get/SetEnvirons and Get/SetScript to ptch 27.
; Change the vectors for these routines to be dummy vectors here;
; ptch 27 will stuff the real addresses.
; <2.5> 9/15/89 PKE Put in dummy vectors for TruncText, TruncString, ReplaceText,
; and, yes, NFindWord again (we'll allow a direct call with
; explicit specification of the break table, but the normal
; FindWord call won't use this vector). Use smLowCall60x instead
; of smLowCall for SysVers < $700, due to the fact that we can't
; conditionalize ScriptEqu.a (it is part of a dumpfile).
; <2.4> 9/5/89 PKE Delete the NFindWord vector space from the dummy address table
; created in 2.3, since we now have a different mechanism for
; getting to NFindWord.
; <2.3> 9/4/89 PKE Add dummy addresses for 7.0 routines to utilTable, to force
; allocation of space in dispatch table pointed to by
; smgrDispTable. The real routine addresses will be filled in
; later by SMgrExtTail.a (ptch 27).
; <2.2> 8/26/89 PKE Cleaned up some conditionals.
; <2.1> 8/22/89 SES Removed references to nFiles.
; <2.0> 6/30/89 PKE NEEDED FOR AURORA: Optimize table access in Get/SetEnvirons and
; Get/SetScript (from code review).
; <1.9> 6/23/89 PKE Add four verbs to GetScript/SetScript which correspond to new
; font&size information in ScriptRecord; skip definition of
; buildLevel (done in ScriptEqu.priv).
; <1.8> 6/5/89 PKE Fix comments in CommonMapping, (ROM & 7.0 only) change a bgt to
; a bpl
; <1.7> 4/26/89 PKE (ROM & 7.0 only) Change _ScriptUtil to use dispatch tables in
; RAM, accessed through pointer/limits in SmgrRecord.
; <1.6> 3/8/89 PKE Change a BEQ.S to BEQ so Big Bang builds.
; <1.5> 3/5/89 PKE Use KeyScript patch from KeyHack.a for Big Bang (as well as ROM)
; <1.4> 2/21/89 PKE Replaced with RomProj version, which already had system and Rom
; sources merged.
; (EASE ROMproj history 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 history below)
; <1.7> 10/27/88 LDC Mods by Carl Hewitt and Brian McGhie in the process of putting
; Script Manager in ROM
; (EASE SYSproj history below)
; <1.3> 2/14/89 PKE Updated to use MPW 3.0 final ScriptEqu.a equates
; <1.2> 1/30/89 PKE Fixed end of GetEnvirons to do "move.l d0,result(a6)" for all
; systems, not just SysVers>=$700.
; <1.1> 1/16/89 CCH Merged 6.0.3 final sources into 7.0.
; <1.0> 11/16/88 CCH Added to EASE.
; (pre-EASE history below)
; 10/10/88 ldc Added code to handle itlk resource
; 10/5/88 ldc Changed scriptFlags to scriptXFlags
; ** Changes above for ROM or buildLevel 2: **
; 6/24/88 ldc Added checking for EastAsian private verbs
; 5/19/88 ldc Added StdUnlink and StdExit
; 4/27/88 ldc Began vectorization of routines for move to ROM
; 1/27/88 med Rotate if Alternate scripts doesn't work; cleaned up flow of
; control
; 1/27/88 med CommonMapping: use faster test for non-Roman; use moveq instead
; of move.w
; 1/27/88 med ChgFont not tested properly in StdTxMeas!!!
; 1/6/88 med Added dispatch for FindScriptRun, PortionText
; 1/4/88 med Moved clear of selector high bit to under appTweak flag
; 1/4/88 med Strip high bit in bit-bucket routine
; 11/16/87 med Added dispatches
; 11/10/87 med Merged public verbs from RomanUtil into GetScript/SetScript
; 11/10/87 med Added BitBucketReg export
; 11/10/87 med Removed AISTweeks
; 11/10/87 med Fix IntlScript to force non-romans to system script, too
; 8/18/87 med Added smCharPortion verb
; 7/7/87 med Added verb entry in table for GetEnvirons of smGenFlags,
; smOverride
; 1/13/87 jdt Changed environment verb smAppScript to smLastScript. Modified
; KeyScript and added last script meta-number for quick toggling
; between two scripts.
; 12/23/86 jdt Changed name of KeyScript and fixed a deadly bug where a4 was
; used instead of a1 to find the Script Manager globals.
; 12/22/86 jdt Added the smBidirect verb to the GetEnvirons/SetEnvirons calls.
; Changed stack frames to include argument sizes. Saved space in
; GetEnvirons/SetEnvirons. Added constant for last environment
; verb. Fixed OldParamTable's Transliterate entry. Changed
; compatibility flag names. Saved space in aisTweaks tables.
; 12/3/86 jdt Added another check for old AIS script system (1.0). Additional
; code braketed by compatability flags.
; 11/25/86 jdt Added aisTweaks flags around Arabic 1.0 compatability hacks.
; Added appTweaks flags around application compatability hacks.
; 11/21/86 MED Added GetThePort macro in FontScript and IntlScript.
; 11/20/86 jdt Replaced standard equates load.
; 11/17/86 KWK Handles both old->new and new->old re-ordering of routines.
; 11/16/86 KWK Backwards compatibility is NEVER pretty. Added check for
; ScriptUtil called w/old-style selector. Added check for call to
; old AIS script system (1.0). Handles re-org of selector values.
; 10/25/86 jdt Reorganized the routine selectors. Added result and argument
; lengths to selectors. Conditional assembly directives around
; previous change.
; 10/24/86 KWK Sometimes programming isn't pretty...force 104 to Kanji so Excel
; works correctly (doesn't look for high fonds when setting up
; font dialog).
; 10/1/86 KWK Always toggle keyboard in KybdScript even if same as before.
; 9/14/86 JDT Threaded FontScript, IntlScript, and Font2Script together.
; 9/13/86 JDT Broke out ScriptUtil routines from initialization code.
;___________________________________________________________________________________________________
; To Do (old):
; Extend number of calls handled directly by script manager.
; Remove aisTweaks for AIS 1.0 sometime in the near future.
; Remove msTweaks for Microsoft sometime in the near future.
; Remove mpwTweaks for MPW sometime in the near future.
;___________________________________________________________________________________________________
load 'StandardEqu.d'
include 'ScriptPriv.a'
blanks on
string asis
proc
export StdUnlink, StdExit ; standard exit points
;<5/19/88ldc> Added StdUnlink StdExit
; ----------------------------------------------------------------------------
; StdUnlink, StdExit
; Standard point of return for script manager routines.
; Input
; d0 := number of arguments passed to returning routine
; sp := address of jump target routine
; ----------------------------------------------------------------------------
StdUnlink
unlk a6 ; unlink the stack.
StdExit
move.l (sp)+,a0 ; pop return address.
add.w d0,sp ; pop arguments.
jmp (a0) ; restore the stack.
; -------------------------End of StdExit-------------------------------------
endproc
proc
export BitBucket, BitBucketReg ; always export <2>
; ----------------------------------------------------------------------------
; routine BitBucket
; input (sp) return address
; 4(sp) selector
; function clean up stack and bail from routine
; ----------------------------------------------------------------------------
BitBucket
move.l (sp)+,a0 ; pop the return address.
move.l (sp)+,d0 ; pop the selector value.
; drop thru
; ----------------------------------------------------------------------------
; routine BitBucketReg
; input a0 return address
; d0 selector
; function clean up stack and bail from routine
; ----------------------------------------------------------------------------
BitBucketReg
swap d0 ; load the lengths.
clr.l d1 ; clear a long.
move.b d0,d1 ; isolate arguments length.
lsr.w #8,d0 ; isolate results length.
and.w #$7F,d0 ; strip high bit <1/4/88med>
add.w d1,sp ; pop the arguments.
move.l sp,a1 ; copy the stack pointer.
bra.s @2 ; enter loop at bottom.
@1 clr.b (a1)+ ; clear a byte.
@2 dbra d0,@1 ; do the next byte.
jmp (a0) ; return to the caller.
endProc
end