mac-rom/Toolbox/CommToolbox/CommToolboxStartup/CommToolboxPatches.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

316 lines
11 KiB
Plaintext

;
; File: CommToolboxPatches.a
;
; Contains: CommToolbox linked patches
;
; Written by: Byron Han
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM5> 9/13/93 RC Turned off Two Gestalt Attr for CRM which were causing problems.
; <4> 8/12/93 kc <mb>: I deleted all of the "TheFuture" conditionals in all of
; the CommToolbox files per Mike Bell's instructions. I also had
; to delete some old code that was compiled under the "CubeE"
; conditional.
; <SM3> 7/6/92 PN Take out emCommToolboxGlobals and put it in the existing
; CTBBlock.
; <SM2> 6/30/92 PN Add init routines to allocate space for the dispatch table
; <18> 10/4/91 JSM Change PsychoticFarmerOrLater conditionals to TheFuture.
; <17> 10/2/91 DTY Conditionalise <14> through <16> out of CubeE.
; <16> 7/3/91 BH omitted setting gestaltTermMgrErrorString bit
; <15> 6/28/91 BH turn on all gestalt selectors since this is post 7.0
; <14> 6/26/91 BH added gestaltCRMPersistentFix constant for crm gestalt function
; <13> 1/14/91 CP added include for GestaltPrivateEqu.a <BBH>
; <12> 12/10/90 kaz Setting private gestalt flags (errorString & AsyncIO); cleaning
; up DEBUG stuff. <jng>
; <11> 8/6/90 BBH remove patch for CleanupAppplication()
; <10> 8/6/90 kaz Removed references to xxErrorString and cmMultiSyncIO.
; <9> 7/26/90 gbm add a new include file, one of the symbols moved...
; <8> 6/25/90 kaz Removed Gestalt code for CTB Managers bitmask and CTBUtils
; present. Added code for DITL extensions code (i.e. AppendDITL).
; <7> 6/23/90 kaz Fixed 'gestlalt' typo. Will return a GestaltUnknownError if
; 'ctb ' resource is not found.
; <6> 6/23/90 kaz Added stubs for all our Gestalt selectors.
; <5> 4/20/90 dba change SetupPorts so it calls RegisterBuiltInPorts directly
; instead of with a JSR; get rid of Gestalt dispatcher (useless on
; 7.0) and use GestaltÕs native features
; <4> 4/17/90 dba make COMMTOOLBOXDISPATCHER into a patch directly instead of
; using a JMP
; <3> 4/11/90 BBH ¥ Added code to initialize CommToolbox global and call InitCRM
; and InitCTBUtilities
; ¥ Added code to do modem and printer port registration
; ¥ Added gestalt installation code and created single CommToolbox
; gestalt function with selector table
; <2> 4/10/90 BBH change ExitToShell patch to CleanupApplication patch
; <1> 4/9/90 BBH first checked into project. This is test code only so far.
;
; To Do:
;
; Change SetupGestalt to read in a resource set and then create the gestalt functions
; and return values as appropriate
print push,off
load 'StandardEqu.d'
include 'MFPrivate.a'
include 'LinkedPatchMacros.a'
include 'GestaltEqu.a'
include 'GestaltPrivateEqu.a'
include 'CommToolboxPriv.a'
include 'CommResources.a'
include 'CTBUtilities.a'
print pop
;====================================================================================================
;====================================================================================================
;====================================================================================================
;¥¥¥ROMs Plus,SE,II,Portable,IIci <SM2>
;====================================================================================================
; this installs the CommToolbox dispatch mechanismÉ
;¥¥¥ MakePatch COMMTOOLBOXDISPATCHER,_CommToolboxDispatch <SM2>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;WARNING WARNING WARNING WARNING WARNING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; If you change ANYTHING in the header below you will need to change
;;; DispatchCde data structure in CommToolboxPriv.a, .h
;@Table
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
;
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
;
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
;
; DC.L 0
; DC.L 0
; DC.L 0
; DC.L 0
;
;@CTBrefnum DC.W 0 ; reference number of ctb file
;@BigModel DC.W 0 ; small or big memory model?
;====================================================================================================
; this sets up the CommToolbox global variable
SetupGlobals installproc
; allocate CommToolbox low memory and CommToolBoxTable
WITH CTBBlock ; allocate CTB low memory block
MOVE.L #CTBBlockSize,D0
_NewPtr ,Sys,Clear
MOVE.L A0,A1 ; save it
MOVE.L A1,CommToolboxGlobals ; stuff into low mem pointer
MOVEQ #(19*4),D0 ; ¥19 long entries <SM3>
_NewPtr ,Sys,Clear ; <SM3>
MOVE.L A0,CommToolBoxTable(A1) ; stuff pointer in our global <SM3>
; setup version
MOVE.W #CTBBlockVersion, version(A1)
; setup device queue
MOVE.L #10,D0 ; size of QHdr
_NewPtr ,Sys,Clear
MOVE.L A0, CRMQueue(A1) ; set up device queue
ENDWITH
SUBQ #4,SP ; leave space for return values
_InitCRM
_InitCTBUtilities
ADDQ #4,SP ; pop both return values
;Call RegisterBuiltInPorts
Import RegisterBuiltInPorts ;<SM2>
JSR RegisterBuiltInPorts ;<SM2>
rts
endproc
;====================================================================================================
; this sets up the gestalt selectors
SetupGestalt installproc
import getCTBVersion
import getCMAttr
import getFTAttr
import getTMAttr
import getCRMAttr
import getDITLAttr
import getPopupAttr
import getStdNBPAttr
; main gestalt selector ctb which returns in low word the version of the commtoolbox
;
leaResident getCTBVersion,A0 ; get gestalt function
MOVE.L #gestaltCTBVersion,D0 ; stuff selector
_NewGestalt
; main gestalt selector for Connection Mgr which returns the features as bits
;
leaResident getCMAttr,A0 ; get gestalt function
MOVE.L #gestaltConnMgrAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for File Transfer Mgr which returns the features as bits
;
leaResident getFTAttr,A0 ; get gestalt function
MOVE.L #gestaltFXfrMgrAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for Terminal Mgr which returns the features as bits
;
leaResident getTMAttr,A0 ; get gestalt function
MOVE.L #gestaltTermMgrAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for CommResource Mgr which returns the features as bits
;
leaResident getCRMAttr,A0 ; get gestalt function
MOVE.L #gestaltCRMAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for CTB Utilities Mgr which returns the features as bits
;
leaResident getDITLAttr,A0 ; get gestalt function
MOVE.L #gestaltDITLExtAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for Popup CDEF which returns the features as bits
;
leaResident getPopupAttr,A0 ; get gestalt function
MOVE.L #gestaltPopupAttr,D0 ; stuff selector
_NewGestalt
; main gestalt selector for StandardNBP which returns the features as bits
;
leaResident getStdNBPAttr,A0 ; get gestalt function
MOVE.L #gestaltStdNBPAttr,D0 ; stuff selector
_NewGestalt
rts
endproc
;====================================================================================================
; this sets up the builtin serial port registration
;¥¥¥ MakeInstall RegisterBuiltInPorts <SM2>
;====================================================================================================
; Gestalt Function
;
; register conventions
; D1 return value
; D0 is result
; OSErr GestaltFunction(long, long *);
CTBGestaltFunctions proc
export getCTBVersion
export getCMAttr
export getFTAttr
export getTMAttr
export getCRMAttr
export getDITLAttr
export getPopupAttr
export getStdNBPAttr
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getCTBVersion
CLR.L -(SP) ; get the version resource
MOVE.L #CTB_VersionType,-(SP)
MOVE.W #CTB_VersionID,-(SP)
_GetResource
MOVEA.L (SP)+,A1
MOVE.L A1,D0 ; error if nil?
beq.S stdUnknown
CLR.L D0 ; clear our return info
MOVE.L (A1),A0 ; dereference vers resource
MOVE.W (A0),D0 ; get the major/minor release
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getCMAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltConnMgrPresent,D0
BSET #gestaltConnMgrErrorString,D0
BSET #gestaltConnMgrMultiAsyncIO,D0
BSET #gestaltConnMgrCMSearchFix,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getFTAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltFXfrMgrPresent,D0
BSET #gestaltFXfrMgrMultiFile,D0
BSET #gestaltFXfrMgrErrorString,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getTMAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltTermMgrPresent,D0
BSET #gestaltTermMgrErrorString,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getCRMAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltCRMPresent,D0
; BSET #gestaltCRMToolRsrcCalls,D0
; BSET #gestaltCRMPersistentFix,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getDITLAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltDITLExtPresent,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getPopupAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltPopupPresent,D0
bra.s stdOK
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getStdNBPAttr ; features as bits
CLR.L D0 ; clear our gestalt value
BSET #gestaltStdNBPPresent,D0
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
stdOK
CLR.W D1 ; return noErr
BRA.S stdExit
stdUnknown
CLR.L D0 ; don't return garbage
MOVE.W #gestaltUnknownErr,D1 ; function result
; at this point, D1.W should contain function result
; and D0.L should contain result value to be passed backÉ
stdExit
result EQU $0004 ; stack frame information
selector EQU $0008
rval EQU $000C
MOVE.W D1, rval(sp) ; stuff function result
MOVE.L result(sp),A0 ; get pointer to result
MOVE.L D0,(A0) ; and put result in
MOVE.L (SP)+,A0 ; get return address
ADDQ #8,SP ; and strip parameters
JMP (A0) ; and we're outta here
RTS
endproc
end