Creative SB0350 Programming Manual page 83

Hardware programming guide
Table of Contents

Advertisement

5-8
MIDI Port I/O Programming
Reset
The command byte 0FFh is used to reset the MPU-401 interface. After resetting the
interface, a Command Acknowledge byte, 0FEh, should be read back from the Data
port.
This mechanism can also be used to detect the existence of the MPU-401 interface.
After an interface reset, the data read in from the Data port should be verified to be
0FEh. If this fails, either the MPU-401 is not installed, or it does not exist at that I/O
address.
Example code:
Busy:
Empty:
NextLoop:
mov
dx,wMpuBaseAddx
inc
dx
in
al,dx
test
al,40h
jnz
Busy
mov
al,0FFh
out
dx,al
sub
cx,cx
in
al,dx
test
al,80h
jnz
NextLoop
dec
dx
in
al,dx
cmp
al,0FEh
je
ResetOK
inc
dx
loop
Empty
;***
;*** Failed to reset: MPU-401 not detected
;MPU-401 base I/O address
;Status port
;Read status port
;Ready for output?
;No
;Output "Reset" command
;
via Command port
;Maximum of 65536 tries
;Read status port
;Input data ready?
;No
;Data port
;Read data
;Successfully reset?
;SUCCESS!
;Status port
;Try again

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents