Creative SB0350 Hardware Programming Guide - Page 85
Creative SB0350 Manual
View all Creative SB0350 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 85 highlights
5-10 MIDI Port I/O Programming Sending MIDI Data Once in UART mode, MIDI data can be sent to an external MIDI device by writing to the Data port. Example code: mov inc Busy: in test jnz mov dec out al,dx al,40h Busy al,bMidiData dx dx,al ;Read status port ;Ready for output? ;No ;Get MIDI data ;Data Port ;Output MIDI data dx,wMpuBaseAddx dx ;MPU-401 base I/O address ;Status port Reading MIDI Data When MIDI data is available from an external MIDI device, it can be read in from the Data port. There are two modes used in detecting the availability of input data: polling and interrupt. When in polling mode, as before, input data is available when bit 7 of the Status port is zero. Conversely, when bit 7 is a one, no MIDI data is available. In interrupt mode, an interrupt occurs when a MIDI code is ready. An interrupt service routine has to be set up to retrieve the MIDI code. Reading from the Data port will clear the interrupt signal. The sequence for reading MIDI data is identical in both polling and interrupt modes. Below is a code fragment that can be used in either the polling routine or the interrupt service routine: mov inc Busy: in test jnz dec in al,dx al,80h Busy dx al,dx ;Read status port ;MIDI data available? ;No ;Data port ;Read MIDI data, and clear interrupt dx,wMpuBaseAddx dx ;MPU-401 base I/O address ;Status port Under the MPU-401 UART mode, there is no timing information available. It is up to the application to handle the timing for the MIDI data.