mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-29 20:49:19 +00:00
504 lines
12 KiB
Plaintext
504 lines
12 KiB
Plaintext
;
|
||
; File: MIDI.a
|
||
;
|
||
; Contains: xxx put contents here xxx
|
||
;
|
||
; Written by: xxx put writers here xxx
|
||
;
|
||
; Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
|
||
;
|
||
; This file is used in these builds: ROM System
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <7> 11/21/91 MH Move IMPORT directive out of the SndDispVersion macro
|
||
; <6> 11/11/91 MH Remove _MMGetClientIcon. This macro doesn't work because the
|
||
; selector nGetClientIcon is not defined. It looks like an
|
||
; inadvertant leftover from earlier days. The correct name for the
|
||
; macro is _MIDIGetClientIcon, which is already defined later in
|
||
; the file, with the selector midiGetClientIcon.
|
||
; <5> 6/14/91 JL Checked in official MPW 3.2ƒ version. Removed declaration of
|
||
; _SoundDispatch as an opword and the conditional.
|
||
; <4> 1/30/91 gbm sab, #38: Change the ‘already including this file’ variable to
|
||
; all uppercase (for security reasons)
|
||
;
|
||
; To Do:
|
||
;
|
||
|
||
; Version: 3.02
|
||
; Created: Friday, October 20, 1989 at 9:31:29 PM
|
||
|
||
;;;
|
||
;;; MIDI.a
|
||
;;;
|
||
;;; This file contains the assembly-language interface for the MIDI Manager.
|
||
;;;
|
||
;;; Author: John Worthington, Don Marsh, Mark Lentczner
|
||
;;; Copyright © 1988, Apple Computer, Inc.
|
||
;;; All Rights Reserved
|
||
;;;
|
||
|
||
IF &TYPE('__INCLUDINGMIDI__') = 'UNDEFINED' THEN
|
||
__INCLUDINGMIDI__ SET 1
|
||
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; Constants:
|
||
;;;
|
||
|
||
midiToolNum EQU 4 ; tool number of MIDI Mgr for SndDispVersion call.
|
||
midiMaxNameLen EQU 31 ; maximum number of characters in port and client names
|
||
|
||
|
||
; Time formats
|
||
|
||
midiFormatMSec EQU 0 ; milliseconds
|
||
midiFormatBeats EQU 1 ; beats
|
||
midiFormat24fpsBit EQU 2 ; 24 frames/sec.
|
||
midiFormat25fpsBit EQU 3 ; 25 frames/sec.
|
||
midiFormat30fpsDBit EQU 4 ; 30 frames/sec. drop-frame
|
||
midiFormat30fpsBit EQU 5 ; 30 frames/sec.
|
||
midiFormat24fpsQF EQU 6 ; 24 frames/sec. longInt format
|
||
midiFormat25fpsQF EQU 7 ; 25 frames/sec. longInt format
|
||
midiFormat30fpsDQF EQU 8 ; 30 frames/sec. drop-frame longInt format
|
||
midiFormat30fpsQF EQU 9 ; 30 frames/sec. longInt format
|
||
midiInternalSync EQU 0 ; internally synced
|
||
midiExternalSync EQU 1 ; externally synced
|
||
|
||
|
||
; Port types
|
||
|
||
midiPortTypeTime EQU 0 ; time port
|
||
midiPortTypeInput EQU 1 ; input port
|
||
midiPortTypeOutput EQU 2 ; output port
|
||
midiPortTypeTimeInv EQU 3 ; invisible time port
|
||
|
||
|
||
; OffsetTimes
|
||
|
||
midiGetEverything EQU $7FFFFFFF ; get all packets, regardless of time stamps
|
||
midiGetNothing EQU $80000000 ; get no packets, regardless of time stamps
|
||
midiGetCurrent EQU $00000000 ; get current packets only
|
||
|
||
|
||
|
||
;;;
|
||
;;; MIDI data and messages are passed in MIDIPacket records (see below).
|
||
;;; The first byte of every MIDIPacket contains a set of flags
|
||
;;;
|
||
;;; bits 0-1 00 = new MIDIPacket, not continued
|
||
;;; 01 = begining of continued MIDIPacket
|
||
;;; 10 = end of continued MIDIPacket
|
||
;;; 11 = continuation
|
||
;;; bits 2-3 reserved
|
||
;;;
|
||
;;;bits 4-6 000 = MIDIPacket contains MIDI data
|
||
;;; 001 = MIDIPacket contains MIDI Manager message
|
||
;;;
|
||
;;; bit 7 0 = MIDIPacket has valid stamp
|
||
;;; 1 = stamp with current clock
|
||
;;;
|
||
|
||
midiContMask EQU $03
|
||
midiNoCont EQU $00
|
||
midiStartCont EQU $01
|
||
midiMidCont EQU $03
|
||
midiEndCont EQU $02
|
||
midiTypeMask EQU $70
|
||
midiMsgType EQU $00
|
||
midiMgrType EQU $10
|
||
midiTimeStampMask EQU $80
|
||
midiTimeStampCurrent EQU $80
|
||
midiTimeStampValid EQU $00
|
||
|
||
|
||
; MIDI Manager MIDIPacket command words (the first word in the data field
|
||
; for midiMgrType messages)
|
||
|
||
midiOverflowErr EQU $0001
|
||
midiSCCErr EQU $0002
|
||
midiPacketErr EQU $0003
|
||
midiMaxErr EQU $00FF ; all command words less than this value
|
||
; are error indicators
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; valid results to be returned from readHooks
|
||
;;;
|
||
|
||
midiKeepPacket EQU 0
|
||
midiMorePacket EQU 1
|
||
midiNoMorePacket EQU 2
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; Errors:
|
||
;;;
|
||
|
||
midiNoClientErr EQU -250 ; no client with that ID found
|
||
midiNoPortErr EQU -251 ; no port with that ID found
|
||
midiTooManyPortsErr EQU -252 ; too many ports already installed in the system
|
||
midiTooManyConsErr EQU -253 ; too many connections made
|
||
midiVConnectErr EQU -254 ; pending virtual connection created
|
||
midiVConnectMade EQU -255 ; pending virtual connection resolved
|
||
midiVConnectRmvd EQU -256 ; pending virtual connection removed
|
||
midiNoConErr EQU -257 ; no connection exists between specified ports
|
||
midiWriteErr EQU -258 ; MIDIWritePacket couldn't write to all connected ports
|
||
midiNameLenErr EQU -259 ; name supplied is longer than 31 characters
|
||
midiDupIDErr EQU -260 ; duplicate client ID
|
||
midiInvalidCmdErr EQU -261 ; command not supported for port type
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; Driver calls:
|
||
;;;
|
||
|
||
midiOpenDriver EQU 1
|
||
midiCloseDriver EQU 2
|
||
|
||
|
||
|
||
;;; ________________________________________________________________________________
|
||
;;;
|
||
;;; MIDI data and other messages are read and written in packets:
|
||
;;;
|
||
|
||
MIDIPacket RECORD 0
|
||
flags DS.B 1
|
||
len DS.B 1
|
||
tStamp DS.L 1
|
||
data EQU *
|
||
ENDR
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; port information
|
||
;;;
|
||
|
||
MIDIIDRec RECORD 0
|
||
clientID DS.L 1
|
||
portID DS.L 1
|
||
ENDR
|
||
|
||
MIDIPortParams RECORD 0
|
||
portID DS.L 1 ; ID of port, unique within client
|
||
portType DS.W 1 ; Type of port - input, output, time, etc.
|
||
timeBase DS.W 1 ; refnum of time base, 0 if none
|
||
offsetTime DS.L 1 ; offset for current time stamps
|
||
readHook DS.L 1 ; routine to call when input data is valid
|
||
refCon DS.L 1 ; refcon for port (for client use)
|
||
sync DS.W 1 ; internal, external,other
|
||
curTime DS.L 1 ; current local time for the port
|
||
format DS.W 1 ; time code format in use
|
||
name DS.B 256 ; name of the port. This is a real live string, not a ptr.
|
||
|
||
size EQU * ; size of port params
|
||
ENDR
|
||
|
||
MIDIPortInfo RECORD 0
|
||
portType DS.W 1 ; type of port
|
||
timeBase DS.L 2 ; MIDIIDRec for time base
|
||
numConnects DS.W 1 ; number of connections
|
||
cList EQU * ; ARRAY [1..numConnects] of MIDIIDRec
|
||
ENDR
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; Clocks:
|
||
;;;
|
||
|
||
MIDIClkInfo RECORD 0
|
||
sync DS.W 1 ; 0 = internal, 1 = external
|
||
curTime DS.L 1 ; current value of port's clock
|
||
format DS.W 1 ; time code format
|
||
size EQU * ; size of MIDIClkInfo
|
||
ENDR
|
||
|
||
|
||
;;; _______________________________________________________________________________
|
||
;;;
|
||
;;; Equates for function selectors
|
||
;;;
|
||
|
||
midiVersion EQU 0
|
||
midiSignIn EQU 4
|
||
midiSignOut EQU 8
|
||
midiGetClients EQU 12
|
||
midiGetClientName EQU 16
|
||
midiSetClientName EQU 20
|
||
midiGetPorts EQU 24
|
||
midiAddPort EQU 28
|
||
midiGetPortInfo EQU 32
|
||
midiConnectData EQU 36
|
||
midiUnConnectData EQU 40
|
||
midiConnectTime EQU 44
|
||
midiUnConnectTime EQU 48
|
||
midiFlush EQU 52
|
||
midiGetReadHook EQU 56
|
||
midiSetReadHook EQU 60
|
||
midiGetPortName EQU 64
|
||
midiSetPortName EQU 68
|
||
midiWakeUp EQU 72
|
||
midiRemovePort EQU 76
|
||
midiGetSync EQU 80
|
||
midiSetSync EQU 84
|
||
midiGetCurTime EQU 88
|
||
midiSetCurTime EQU 92
|
||
midiStartTime EQU 96
|
||
midiStopTime EQU 100
|
||
midiPoll EQU 104
|
||
midiWritePacket EQU 108
|
||
midiWorldChanged EQU 112
|
||
midiGetOffsetTime EQU 116
|
||
midiSetOffsetTime EQU 120
|
||
midiConvertTime EQU 124
|
||
midiGetRefCon EQU 128
|
||
midiSetRefCon EQU 132
|
||
midiGetClRefCon EQU 136
|
||
midiSetClRefCon EQU 140
|
||
midiGetTCFormat EQU 144
|
||
midiSetTCFormat EQU 148
|
||
midiSetRunRate EQU 152
|
||
midiGetClientIcon EQU 156
|
||
|
||
|
||
;;; ________________________________________________________________________________
|
||
;;;
|
||
;;; Call Macros for Assembly
|
||
;;;
|
||
|
||
;;
|
||
;; fake _SndDispVersion which calls glue to make sure that the sound
|
||
;; dispatcher has been installed
|
||
;;
|
||
IMPORT SndDispVersion
|
||
|
||
MACRO
|
||
&label _SndDispVersion
|
||
&label JSR SndDispVersion
|
||
; call the sound dispatcher glue in MIDIGlue.o
|
||
ENDM
|
||
|
||
|
||
MACRO
|
||
&label _CallMIDIMgr &selector
|
||
&label MOVE.L #(&selector<<16)+midiToolNum,D0
|
||
_SoundDispatch
|
||
ENDM
|
||
|
||
|
||
MACRO
|
||
&label _MIDISignIn
|
||
&label _CallMIDIMgr midiSignIn
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISignOut
|
||
&label _CallMIDIMgr midiSignOut
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIVersion
|
||
&label _CallMIDIMgr midiVersion
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetClients
|
||
&label _CallMIDIMgr midiGetClients
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetClientName
|
||
&label _CallMIDIMgr midiGetClientName
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetClientName
|
||
&label _CallMIDIMgr midiSetClientName
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetPorts
|
||
&label _CallMIDIMgr midiGetPorts
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIAddPort
|
||
&label _CallMIDIMgr midiAddPort
|
||
MEND
|
||
|
||
|
||
MACRO
|
||
&label _MIDIGetPortInfo
|
||
&label _CallMIDIMgr midiGetPortInfo
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIConnectData
|
||
&label _CallMIDIMgr midiConnectData
|
||
MEND
|
||
|
||
|
||
MACRO
|
||
&label _MIDIUnConnectData
|
||
&label _CallMIDIMgr midiUnConnectData
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIConnectTime
|
||
&label _CallMIDIMgr midiConnectTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIUnConnectTime
|
||
&label _CallMIDIMgr midiUnConnectTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIFlush
|
||
&label _CallMIDIMgr midiFlush
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetReadHook
|
||
&label _CallMIDIMgr midiGetReadHook
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetReadHook
|
||
&label _CallMIDIMgr midiSetReadHook
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetPortName
|
||
&label _CallMIDIMgr midiGetPortName
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetPortName
|
||
&label _CallMIDIMgr midiSetPortName
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIWakeUp
|
||
&label _CallMIDIMgr midiWakeUp
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIRemovePort
|
||
&label _CallMIDIMgr midiRemovePort
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetSync
|
||
&label _CallMIDIMgr midiGetSync
|
||
MEND
|
||
|
||
|
||
|
||
|
||
|
||
MACRO
|
||
&label _MIDISetSync
|
||
&label _CallMIDIMgr midiSetSync
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetCurTime
|
||
&label _CallMIDIMgr midiGetCurTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetCurTime
|
||
&label _CallMIDIMgr midiSetCurTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIStartTime
|
||
&label _CallMIDIMgr midiStartTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIStopTime
|
||
&label _CallMIDIMgr midiStopTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIPoll
|
||
&label _CallMIDIMgr midiPoll
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIWritePacket
|
||
&label _CallMIDIMgr midiWritePacket
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIWorldChanged
|
||
&label _CallMIDIMgr midiWorldChanged
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetOffsetTime
|
||
&label _CallMIDIMgr midiGetOffsetTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetOffsetTime
|
||
&label _CallMIDIMgr midiSetOffsetTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIConvertTime
|
||
&label _CallMIDIMgr midiConvertTime
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetRefCon
|
||
&label _CallMIDIMgr midiGetRefCon
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetRefCon
|
||
&label _CallMIDIMgr midiSetRefCon
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetClRefCon
|
||
&label _CallMIDIMgr midiGetClRefCon
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetClRefCon
|
||
&label _CallMIDIMgr midiSetClRefCon
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetTCFormat
|
||
&label _CallMIDIMgr midiGetTCFormat
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetTCFormat
|
||
&label _CallMIDIMgr midiSetTCFormat
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDISetRunRate
|
||
&label _CallMIDIMgr midiSetRunRate
|
||
MEND
|
||
|
||
MACRO
|
||
&label _MIDIGetClientIcon
|
||
&label _CallMIDIMgr midiGetClientIcon
|
||
MEND
|
||
|
||
|
||
|
||
ENDIF ; ...already included |