mirror of
https://github.com/elliotnunn/supermario.git
synced 2025-02-26 02:29:04 +00:00
426 lines
12 KiB
Plaintext
426 lines
12 KiB
Plaintext
|
;
|
|||
|
; File: ConnectionMgr.a
|
|||
|
;
|
|||
|
; Contains: Entry to the Connection Manager
|
|||
|
;
|
|||
|
; Written by: Dean Wong, Byron Han, and Jerry Godes
|
|||
|
;
|
|||
|
; Copyright: © 1988-1991, 1993 by Apple Computer, Inc., all rights reserved.
|
|||
|
;
|
|||
|
; Change History (most recent first):
|
|||
|
;
|
|||
|
; <2> 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.
|
|||
|
; <11> 11/5/91 DTY Add __ to the front of the routines brought back for CubeE to
|
|||
|
; keep the build warningless.
|
|||
|
; <10> 10/2/91 DTY Conditionalise <7> out of CubeE.
|
|||
|
; <9> 6/26/91 BH forgot to change import declarations of extension routines to
|
|||
|
; include __’s
|
|||
|
; <8> 6/26/91 BH change extensions to use __ to distinguish from glue
|
|||
|
; <7> 6/18/91 BH remove new calls for open/close
|
|||
|
; <6> 1/14/91 CP ;Removed CMConnectPrep and added CMListenPrep and CMOpenPrep.
|
|||
|
; ;Removed param block from CMPBAccept, CMPBListen, CMPBClose,
|
|||
|
; CMPBOpen, and CMConnectCleanup.
|
|||
|
; ;Renamed CMFreeIORec to CMDisposeIOPB.
|
|||
|
; ;Renamed CMAllocateIORec to CMNewIOPB.
|
|||
|
; ;Added async, completor, and timeout parameters to CMListenPrep
|
|||
|
; and CMOpenPrep.
|
|||
|
; ;Renamed CMIORec to CMIOPB <BBH>
|
|||
|
; <5> 11/27/90 kaz Renaming CMHCalls to CMPBCalls; Added CMPBOpen, etc <jng>
|
|||
|
; <4> 8/27/90 kaz Use an offset table instead of a BRA table.
|
|||
|
; <3> 7/10/90 dba add __ to distinguish glue from actual routines
|
|||
|
; <2> 3/15/90 BBH fix names of included files
|
|||
|
; <1> 2/22/90 BBH first checked in to BBS
|
|||
|
;
|
|||
|
; To Do:
|
|||
|
;
|
|||
|
; Pre-BBS HISTORY :
|
|||
|
; 2/15/90 BBH CMGetErrorString moved to core
|
|||
|
; 1/26/90 BBH Added CMHRead/Write/IOKill
|
|||
|
; 8/14/89 BBH Added curCMversion. Renamed CMStatus to _CMStatus
|
|||
|
; 6/28/89 JNG Removed preflight/postflight from status.
|
|||
|
; 6/26/89 BBH Added CMPChoose
|
|||
|
; 6/2/89 JNG Finished Glue changes.
|
|||
|
; 5/24/89 JNG Glue routines now don't change the order of the parameters.
|
|||
|
; 4/29/89 JNG Converted CMStatus to assembler.
|
|||
|
; 4/24/89 BBH Added CMGetConnEnvirons
|
|||
|
; 4/24/89 JNG Removed CMResume CMMenu CMEvent CMActivate CMReset CMIdle
|
|||
|
; CMAbort to CTBCore
|
|||
|
; 4/18/89 JNG Removed CMGetProcID, CMSetupXXX to CTBCore
|
|||
|
; 4/17/89 JNG Removed CMValidate, CMDefault to CTBCore
|
|||
|
; 4/12/89 JNG Removed CMGetToolName to CTBCore
|
|||
|
; 4/11/89 JNG Removed CMGetRefCon, CMSetRefCon, CMSetUserData, CMGetUserData,
|
|||
|
; and CMGetVersion these are now in the CTBCore routines.
|
|||
|
; 4/7/89 JNG Changed CMGetConnName to CMGetToolName
|
|||
|
|
|||
|
INCLUDE 'Traps.a'
|
|||
|
|
|||
|
INCLUDE 'Connections.a' ; need curCMversion here
|
|||
|
INCLUDE 'CTBUtilities.a' ;
|
|||
|
INCLUDE 'ConnectionTools.a' ; Status needs the messages defined here
|
|||
|
INCLUDE 'CommToolboxPriv.a' ; for core routines
|
|||
|
|
|||
|
ENTRY _CMStatus
|
|||
|
|
|||
|
MACRO
|
|||
|
_ExternalCore &selector
|
|||
|
_RealExternalCore &selector,#CMSel
|
|||
|
ENDM
|
|||
|
;------------------------------------------------------------------------------------
|
|||
|
;
|
|||
|
; A0.L -> pointer to the routine selector record
|
|||
|
;
|
|||
|
; D0.L -> function result
|
|||
|
;
|
|||
|
CMEntry MAIN EXPORT
|
|||
|
IMPORT __InitCM, __CMNew, __CMDispose, __CMOpen, __CMListen, __CMAccept,\
|
|||
|
__CMClose, __CMRead, __CMWrite, __CMBreak, __CMGetConnEnvirons, \
|
|||
|
__CMAddSearch, __CMRemoveSearch, __CMClearSearch, __CMIOKill, \
|
|||
|
__CMNewIOPB, __CMDisposeIOPB, __CMPBRead, __CMPBWrite, \
|
|||
|
__CMPBIOKill
|
|||
|
|
|||
|
|
|||
|
BRA.S start
|
|||
|
version DC.W curCMversion ; version
|
|||
|
|
|||
|
start MOVE.W (A0), D1 ; routine selector
|
|||
|
ANDI.W #$FF, D1 ; bump the high byte
|
|||
|
SUB.W #1, D1 ; make it 0 based
|
|||
|
ADD.W D1, D1 ; 2 bytes per offset
|
|||
|
LEA CMStart, A1 ; point to offset table
|
|||
|
ADD.W 0(A1,D1.W), A1 ; add the offset
|
|||
|
JMP (A1) ; go there
|
|||
|
|
|||
|
; ASL.W #2, D1 ; multiply by 4
|
|||
|
;TABLE JMP TABLE(D1)
|
|||
|
|
|||
|
CMStart
|
|||
|
DC.W @InitCM - CMStart; 1
|
|||
|
DC.W @CMSetRefCon - CMStart; 2
|
|||
|
DC.W @CMGetRefCon - CMStart; 3
|
|||
|
DC.W @CMSetUserData - CMStart; 4
|
|||
|
DC.W @CMGetUserData - CMStart; 5
|
|||
|
DC.W @CMGetToolName - CMStart; 6
|
|||
|
DC.W @CMGetProcID - CMStart; 7
|
|||
|
DC.W @CMNew - CMStart; 8
|
|||
|
DC.W @CMDispose - CMStart; 9
|
|||
|
DC.W @CMIdle - CMStart; A
|
|||
|
DC.W @CMOpen - CMStart; B
|
|||
|
DC.W @CMListen - CMStart; C
|
|||
|
DC.W @CMAccept - CMStart; D
|
|||
|
DC.W @CMClose - CMStart; E
|
|||
|
DC.W @CMAbort - CMStart; F
|
|||
|
DC.W _CMStatus - CMStart; 10
|
|||
|
DC.W @CMRead - CMStart; 11
|
|||
|
DC.W @CMWrite - CMStart; 12
|
|||
|
DC.W @CMActivate - CMStart; 13
|
|||
|
DC.W @CMResume - CMStart; 14
|
|||
|
DC.W @CMMenu - CMStart; 15
|
|||
|
DC.W @CMReset - CMStart; 16
|
|||
|
DC.W @CMValidate - CMStart; 17
|
|||
|
DC.W @CMDefault - CMStart; 18
|
|||
|
DC.W @CMSetupSetup - CMStart; 19
|
|||
|
DC.W @CMSetupItem - CMStart; 1A
|
|||
|
DC.W @CMSetupCleanup - CMStart; 1B
|
|||
|
DC.W @CMGetConfig - CMStart; 1C
|
|||
|
DC.W @CMSetConfig - CMStart; 1D
|
|||
|
DC.W @CMIntlToEnglish - CMStart; 1E
|
|||
|
DC.W @CMEnglishToIntl - CMStart; 1F
|
|||
|
DC.W @CMGetVersion - CMStart; 20
|
|||
|
DC.W @CMGetCMVersion - CMStart; 21
|
|||
|
DC.W @CMSetupFilter - CMStart; 22
|
|||
|
DC.W @CMSetupPreflight - CMStart; 23
|
|||
|
DC.W @CMChoose - CMStart; 24
|
|||
|
DC.W @CMBreak - CMStart; 25
|
|||
|
DC.W @CMAddSearch - CMStart; 26
|
|||
|
DC.W @CMRemoveSearch - CMStart; 27
|
|||
|
DC.W @CMClearSearch - CMStart; 28
|
|||
|
DC.W @CMIOKill - CMStart; 29
|
|||
|
DC.W @CMEvent - CMStart; 2A
|
|||
|
DC.W @CMSetupPostflight - CMStart; 2B
|
|||
|
DC.W @CMGetConnEnvirons - CMStart; 2C
|
|||
|
DC.W @CMPChoose - CMStart; 2D
|
|||
|
DC.W @CMSetupXCleanup - CMStart; 2E
|
|||
|
|
|||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|||
|
; below this line are extensions
|
|||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|||
|
|
|||
|
DC.W @CMGetErrorString - CMStart; 2F
|
|||
|
DC.W @CMNewIOPB - CMStart; 30
|
|||
|
DC.W @CMDisposeIOPB - CMStart; 31
|
|||
|
DC.W @CMPBRead - CMStart; 32
|
|||
|
DC.W @CMPBWrite - CMStart; 33
|
|||
|
DC.W @CMPBIOKill - CMStart; 34
|
|||
|
|
|||
|
@CMSetRefCon ; 258
|
|||
|
_ExternalCore #$40A
|
|||
|
@CMGetRefCon ; 259
|
|||
|
_ExternalCore #$40B
|
|||
|
@CMSetUserData ; 260
|
|||
|
_ExternalCore #$40C
|
|||
|
@CMGetUserData ; 261
|
|||
|
_ExternalCore #$40D
|
|||
|
@CMGetVersion
|
|||
|
_ExternalCore #$40E
|
|||
|
@CMGetToolName ; 262
|
|||
|
_ExternalCore #$40F
|
|||
|
@CMValidate ; 279
|
|||
|
_ExternalCore #$410
|
|||
|
@CMDefault ; 280
|
|||
|
_ExternalCore #$411
|
|||
|
@CMSetupPreflight
|
|||
|
_ExternalCore #$412
|
|||
|
@CMSetupSetup
|
|||
|
_ExternalCore #$413
|
|||
|
@CMSetupFilter
|
|||
|
_ExternalCore #$415
|
|||
|
@CMSetupItem
|
|||
|
_ExternalCore #$414
|
|||
|
@CMSetupCleanup
|
|||
|
_ExternalCore #$416
|
|||
|
@CMSetupXCleanup
|
|||
|
_ExternalCore #$427
|
|||
|
@CMSetupPostflight ; 299
|
|||
|
_ExternalCore #$417
|
|||
|
@CMGetConfig
|
|||
|
_ExternalCore #$418
|
|||
|
@CMSetConfig
|
|||
|
_ExternalCore #$419
|
|||
|
@CMIntlToEnglish
|
|||
|
_ExternalCore #$41A
|
|||
|
@CMEnglishToIntl
|
|||
|
_ExternalCore #$41B
|
|||
|
@CMChoose
|
|||
|
_ExternalCore #$41C
|
|||
|
@CMPChoose
|
|||
|
_ExternalCore #$426
|
|||
|
@CMGetProcID ; 263
|
|||
|
_ExternalCore #$41D
|
|||
|
@CMResume
|
|||
|
_ExternalCore #$41E
|
|||
|
@CMMenu
|
|||
|
_ExternalCore #$41F
|
|||
|
@CMEvent ; 298
|
|||
|
_ExternalCore #$420
|
|||
|
@CMActivate
|
|||
|
_ExternalCore #$421
|
|||
|
@CMIdle
|
|||
|
_ExternalCore #$422
|
|||
|
@CMAbort
|
|||
|
_ExternalCore #$423
|
|||
|
@CMReset
|
|||
|
_ExternalCore #$424
|
|||
|
|
|||
|
@CMGetErrorString
|
|||
|
_ExternalCore #$428
|
|||
|
|
|||
|
|
|||
|
@InitCM CLR.W -(SP) ; make room
|
|||
|
JSR __InitCM
|
|||
|
MOVE.W (SP)+,D0 ; return it
|
|||
|
RTS
|
|||
|
|
|||
|
@CMNew CLR.L -(SP) ; make room
|
|||
|
MOVE.W 18(A0), -(SP) ; theProcID
|
|||
|
MOVE.L 14(A0), -(SP) ; theFlags
|
|||
|
MOVE.L 10(A0), -(SP) ; desiredSizes
|
|||
|
MOVE.L 6(A0), -(SP) ; theRefCon
|
|||
|
MOVE.L 2(A0), -(SP) ; theUserData
|
|||
|
JSR __CMNew
|
|||
|
MOVE.L (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMDispose MOVE.L 2(A0), -(SP) ; hConn
|
|||
|
JSR __CMDispose
|
|||
|
RTS
|
|||
|
|
|||
|
@CMOpen CLR.W -(SP) ; make room
|
|||
|
MOVE.L 12(A0), -(SP) ; hConn
|
|||
|
MOVE.W 10(A0), -(SP) ; theAsync
|
|||
|
MOVE.L 6(A0), -(SP) ; completor
|
|||
|
MOVE.L 2(A0), -(SP) ; timeout
|
|||
|
JSR __CMOpen
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMListen CLR.W -(SP) ; make room
|
|||
|
MOVE.L 12(A0), -(SP) ; hConn
|
|||
|
MOVE.W 10(A0), -(SP) ; theAsync
|
|||
|
MOVE.L 6(A0), -(SP) ; completor
|
|||
|
MOVE.L 2(A0), -(SP) ; timeout
|
|||
|
JSR __CMListen
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMAccept CLR.W -(SP) ; make room
|
|||
|
MOVE.L 4(A0), -(SP) ; hConn
|
|||
|
MOVE.W 2(A0), -(SP) ; accept
|
|||
|
JSR __CMAccept
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMClose CLR.W -(SP) ; make room
|
|||
|
MOVE.L 14(A0), -(SP) ; hConn
|
|||
|
MOVE.W 12(A0), -(SP) ; theAsync
|
|||
|
MOVE.L 8(A0), -(SP) ; completor
|
|||
|
MOVE.L 4(A0), -(SP) ; timeout
|
|||
|
MOVE.W 2(A0), -(SP) ; now
|
|||
|
JSR __CMClose
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMRead CLR.W -(SP) ; make room
|
|||
|
MOVE.L 26(A0), -(SP) ; hConn
|
|||
|
MOVE.L 22(A0), -(SP) ; theBuffer
|
|||
|
MOVE.L 18(A0), -(SP) ; toRead
|
|||
|
MOVE.W 16(A0), -(SP) ; theChannel
|
|||
|
MOVE.W 14(A0), -(SP) ; theAsync
|
|||
|
MOVE.L 10(A0), -(SP) ; completor
|
|||
|
MOVE.L 6(A0), -(SP) ; timeout
|
|||
|
MOVE.L 2(A0), -(SP) ; flags (VAR)
|
|||
|
JSR __CMRead
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMWrite CLR.W -(SP) ; make room
|
|||
|
MOVE.L 24(A0), -(SP) ; hConn
|
|||
|
MOVE.L 20(A0), -(SP) ; theBuffer
|
|||
|
MOVE.L 16(A0), -(SP) ; toWrite
|
|||
|
MOVE.W 14(A0), -(SP) ; theChannel
|
|||
|
MOVE.W 12(A0), -(SP) ; theAsync
|
|||
|
MOVE.L 8(A0), -(SP) ; completor
|
|||
|
MOVE.L 4(A0), -(SP) ; timeout
|
|||
|
MOVE.W 2(A0), -(SP) ; flags
|
|||
|
JSR __CMWrite
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMGetCMVersion LEA Version, A0
|
|||
|
MOVE.W (A0), D0 ; put version number
|
|||
|
RTS
|
|||
|
|
|||
|
@CMBreak ; 293
|
|||
|
MOVE.L 12(A0), -(SP) ; hConn
|
|||
|
MOVE.L 8(A0), -(SP) ; duration
|
|||
|
MOVE.W 6(A0), -(SP) ; async
|
|||
|
MOVE.L 2(A0), -(SP) ; completor
|
|||
|
JSR __CMBreak
|
|||
|
RTS
|
|||
|
|
|||
|
@CMAddSearch ; 294
|
|||
|
CLR.L -(SP) ; make room
|
|||
|
MOVE.L 12(A0), -(SP) ; hConn
|
|||
|
MOVE.L 8(A0), -(SP) ; theString
|
|||
|
MOVE.W 6(A0), -(SP) ; flags
|
|||
|
MOVE.L 2(A0), -(SP) ; callBack
|
|||
|
JSR __CMAddSearch
|
|||
|
MOVE.L (SP)+, D0 ; return point
|
|||
|
RTS
|
|||
|
|
|||
|
@CMRemoveSearch ; 295
|
|||
|
MOVE.L 6(A0), -(SP) ; hConn
|
|||
|
MOVE.L 2(A0), -(SP) ; refnum
|
|||
|
JSR __CMRemoveSearch
|
|||
|
RTS
|
|||
|
|
|||
|
@CMClearSearch ; 296
|
|||
|
MOVE.L 2(A0), -(SP) ; hConn
|
|||
|
JSR __CMClearSearch
|
|||
|
RTS
|
|||
|
|
|||
|
@CMIOKill ; 297
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 4(A0), -(SP) ; hConn
|
|||
|
MOVE.W 2(A0), -(SP) ; refnum
|
|||
|
JSR __CMIOKill
|
|||
|
MOVE.W (SP)+, D0 ; return point
|
|||
|
RTS
|
|||
|
|
|||
|
@CMGetConnEnvirons CLR.W -(SP) ; make room
|
|||
|
MOVE.L 6(A0), -(SP) ; hConn
|
|||
|
MOVE.L 2(A0), -(SP) ; (ptr to) environs
|
|||
|
JSR __CMGetConnEnvirons
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMNewIOPB
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 6(A0), -(SP) ; hConn
|
|||
|
MOVE.L 2(A0), -(SP) ; (ptr to) CMIOPBPtr
|
|||
|
JSR __CMNewIOPB
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
@CMDisposeIOPB
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 6(A0), -(SP) ; hConn
|
|||
|
MOVE.L 2(A0), -(SP) ; CMIOPBPtr
|
|||
|
JSR __CMDisposeIOPB
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMPBRead
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 8(A0), -(SP) ; hConn
|
|||
|
MOVE.L 4(A0), -(SP) ; CMIOPBPtr
|
|||
|
MOVE.B 2(A0), -(SP) ; async
|
|||
|
JSR __CMPBRead
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
@CMPBWrite
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 8(A0), -(SP) ; hConn
|
|||
|
MOVE.L 4(A0), -(SP) ; CMIOPBPtr
|
|||
|
MOVE.B 2(A0), -(SP) ; async
|
|||
|
JSR __CMPBWrite
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
|
|||
|
@CMPBIOKill
|
|||
|
CLR.W -(SP) ; make room
|
|||
|
MOVE.L 6(A0), -(SP) ; hConn
|
|||
|
MOVE.L 2(A0), -(SP) ; CMIOPBPtr
|
|||
|
JSR __CMPBIOKill
|
|||
|
MOVE.W (SP)+, D0
|
|||
|
RTS
|
|||
|
|
|||
|
|
|||
|
;pascal CMErr CMStatus( hConn, sizes, flags)
|
|||
|
|
|||
|
|
|||
|
_CMStatus FUNC
|
|||
|
|
|||
|
hConn EQU 10
|
|||
|
sizes EQU 6
|
|||
|
flags EQU 2
|
|||
|
LINK A6,#0
|
|||
|
MOVEM.L D2/A1,-(SP)
|
|||
|
|
|||
|
CLR.L -(SP) ; Call the defproc
|
|||
|
|
|||
|
MOVE.L hConn(A0),A1 ; Get the core handle
|
|||
|
|
|||
|
MOVE.L A1,-(SP) ; hCore
|
|||
|
MOVE.W #CMStatusMsg,-(SP) ; msg
|
|||
|
MOVE.L sizes(A0),-(SP) ; p1
|
|||
|
MOVE.L flags(A0),-(SP) ; p2
|
|||
|
CLR.L -(SP) ; p3
|
|||
|
|
|||
|
MOVE.L (A1),A1 ; Dereference core handle
|
|||
|
MOVE.L CTBDefProc(A1),A3 ; Finally call it
|
|||
|
JSR (A3)
|
|||
|
|
|||
|
MOVE.L (SP)+,D0 ; Give 'em the return value
|
|||
|
|
|||
|
MOVEM.L (SP)+,A1 ; Restore the world
|
|||
|
UNLK A6
|
|||
|
RTS
|
|||
|
|
|||
|
ENDFUNC
|
|||
|
|
|||
|
END
|