sys7.1-doc-wip/Toolbox/FontMgr/StartBass.a
2019-07-27 22:37:48 +08:00

107 lines
3.1 KiB
Plaintext

;
; File: StartBass.a
;
; Contains: This file checks to see if TrueType™ should be installed.
;
; Written by: Charlton E. Lui
;
; Copyright: © 1990 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <3> 10/15/90 CL Adding in ShowInit icon code. Added alert dialog messages.
; <2> 10/11/90 CL Fixing up DebugStrs since good ol JL changed them to MDebugStrs
; in SplineDefines.
; <2> 9/13/90 CL Adding DebugStr in instead of only the debugger to give more
; info in Macsbug to the user. Great user interface huh!
; <1> 9/10/90 CL first checked in
;
; To Do:
;
INCLUDE 'Traps.a'
INCLUDE 'SysEqu.a'
INCLUDE 'SplineDefines.a'
INCLUDE 'ToolEqu.a'
INCLUDE 'QuickEqu.a'
ALERT_SKIP EQU 0 ;skipping install because of mouse button
ALERT_WRONG_SYS EQU 1 ;wrong system
ALERT_SYS_ENV_ERR EQU 2 ;System environment error
ALERT_ALREADY_INSTALLED EQU 3 ;already installed
StartBass Proc Export
IMPORT SHOWINIT
MOVE.L #$A89F, D0 ;Unimplemented trap
_GetTrapAddress
MOVE.L A0, D1
MOVE.L #$A854, D0
_GetTrapAddress newTool ; see where trap is
CMP.L A0, D1
BNE.S @alreadyInstalled ; already installed us
SUB.L #SysEnvRec.sysEnv1Size, SP ; Make room for mySysRec
MOVE.L SP, A0 ; point to tempSysEnv record
MOVE.W #curSysEnvVers, D0 ; Get the current version
_SysEnvirons
BNE.S @sysEnvError
MOVE.W SysEnvRec.systemVersion(A0), D0 ; Get system version in D0
ADD.L #SysEnvRec.sysEnv1Size, SP ; Get rid of tempSysEnv record
CMP.W #$605, D0 ; Check if we are 6.0.5 or greater
BLT.S @wrongSystem
TST.B $172 ; mouse down then call debugger
BGE.S @skipInstall
MOVE.W #0, -(SP) ; icon id
MOVE.W #-1, -(SP) ; default movex
JSR SHOWINIT ; show it
MOVEQ #0, D0
RTS
@skipInstall
MOVE.W #ALERT_SKIP, D0 ; alert id
BRA.S @bail
@wrongSystem
MOVE.W #ALERT_WRONG_SYS, D0 ; alert id
BRA.S @bail
@sysEnvError
MOVE.W #ALERT_SYS_ENV_ERR, D0 ; alert id
BRA.S @bail
@alreadyInstalled
MOVE.W #ALERT_ALREADY_INSTALLED, D0 ; alert id
@bail
BSR.S InitWindEnvironment ; Init the window environ
CLR.W -(SP) ; show the About dialog
MOVE.W D0,-(SP) ; resource for alert dialog
CLR.L -(SP) ; no filter procedure used here
_Alert ; read the resource and display it
ADDQ #2, SP ;ignore errors
MOVEQ #-1, D0 ; Non-zero means do not load
RTS ; skip loading…
;
;
;
; PROCEDURE InitWindEnvironment;
;
; Call this when you want to display a window.
;
;
;
; Trashes Standard Pascal registers
;
InitWindEnvironment
MOVEM.L D0-D2/A0-A1,-(SP) ; save off those regs (for ErrorAlert)
MOVEQ #-1,D0 ; specify all events
_FlushEvents ; flush 'em
PEA -4(A5) ; @thePort (we're in an Appl environment)
_InitGraf ; init Quickdraw
_InitFonts ; fonts
_InitWindows ; windows
_TEInit ; text edit
CLR.L -(SP) ; Specify a NIL resume proc
_InitDialogs ; Init dialogs
MOVEM.L (SP)+,D0-D2/A0-A1 ; restore registers
RTS ; return to caller
ENDPROC
END