Sound Blaster Series Hardware Programming Guide Hardware Overview Digital Sound Processor Mixer MIDI Port
License Agreement/Limitation And Disclaimer Of Warranties PLEASE NOTE : BY DOWNLOADING AND/OR USING THE SOFTWARE AND/OR MANUAL ACCOMPANYING THIS LICENSE AGREEMENT, YOU ARE HEREBY AGREEING TO THE FOLLOWING TERMS AND CONDITIONS: The software and related written materials, including any instructions for use, are provided on an "AS IS" basis, without warranty of any kind, express or implied.
LIMITATION OF LIABILITY In no event will Creative Technology Ltd.
Contents Introduction What You Should Know...............................................................................................ix Scope and Manual Organization...................................................................................ix Document Conventions..................................................................................................x Determining User's Sound Blaster Card .....................................................................
Contents Sample Procedures ..................................................................................................3-10 General Procedures for a DMA mode Transfer.........................................3-11 Handling the DSP Digitized Sound I/O Interrupt .......................................3-11 8-bit Mono Single-cycle Transfer..............................................................3-12 8-bit Mono Auto-initialize Transfer ..........................................................
vi Contents Appendix A Sound Blaster I/O Address Maps SB1.5 I/O Address Map........................................................................................... A-2 SBMCV I/O Address Map ....................................................................................... A-3 SB2.0 I/O Address Map........................................................................................... A-4 SB2CD I/O Address Map.......................................................................................
List of Figures and Tables Figures Figure 1-1 Figure 1-2 Figure 1-3 Figure 1-4 Figure 1-5 Figure 3-1 Figure 3-2 Figure 3-3 Figure 3-4 Figure 3-5 Figure 4-1 Figure 4-2 Figure 4-3 Figure 4-4 Figure 4-5 Block Diagram of the Advanced Signal Processor......................................1-4 Block Diagram of the Sound Blaster 2.0......................................................1-6 Block Diagram of the Sound Blaster 2.0 CD Interface ................................1-7 Block Diagram of the Sound Blaster Pro.
Introduction This manual covers the hardware programming information for the following Sound Blaster cards: Sound Blaster Version 1.5 or earlier (SB1.5) TM Sound Blaster for Micro Channel Version (SBMCV) TM Sound Blaster Version 2.0 (SB2.0) TM Sound Blaster 2.
Introduction ix What You Should Know This manual assumes you are familiar with system level programming on the IBM PC. This includes programming knowledge of the Direct Memory Access (DMA) Controller, Programmable Interrupt Controller (PIC), and System Timer. Refer to "Relevant Information" in the appendix if you need more information on these subjects.
x Introduction Chapter 3, "Digitized Sound I/O Programming", describes the programming information for digitized sound I/O. This covers 8-bit and 16-bit, mono and stereo, high-speed and auto-initialize DMA programming. Chapter 4, "Mixer Chip Programming", discusses the essentials for control of the mixer chip. Chapter 5, "MIDI Port I/O Programming", discusses Sound Blaster MIDI Port and MPU-401 MIDI UART mode programming. Chapter 6, "DSP Commands", describes the DSP commands in detail.
Introduction To help you to locate and identify information easily, this manual uses visual cues and standard text formats. The following typographic conventions are used throughout this manual: Example Description Write-Buffer Status Bold letters are used for keywords or to emphasize certain words. CT-VOICE.DRV All capital letters indicate file names, directory names. placeholders Italic letters indicate placeholders. Italics may also be used to emphasize certain words.
xii Introduction The following DSP version notations will be used in the discussions: Version Notation Description 1.xx This means DSPs with major version number 1. 2.00 This means only the DSPs with version number 2.00. 2.01+ This means DSPs with major version number 2, version 2.00 is excluded. 3.xx This means DSPs with major version number 3. 4.xx. This means DSPs with major version number 4.
Introduction xiii Determining User's Card Settings Most of the Sound Blaster card settings are jumper selectable to avoid conflicts with other peripheral cards. To aid the application in determining the settings used by a Sound Blaster card, we have advocated the use of an environment variable called BLASTER. The user will set up this environment variable during card installation. The BLASTER environment variable specifies the base I/O address, interrupt and DMA channel used by the Sound Blaster card.
Chapter 1 Hardware Overview This chapter gives an overview of the hardware architecture of the Sound Blaster family of audio cards. It is meant for developers who intend to do hardware level programming. Major building blocks of the Sound Blaster family cards and their functionalities will be discussed. This chapter also covers the anatomy and block diagrams of Sound Blaster family of audio cards.
1-2 Hardware Overview Anatomy of Sound Blaster Family of Audio Cards This section describes the major building blocks of the Sound Blaster family of audio cards. The functionalities and features of the following components will be presented: Digital Sound Processor (DSP) chip Mixer chip FM Synthesizer chip Bus Interface chip Advanced Signal Processor Digital Sound Processor Chip The Digital Sound Processor chip is one of the most important components on the Sound Blaster card.
Hardware Overview 1-3 Different DSP versions are used on various versions of Sound Blaster family cards. Over the years, the functionality of the DSP has been greatly enhanced. The later versions of DSP are designed to be downward compatible with its earlier counterparts with new features introduced. Generally, the DSP versions can be classified under five majors categories: 1.xx , 2.00 , 2.01+ , 3.xx and 4.xx.
1-4 Hardware Overview Bus Interface Chip The Bus Interface Chip (CT1336) is responsible for providing handshake signals and data transfer between the ISA bus and various components on the Sound Blaster card. On Sound Blaster 16, it provides MPU-401 UART mode compatible MIDI, FIFOs for digital audio playback and recording, and interrupt channel sharing by three different processes (8-bit digitized sound, 16-bit digitized sound and MIDI).
Hardware Overview 1-5 These are the main features of the Advanced Signal Processor: 16-bit DSP core 16-bit x 16-bit => 32-bit Multiplier 192 x 16-bit of X-RAM 128 x 16-bit of Y-RAM 512 x 32-bit program memory RAM 512 x 16-bit data memory Serial I/O for digital audio data Runs at 12 MIPs The control of the Advanced Signal Processor, including downloading, is handled by a device-level driver called CSP.SYS.
1-6 Hardware Overview Block Diagrams for Sound Blaster Family of Audio Cards After presenting the introduction to the major building blocks of Sound Blaster cards, we will now present the block diagrams for SB2.0, SB2CD, SBPRO and SB16. JOYSTICK PORT MIDI PORT COMMAND/ DATA MIC CT1351 DSP ISA BUS CT1336 BUS INTERFACE CHIP AD/DA FILTER AGC LINE IN CONTROL FM SYNTHESIZER POWER AMP. CMS Figure 1-2: Block Diagram of the Sound Blaster 2.0 Note that the CMS chip is optional.
Hardware Overview 1-7 CD IN VOICE IN ISA BUS CT1335 Mixer Chip MUSIC IN Power Amp. ISA BUS CD Interface SPKR TO CD-ROM Drive Figure 1-3: Block Diagram of the Sound Blaster 2.0 CD Interface The SB2CD is the CD-ROM upgrade for SB2.0. It provides a CD-ROM interface which the SB2.0 does not have. It also includes an audio mixer for software volume control and a power amplifier.
1-8 Hardware Overview JOYSTICK PORT MIDI PORT COMMAND/ DATA FILTER VOICE DATA AGC CT1341 DSP ISA BUS CT1336 BUS INTERFACE CHIP MIC IN CONTROL CONTROL CONTROL CT1345 MIXER CHIP CD IN LINE IN FM SYNTHESIZER POWER AMP CD INTERFACE SPKR CD-ROM DRIVE Figure 1-4: Block Diagram of the Sound Blaster Pro Sound Blaster Pro is a 8-bit stereo sampling card with stereo mixer chip and CD-ROM interface built in. The DSP has been gradually enhanced to cover wider sampling range.
Hardware Overview 1-9 MIDI PORT SB and MPU-401 COMPATIBLE JOYSTICK PORT COMMAND/ MIC IN DATA CT1741 DSP (Mono) CT1745 ISA BUS CT1746 BUS INTERFACE CHIP CD IN (Stereo) MIXER CHIP LINE IN 16-bit AD/DA CT1748 CSP (Stereo) PC-SPKR CONTROL (Mono) LINE-OUT (Stereo) FM SYNTEHSIZER CD INTERFACE WAVE BLASTER POWER AMP SPKR CR-ROM DRIVE Figure 1-5: Block Diagram of the Sound Blaster 16 Advanced Signal Processing Sound Blaster 16 Advanced Signal Processing is a 16-bit stereo sampling card.
Chapter 2 Introduction to DSP Programming This chapter discusses the essentials for programming the Creative Digital Sound Processor (DSP). The DSP chip handles digitized sound I/O and MIDI operations. You must read this chapter carefully to ensure you understand the characteristics of the DSP before you proceed to program digitized sound or MIDI operations.
2-2 Introduction to DSP Programming DSP I/O Addresses The DSP is programmed through four selectable I/O addresses on the Sound Blaster cards. The following lists the I/O addresses and their functionalities. x represents the jumper selectable base I/O addresses. Reset Used to reset the DSP to its default state. Write Command/Data 2x6h (write only) 2xAh (read only) 2xCh (write) Write-Buffer Status 2xCh (read) Also indicates whether the DSP is ready to accept commands or data.
Introduction to DSP Programming 2-3 Sound Blaster card may not be installed or an incorrect I/O address is being used. You should exit the reset process and declare an error.
2-4 Introduction to DSP Programming Writing to DSP DSP commands and data are sent through the Write Command/Data port. Before data is written to the DSP, bit-7 of the Write-Buffer Status port must be checked to ensure that the DSP command/data buffer is empty. If bit-7 is 0, the DSP buffer is empty and is ready to receive commands or data. Otherwise, no commands or data should be written to the DSP.
Introduction to DSP Programming 2-5 Sharing of Interrupts With DSP version 4.xx, four interrupts use the same Interrupt Request (IRQ) line. These are the 8-bit and 16-bit DMA mode digitized sound I/O, Sound Blaster MIDI (SB-MIDI), and MPU-401 MIDI UART mode interrupts. The Interrupt Status register, addressed as register 82h on the Mixer register map, is used by the ISR to determine whether the interrupt is meant for it or for some other ISR, in which case it should chain to the previous routine.
2-6 Introduction to DSP Programming The following assembly code fragment illustrates the interrupt handling portion within a 16-bit DMA mode digitized sound I/O ISR: mov add mov out inc in test interrupt? jz dx,wSB16BaseAddx dl,4 al,82h dx,al dx al,dx al,02h ; SB16 base I/O address 2x0h ; Mixer register address port 2x4h ; Index for Interrupt Status register ; Mixer data port ; Get interrupt status ; 16-bit DMA-mode digitized sound I/O ChainPreviousISR ; No, chain to previous ISR ;*** ;*** 1).
Introduction to DSP Programming 2-7 The byte from register 81h is interpreted as follows: D7 D6 D5 DMA 7 DMA 6 DMA 5 D4 D3 D2 DMA 3 D1 D0 DMA 1 DMA 0 where the grayed areas denote reserved bits. To configure the DMA channel settings, set the corresponding interrupt bit to '1' to select the DMA channel. Note that only a bit on the 16-bit DMA channel (DMA5, DMA6 or DMA7) can be set on at any one time. This applies for the 8-bit DMA channel (DMA0, DMA1 or DMA3). DSP version 4.
Chapter 3 Digitized Sound I/O Programming This chapter discusses the techniques of programming the DSP for digitized sound I/O and introduces the operational methods and modes available. It assumes that you have some working knowledge on programming the DMA controller and the Programmable Interrupt Controller. This chapter is divided into two sections. The first section describes the various digitized sound operation modes.
3-2 Digitized Sound I/O Programming Digitized Sound Operation Modes This section describes the digitized sound data format and various digitized sound operation modes available on the DSP.
Digitized Sound I/O Programming 3-3 The order of the data varies between 8-bit and 16-bit data, and mono and stereo formats.
3-4 Digitized Sound I/O Programming Digitized Sound I/O Transfer Rate Other than direct mode, all the digitized sound I/O operation modes require the transfer rate to be set before any transfer is carried out. To set the transfer rate, you may either program the DSP with the respective transfer rate Time Constant (supported by all DSP versions), or program the DSP with the actual sampling rate (only available on DSP version 4.xx). In the former case, a simple conversion has to be done first.
Digitized Sound I/O Programming 3-5 Single-cycle DMA Mode In single-cycle DMA mode digitized sound I/O transfer, the DSP is programmed to make one transfer only. The DSP will generate an interrupt to signal the application at the end of the transfer. Due to DMA constraints, the digitized sound data transfer cannot straddle a 64 KB physical page boundary.
3-6 Digitized Sound I/O Programming There are two ways to terminate auto-initialize DMA mode transfer: 1. Program the DSP to switch to single-cycle DMA mode transfer. At the end of the current block transfer, the DSP will exit from auto-initialize DMA mode and continue to transfer using the specified single-cycle DMA mode. 2. Send the exit auto-initialize command; the DSP will exit auto-initialize DMA mode at the end of current block and terminate the transfer.
Digitized Sound I/O Programming 3-7 ADPCM DMA mode The compression technique used by the DSP is known as ADPCM (Adaptive Delta Pulse Code Modulation). This technique stores the difference between data values instead of the actual data. The DSP supports decompression in the output process only. The first byte of the compressed data is always a reference byte. It is not ADPCM code but an actual data byte value. This byte is used by the DSP as a reference during the data decompression.
3-8 Digitized Sound I/O Programming DSP Digitized Sound I/O Capability Because the DSP is periodically enhanced, the capabilities of the DSP particularly with regard to the sampling rates and DMA operation modes, have varied among the different versions. The table below lists the DMA operation modes supported by different versions of the DSP: DMA Operation Mode DSP Version 2.01+ 3.xx 1.xx 2.
Digitized Sound I/O Programming 3-9 The tables below list the sampling ranges for the supported DMA modes among the various DSP versions. Normal on the "Transfer Mode" column refers to non highspeed DMA mode. You must take note of the information below when programming for the different versions of the DSP. Digitized Sound Output Capability DSP Version Transfer Mode Data Format Sampling Range 4.
3-10 Digitized Sound I/O Programming Digitized Sound Input Capability DSP Version Transfer Mode Data Format Sampling Range 4.xx Mono/Normal Mono/Normal Stereo/Normal Stereo/Normal 8-bit unsigned 16-bit signed 8-bit unsigned 16-bit signed 5000 to 44100 Hz 5000 to 44100 Hz 5000 to 44100 Hz 5000 to 44100 Hz 3.xx Mono/Normal Mono/High-Speed Stereo/High-Speed 8-bit unsigned 8-bit unsigned 8-bit unsigned 4000 to 23000 Hz 23000 to 44100 Hz 11025 and 22050 Hz 2.
Digitized Sound I/O Programming 3-11 Sample Procedures This section provides step by step procedures needed to perform the various DMA modes of digitized sound operations described in the first section.
3-12 Digitized Sound I/O Programming General Procedures for a DMA mode Transfer The general steps for programming the DSP for digitized sound data transfer in DMA mode is as follows: 1. Set up the interrupt service routine. 2. Program the DMA controller. 3. Program the DSP sampling rate. 4. Program the DSP with the DMA transfer mode and length to start I/O transfer. 5. Service DSP interrupts. 6. Restore the original interrupt service routine.
Digitized Sound I/O Programming 3-13 8-bit Mono Single-cycle Transfer The following are the steps needed to perform 8-bit mono PCM and ADPCM singlecycle DMA mode transfer: 1. Set up the DSP interrupt service routine. 2. Enable the interrupt used. 3. Turn on the DAC speaker for digitized output. Otherwise, turn it off. to turn off the DAC speaker outp(wSBCBaseAddx+0xC, 0xD3) to turn on the DAC speaker outp(wSBCBaseAddx+0xC, 0xD1) 4.
3-14 Digitized Sound I/O Programming When the DSP sends an interrupt, the following steps should be done in the interrupt service routine: 1. Program the DMA controller for the next block. 2. Program the DSP for the next block. outp(wSBCBaseAddx+0xC, bCommand) outp(wSBCBaseAddx+0xC, wLength.LowByte) outp(wSBCBaseAddx+0xC, wLength.
Digitized Sound I/O Programming 3-15 8-bit Mono Auto-initialize Transfer The following are the steps needed to perform 8-bit mono PCM and ADPCM auto-initialize DMA mode transfer: 1. Allocate a DMA buffer in contiguous memory without straddling a 64KB physical page boundary. Use an 8KB buffer as an example. 2. Set up the DSP interrupt service routine. 3. Enable the interrupt used. 4. Turn on the DAC speaker for digitized output. Otherwise, turn it off.
3-16 Digitized Sound I/O Programming When the DSP sends an interrupt, the following steps should be done in the interrupt service routine: 1. Transfer data between the DMA buffer and the storage buffer. To stop auto-initialize DMA mode, you can either send the exit auto-initialize DMA mode command or program the DSP for single-cycle DMA mode transfer. 2a. Send the exit auto-initialize DMA command.
Digitized Sound I/O Programming 3-17 8-bit Mono High-Speed Single-cycle Transfer The following are the steps needed to perform 8-bit mono PCM high-speed singlecycle DMA mode transfer: 1. Set up the DSP interrupt service routine. 2. Enable the interrupt used. 3. Turn on the DAC speaker for digitized output. Otherwise, turn it off. to turn off the DAC speaker outp(wSBCBaseAddx+0xC, 0xD3) to turn on the DAC speaker outp(wSBCBaseAddx+0xC, 0xD1) 4.
3-18 Digitized Sound I/O Programming At the end of data transfer: 1. Turn off the DAC speaker. outp(wSBCBaseAddx+0xC, 0xD3) 2. Disable the interrupt used. 3. Restore the original interrupt service routine. During high-speed DMA mode data I/O, the DSP will not accept any commands. Hence, to stop data transfer before the end of a block, send the reset DSP command.
Digitized Sound I/O Programming 3-19 8-bit Mono High-Speed Auto-initialize Transfer The following are the steps needed to perform 8-bit mono PCM high-speed autoinitialize DMA mode transfer: 1. Allocate a DMA buffer in contiguous memory without straddling a 64KB physical page boundary. Use an 8KB buffer as an example. 2. Set up the DSP interrupt service routine. 3. Enable the interrupt used. 4. Turn on the DAC speaker for digitized output. Otherwise, turn it off.
3-20 Digitized Sound I/O Programming To stop high-speed auto-initialize DMA mode, send the reset DSP command. At the end of data transfer: 1. Turn off the DAC speaker. outp(wSBCBaseAddx+0xC, 0xD3) 2. Disable the interrupt used. 3. Restore the original interrupt service routine. 4. Release the allocated DMA buffer.
Digitized Sound I/O Programming 3-21 8-bit Stereo High-speed Single-cycle Transfer The following are the steps needed to perform 8-bit stereo PCM high-speed singlecycle DMA mode transfer: 1. Set up the DSP interrupt service routine. 2. Enable the interrupt used. 3. Turn on the DAC speaker for digitized output. Otherwise, turn it off. to turn off the DAC speaker outp(wSBCBaseAddx+0xC, 0xD3) to turn on the DAC speaker outp(wSBCBaseAddx+0xC, 0xD1) 4. Set the hardware to stereo mode. a.
3-22 Digitized Sound I/O Programming 8. Set the DSP block transfer size. outp(wSBCBaseAddx+0xC, 0x48) outp(wSBCBaseAddx+0xC, wBlkSize.LowByte) outp(wSBCBaseAddx+0xC, wBlkSize.HighByte) wBlkSize is one less than the actual transfer size. 9. Send an I/O command to start high-speed single-cycle DMA mode transfer.
Digitized Sound I/O Programming 3-23 8-bit Stereo High-Speed Auto-initialize Transfer The following are the steps needed to perform 8-bit stereo PCM high-speed autoinitialize DMA mode transfer: 1. Allocate a DMA buffer in contiguous memory without straddling a 64KB physical page boundary. Use an 8KB buffer as an example. 2. Set up the DSP interrupt service routine. 3. Enable the interrupt used. 4. Turn on the DAC speaker for digitized output. Otherwise, turn it off.
3-24 Digitized Sound I/O Programming 9. Set the DSP block transfer size. outp(wSBCBaseAddx+0xC, 0x48) outp(wSBCBaseAddx+0xC, wBlkSize.LowByte) outp(wSBCBaseAddx+0xC, wBlkSize.HighByte) wBlkSize is one less than the actual transfer size. 10. Send an I/O command to start high-speed auto-initialize DMA mode transfer.
Digitized Sound I/O Programming 3. 3-25 Turn off the DAC speaker. outp(wSBCBaseAddx+0xC, 0xD3) 4. Disable the interrupt used. 5. Restore the original interrupt service routine. 6. Release the allocated DMA buffer. During high-speed DMA mode data I/O, the DSP will not accept any further commands. Hence, to stop data transfer before the end of a block, send the reset DSP command.
3-26 Digitized Sound I/O Programming 8-bit or 16-bit Single-cycle Transfer The following are the steps needed to perform 8-bit or 16-bit and mono or stereo PCM single-cycle DMA mode transfer on DSP version 4.xx: 1. Set up the DSP interrupt service routine. 2. Enable the interrupt used. 3. Program the DMA controller for 8-bit or 16-bit single-cycle DMA mode transfer. 4. Set the DSP transfer sampling rate. outp(wSBCBaseAddx+0xC, bCommand) outp(wSBCBaseAddx+0xC, wSamplingRate.
Digitized Sound I/O Programming 3-27 bMode is one of the following: bMode 00h 20h 10h 30h Description 8-bit mono unsigned PCM 8-bit stereo unsigned PCM 16-bit mono signed PCM 16-bit stereo signed PCM wLength is one less than the actual number of samples to be transferred. The transfer begins here. The DSP will generate an interrupt after transferring the programmed number of samples. Upon receiving an interrupt from the DSP, the following steps should be done in the interrupt service routine: 1.
3-28 Digitized Sound I/O Programming 8-bit or 16-bit Auto-initialize Transfer The following are the steps needed to perform 8-bit or 16-bit and mono or stereo PCM auto-initialize DMA mode transfer on DSP version 4.xx: 1. Allocate a DMA buffer in contiguous memory without straddling a 64KB physical page boundary. Use an 8KB buffer as an example. 2. Set up the DSP interrupt service routine. 3. Enable the interrupt used. 4.
Digitized Sound I/O Programming 3-29 bMode is one of the following: bMode 00h 20h 10h 30h Description 8-bit mono unsigned PCM 8-bit stereo unsigned PCM 16-bit mono signed PCM 16-bit stereo signed PCM wBlkSize is one less than the actual number of samples to be transferred. If an 8KB DMA buffer is used, the DSP block transfer size should be set to 4K of 8-bit samples for 8-bit data transfer, or 2K of 16-bit samples for 16bit data transfer.
Chapter 4 Mixer Chip Programming Three different mixer chips are used on Sound Blaster cards: CT1335, CT1345 and CT1745. CT1335 is used on the Sound Blaster 2.0 CD Interface card, CT1345 is used on the Sound Blaster Pro and CT1745 is used on the Sound Blaster 16. This chapter discusses the essentials for programming the mixer chips.
4-2 Mixer Chip Programming Programming Sequence Each mixer chip uses two consecutive I/O ports: 2x4h and 2x5h where x depends on the jumper selectable setting of the base I/O address. Port 2x4h is the write-only Address Port. Port 2x5h is the Data Port which can be read or written. The sequence for programming a mixer chip is as follows: 1. write the index of the mixer register to the Address Port. 2. write/read the mixer register value to/from the Data Port.
Mixer Chip Programming 4-3 Certain bits in a mixer register may be reserved, in which case their values are undefined. When these bits are accessed, you must treat them as fully undefined. This is essential for software compatibility with future mixer chips. Follow the guidelines below: 1. Do not depend on the values of any undefined bits when testing the value of defined register bits. Mask them out when testing. 2.
4-4 Mixer Chip Programming CT1335 Mixer This section describes the features and register functions of the CT1335 mixer chip used on the Sound Blaster 2.0 CD Interface card. Features CT1335 is a mono mixer chip that only controls the output mixing. It has the following features: Volume Control CT1335 provides independent 8-level volume control for the Master, MIDI and CD sources. The Voice source has 4-levels of volume control.
Mixer Chip Programming 4-5 The function of each register is discussed below: Register 0x00 (Reset Mixer) Write any 8-bit value to this register to reset the mixer chip. After a reset, all the registers will be restored to their default values. Register 0x02 (Master volume) Register 0x06 (MIDI volume) 3 bits, giving 8 levels. 0 to 7 ⇒ – 46 dB to 0 dB, in approximate 4 dB steps. Default is 4 ⇒ – 11 dB. Register 0x08 (CD volume) 3 bits, giving 8 levels. 0 to 7 ⇒ – 46 dB to 0 dB, in approximate 4 dB steps.
4-6 Mixer Chip Programming CT1345 Mixer This section describes the features and register functions of the CT1345 mixer chip used on the Sound Blaster Pro card. Features CT1345 is a stereo mixer that controls volume, output mixing, and input source selection as well as the input and output low-pass filters. It also controls the stereo voice data output. Volume Control CT1345 provides independent 8-level volume control of both stereo channels for the Master, Voice, MIDI, CD, and Line-in sources.
Mixer Chip Programming 4-7 Stereo Digitized Sound Output Switch There is a switch on CT1345 to toggle digitized sound output data between the left and right DAC channels. The first digitized sound data byte will be directed to the left channel. It must be switched "On" for stereo digitized sound output. Register Functions The following notations are used to describe the detailed register map of CT1345: Index D7 “.L” stands for left channel and “.R” stands for right channel.
4-8 Mixer Chip Programming Register 0x0A (Mic mixing volume) 2 bits, giving 4 levels. 0 to 3 ⇒ – 46 dB to 0 dB, in approximate 7 dB steps. Default is 0 ⇒ – 46 dB. Register 0x0C:1,2 (Input Source) Set these two bits to one of the following values to select the input source. 0 or 2 ⇒ Microphone source. 1 ⇒ CD source. 3 ⇒ Line-in source. Default is 0 ⇒ Microphone. Register 0x0C:3 (Low-Pass Filter) Low-pass input filter. It is only effective when the Input Filter switch is on. 0 ⇒ 3.2 kHz low-pass filter.
Mixer Chip Programming Register 0x0E:1 (Stereo Switch) Digitized sound data stereo output switch. This must be switched back to default as soon as stereo output is done. 0 ⇒ mono output. 1 ⇒ stereo output. Default is 0 ⇒ mono output. Register 0x0E:5 (Output Filter) Output filter off switch. 0 ⇒ Output filter on, output through low-pass filter. 1 ⇒ Output filter off, bypass the low-pass filter Default is 0 ⇒ Output filter on. Turn off the filter for high sampling rates or stereo output.
4-10 Mixer Chip Programming CT1745 Mixer This section describes the features and register functions of the CT1745 mixer chip used on the Sound Blaster 16. Features The features of CT1745 have been greatly enhanced from CT1345 Mixer. Volume Control CT1745 provides independent 32-level volume control of both stereo channels for the Master, Voice, MIDI, CD and Line-In sources. The Microphone source is mono and has 32-levels of volume control.
Mixer Chip Programming 4-11 Microphone Automatic Gain Control (AGC) Helps to maintain the mic input signal at a reasonable level. Gain Control Independent 4-level gain control on each of the left/right input/output mixing paths. Tone Control Independent 16-level bass and treble control on the left and right output mixing paths. CT1745 features dynamic filtering. There is no need for filter controls as in the CT1345.
4-12 Mixer Chip Programming Index D7 D6 D5 0x00 D4 D3 D2 D1 0x04 Voice volume.L Voice volume.R 0x22 Master volume. L Master volume.R 0x26 MIDI volume.L MIDI volume.R 0x28 CD volume.L CD volume.R 0x2E Line volume.L Line volume.R 0x0A Mic volume 0x30 Master volume.L 0x31 Master volume.R 0x32 Voice volume.L 0x33 Voice volume.R 0x34 MIDI volume.L 0x35 MIDI volume.R 0x36 CD volume.L 0x37 CD volume.R 0x38 Line volume.L 0x39 Line volume.
Mixer Chip Programming Figure 4-4: Logical Schematic of the Output Mixing Paths 4-13
4-14 Mixer Chip Programming Figure 4-5: Logical Schematic of the Input Mixing Paths
Mixer Chip Programming 4-15 The function of each register is discussed below: Register 0x00 (Reset Mixer) Write any 8-bit value to this register to reset the mixer. After a reset, all the registers will be restored to their default values. Registers 0x04, 0x0A, 0x22, 0x26, 0x28, 0x2E (CT1345 mixer chip compatibility volume controls) These registers help maintain some compatibility with the CT1345 mixer chip. They are actually mapped to the new volume control registers.
4-16 Mixer Chip Programming Registers 0x38/0x39 (Line volume .L/.R) Register 0x3A (Mic volume) 5 bits per channel, giving 32 levels. 0 to 31 ⇒ – 62 dB to 0 dB, in 2 dB steps. Default is 0 ⇒ – 62 dB. Register 0x3B (PC Speaker volume) 2 bits, giving 4 levels. 0 to 3 ⇒ – 18 dB to 0 dB, in 6 dB steps. Default is 0 ⇒ – 18 dB. Register 0x3C (Output mixer switches) Set the appropriate bit to 1 to close the switch, 0 to open. The default is Line.L 1 Line.R 1 CD.L 1 CD.R 1 Mic 1 Register 0x3D (Input Mixer.
Mixer Chip Programming Registers 0x3F/0x40 (Input Gain .L/.R) Registers 0x41/0x42 (Output Gain .L/.R) 2 bits per channel, giving 4 levels. 0 to 3 ⇒ 0 dB to 18 dB, in 6 dB steps. Default is 0 ⇒ 0 dB. Register 0x43:0 (Mic AGC) 0 ⇒ AGC on (default). 1 ⇒ Fixed gain of 20 dB. Registers 0x44/0x45 (Treble .L/.R) Registers 0x46/0x47 (Bass .L/.R) 4 bits per channel, giving 16 levels. 0 to 7 ⇒ – 14 dB to 0 dB, in 2 dB steps. 8 to 15 ⇒ 0 dB to 14 dB, in 2 dB steps. Default is 8 ⇒ 0 dB.
Chapter 5 MIDI Port I/O Programming This chapter discusses Sound Blaster MIDI (SB-MIDI) and MPU-401 UART mode programming. SB-MIDI port is available on all the Sound Blaster cards. MPU-401 UART mode is available on the Sound Blaster 16 only. You can use either of the MIDI interfaces. However, it is better to use the MPU-401 mode on Sound Blaster 16 because it has its own independent I/O ports and interrupt status bit which means that it is possible to have digitized sound and MIDI I/O running together.
5-2 MIDI Port I/O Programming SB-MIDI Mode SB-MIDI mode provides an interface for MIDI I/O in Normal mode as well as UART mode. UART mode requires a DSP with a minimum version of 2.00. Under Normal mode, all MIDI out data must be preceded by a MIDI output command, but under UART mode, a write to the DSP is taken as MIDI data. In-bound MIDI data can be detected using a polling or interrupt mode.
MIDI Port I/O Programming 5-3 Sending MIDI Data The following contrasts the difference between sending MIDI data in Normal mode and UART mode: Normal Mode Under MIDI Normal mode, all the MIDI out data must be preceded by a MIDI output command. The following assembly code fragment shows the process of sending MIDI data to the DSP.
5-4 MIDI Port I/O Programming Reading MIDI Data When MIDI data is available from an external MIDI device, it can be read in from the DSP data port. As mentioned before, there are two operational modes for detecting the availability of in-bound MIDI data: polling mode or interrupt mode. When in polling mode, in-bound MIDI data is available when bit 7 of the DSP Read-Buffer Status port is set. Conversely, when bit 7 is clear, no MIDI data is available.
MIDI Port I/O Programming 5-5 MPU-401 UART Mode Only the MPU-401 UART (or pass-through) mode is supported on Sound Blaster 16. In this mode, the interface performs no services, literally relaying everything it receives, without modification or interpretation, between the PC and the attached MIDI device. Once UART mode is entered, the only command the interface recognizes is Reset. I/O Addresses The Sound Blaster 16 MPU-401 UART mode MIDI interface uses one IRQ line and two consecutive I/O addresses.
5-6 MIDI Port I/O Programming Checking the Status Before writing a command byte or MIDI data to (or reading a data byte or MIDI data from) the MPU-401 interface, the status port must be checked to see whether the interface is ready. Bit 6, the Output Ready bit, indicates whether the interface is ready to receive data. If it is 1, the interface is busy. Otherwise, the command byte or MIDI data can be sent.
MIDI Port I/O Programming 5-7 Sending a Command Commands are sent through the Command port to control the operation of the interface. Before sending the command, the Status port must be polled. Example code: mov inc dx,wMpuBaseAddx dx ;MPU-401 base I/O address ;Status port in test jnz al,dx al,40h Busy ;Read status port ;Ready for output? mov out al,bCommand dx,al ;Get command ;Output command via Command port Busy: As only the UART mode is supported, only two commands are recognized.
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.
MIDI Port I/O Programming 5-9 Enter UART Mode In order to send or receive MIDI data, the command byte 3Fh must first be sent out to switch the interface into UART mode. A Command Acknowledge byte of 0FEh will be made available on the Data port if the mode switch is successful. In UART mode, MIDI data is sent to and received from the Data port. The Reset command is used to exit UART mode.
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 dx,wMpuBaseAddx dx ;MPU-401 base I/O address ;Status port in test jnz al,dx al,40h Busy ;Read status port ;Ready for output? ;No mov dec out al,bMidiData dx dx,al ;Get MIDI data ;Data Port ;Output MIDI data Busy: Reading MIDI Data When MIDI data is available from an external MIDI device, it can be read in from the Data port.
Chapter 6 DSP Commands This chapter documents the commands for the Creative Digital Sound Processor (DSP). Many enhancements have been made to the DSP from version to version. For instance, MIDI UART mode and DMA auto-initialize mode were introduced with DSP version 2.00; and high-speed mode with version 2.01+. Stereo digitized sound I/O was made available with version 3.xx. 16-bit digitized sound I/O made its appearance with version 4.xx.
6-2 DSP Commands Commands by Category The table below categorize the commands according to their functionalities. The commands below are available for DSP versions 1.xx, 2.00, 2.01+, 3.xx and 4.xx. Category Cmd# Description 8-bit direct mode digitized sound I/O 10h 20h Output Input Transfer time constant 40h Set digitized sound transfer time constant 8-bit single-cycle DMA mode digitized sound I/O 14h 24h Output Input 74h 75h 8-bit to 4-bit ADPCM output 8-bit to 4-bit ADPCM output with ref.
DSP Commands 6-3 The commands below are available on DSP versions 2.00, 2.01+, 3.xx and 4.xx. Category Cmd# Description 8-bit auto-init DMA mode digitized sound I/O 1Ch 2Ch Output Input 7Dh 8-bit to 4-bit ADPCM output with ref. byte 7Fh 8-bit to 3-bit ADPCM output with ref. byte 1Fh 8-bit to 2-bit ADPCM output with ref.
6-4 DSP Commands The commands below are only available on DSP version 3.xx. Category Cmd# Description Stereo control A0h A8h Set input mode to mono Set input mode to stereo The commands below are only available on DSP version 4.xx.
DSP Commands Command Descriptions The DSP command descriptions will be presented in the following format: Command purpose of the command Output The command byte follows by parameter(s) to output in byte. Remarks Detailed description of the command and its usage. See Also Related commands (if any). Available Availability of the command on different versions of the DSP.
6-6 DSP Commands The following discusses the DSP commands in ascending order: 10h 8-bit direct mode single byte digitized sound output Output 10h, bData Remarks Output one byte unsigned digitized sound data to the DSP. The application is responsible for controlling the sampling rate. The proper transfer sequence is: 1. 2. 3. See Also Available Send command 10h. Send a byte of digitized sound data. Wait for the correct timing and repeat steps 1 and 2 until all digitized sound data has been sent.
DSP Commands 16h 6-7 Creative 8-bit to 2-bit ADPCM single-cycle DMA mode digitized sound output Output 16h, wLength.LowByte, wLength.HighByte Remarks Output subsequent blocks of digitized sound data compressed with Creative 8-bit to 2-bit ADPCM using single-cycle DMA mode. wLength is a word giving the number of bytes to transfer less 1. The first block of digitized sound ADPCM data must be transferred with the reference byte command.
6-8 DSP Commands 1Ch 8-bit auto-init DMA mode digitized sound output Output 1Ch Remarks Output unsigned digitized sound data using auto-init DMA mode. The DSP will generate an interrupt to signal the application after transferring every Block of data of size set by command 48h. There are 2 ways to terminate auto-init DMA mode I/O: See Also Available 1. Program single-cycle DMA mode digitized sound I/O.
DSP Commands 1Fh 6-9 Creative 8-bit to 2-bit ADPCM auto-init DMA mode digitized sound output with reference byte Output 1Fh Remarks Output digitized sound data compressed with Creative 8-bit to 2-bit ADPCM using auto-init DMA mode. Refer to command 1Ch on how to terminate an auto-init transfer. If the transfer is terminated by programming the last block to single-cycle DMA mode digitized sound I/O, the last block must be programmed with the no reference byte command, 16h.
6-10 DSP Commands 24h 8-bit single-cycle DMA mode digitized sound input Output 24h, wLength.LowByte, wLength.HighByte Remarks Input unsigned digitized sound data using single-cycle DMA mode. wLength is a word giving the number of 8-bit samples less 1. See Also command 14h, 8-bit single-cycle DMA mode digitized sound output Available 1.xx 9 2Ch 2.00 9 2.01+ 9 3.xx 9 4.
DSP Commands 30h 6-11 Polling mode MIDI input Output 30h Remarks Input MIDI data from the MIDI port using polling mode. The proper sequence is: 1. 2. See Also Available Send command 30h. Poll DSP for MIDI data. command 31h, Interrupt mode MIDI input command 34h, UART polling mode MIDI I/O 1.xx 9 31h 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Interrupt mode MIDI input Output 31h Remarks Input MIDI data from the MIDI port using interrupt mode.
6-12 DSP Commands 34h UART polling mode MIDI I/O Output 34h Remarks For MIDI UART mode, a read from the DSP is taken as reading MIDI data and a write to the DSP is taken as sending MIDI data. To terminate MIDI UART mode, send a DSP reset command. The DSP reset command behaves differently while the DSP is in MIDI UART mode. It terminates MIDI UART mode and restores all DSP parameters to the states prior to entering MIDI UART mode.
DSP Commands 36h 6-13 UART polling mode MIDI I/O with time stamping Output 36h Remarks For time stamping mode, in-bound MIDI data is tagged with a time stamp by the DSP. The time stamp is a 3-byte quantity in units of milliseconds. The order of time stamped in-bound MIDI data is: nTime.LowByte, nTime.MidByte, nTime.HighByte, bMidiData Refer to command 34h on the characteristics of MIDI UART mode and on how to terminate it.
6-14 DSP Commands 38h MIDI output Output 38h Remarks Output MIDI data to the MIDI port in non-UART mode. The proper sequence is: 1. 2. See Also Available Send command 38h. Send MIDI data. command 30h, Polling mode MIDI input 1.xx 9 40h 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Set digitized sound transfer Time Constant Output 40h, bTimeConstant Remarks Set the digitized sound I/O transfer Time Constant. Time Constant is the sampling rate representation used by the DSP.
DSP Commands 41h 6-15 Set digitized sound output sampling rate Output 41h, wSamplingRate.HighByte, wSamplingRate.LowByte Remarks Valid sampling rates range from 5000 to 45 000 Hz inclusive. Unlike the Time Constant, there is no need to pre-multiply the sampling rate by two before programming the sampling rate for stereo digitized sound I/O. See Also Available command 40h, Set digitized sound transfer Time Constant command 42h, Set digitized sound input sampling rate 1.xx 42h 2.00 2.01+ 3.
6-16 DSP Commands 48h Set DSP block transfer size Output 48h, wBlockSize.LowByte, wBlockSize.HighByte Remarks The DSP will generate an interrupt after transferring the block of data. wBlockSize is a word giving the number of bytes to transfer less 1. This command is used with high-speed mode and auto-init DMA mode. See Also Available Commands that initiate high-speed mode digitized sound I/O Commands that initiate auto-init DMA mode digitized sound I/O 1.xx 74h 2.00 9 2.01+ 9 3.xx 9 4.
DSP Commands 75h 6-17 Creative 8-bit to 4-bit ADPCM single-cycle DMA mode digitized sound output with reference byte Output 75h, wLength.LowByte, wLength.HighByte Remarks Refer to command 17h. See Also command 74h, Creative 8-bit to 4-bit ADPCM single-cycle DMA mode digitized sound output Available 1.xx 9 76h 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Creative 8-bit to 3-bit ADPCM single-cycle DMA mode digitized sound output Output 76h, wLength.LowByte, wLength.HighByte Remarks Refer to command 16h.
6-18 DSP Commands 77h Creative 8-bit to 3-bit ADPCM single-cycle DMA mode digitized sound output with reference byte Output 77h, wLength.LowByte, wLength.HighByte Remarks Refer to command 17h. See Also command 76h, Creative 8-bit to 3-bit ADPCM single-cycle DMA mode digitized sound output Available 1.xx 9 7Dh 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Creative 8-bit to 4-bit ADPCM auto-init DMA mode digitized sound output with reference byte Output 7Dh Remarks Refer to command 1Fh.
DSP Commands 7Fh 6-19 Creative 8-bit to 3-bit ADPCM auto-init DMA mode digitized sound output with reference byte Output 7Fh Remarks Refer to command 1Fh. See Also command 76h, Creative 8-bit to 3-bit ADPCM single-cycle DMA mode digitized sound output command DAh, Exit 8-bit auto-init DMA mode digitized sound I/O Available 1.xx 80h 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Pause DAC for a duration Output 80h, wDuration.LowByte, wDuration.
6-20 DSP Commands 90h 8-bit high-speed auto-init DMA mode digitized sound output Output 90h Remarks The DSP will generate an interrupt to signal the application after transferring every Block Size of data set by command 48h. In high-speed mode, the DSP will not accept any other commands. To terminate high-speed mode, send a DSP reset command. The DSP reset command behaves differently while the DSP is in high-speed mode.
DSP Commands 98h 8-bit high-speed auto-init DMA mode digitized sound input Output 98h Remarks Refer to command 90h. See Also command 90h, 8-bit high-speed auto-init DMA mode digitized sound output command 99h, 8-bit high-speed single-cycle DMA mode digitized sound input Available 1.xx 99h 2.00 2.01+ 9 3.xx 9 4.xx 8-bit high-speed single-cycle DMA mode digitized sound input Output 99h Remarks Refer to command 91h.
6-22 DSP Commands A0h Set input mode to mono Output A0h Remarks The default input mode is mono. See Also command A8h, Set input mode to stereo Available 1.xx A8h 2.00 2.01+ 3.xx 9 4.xx Set input mode to stereo Output A8h Remarks This command must be sent if stereo recording is desired. After recording, command A0h must be sent to set the input mode back to mono. This command no longer exists on DSP version 4.xx. Refer to commands Bxh and Cxh on stereo recording settings.
DSP Commands Bxh Program 16-bit DMA mode digitized sound I/O Output bCommand, bMode, wLength.LowByte, wLength.HighByte Remarks The bCommand byte is organized as: D7 1 where 6-23 D6 0 D5 1 D4 1 D3 A/D 0 = D/A 1 = A/D D2 Auto-Init 0 = SC 1 = AI D1 FIFO 0 = off 1 = on D0 0 D/A stands for digital-to-analog, A/D for analog-to-digital, SC for single-cycle DMA mode, AI for auto-init DMA mode. FIFO will be re-initialized when the DSP receives any new digitized sound I/O commands.
6-24 DSP Commands Cxh Program 8-bit DMA mode digitized sound I/O Output bCommand, bMode, wLength.LowByte, wLength.HighByte Remarks Except for the high nibble being changed to 1100 binary, the bCommand byte is organized identically as in command Bxh. The bMode byte is organized exactly as in command Bxh. For minimum signal amplitude, the signed 8-bit value is 00h; with unsigned data, the equivalent value is 80h. wLength is a word giving the number of 8-bit samples less 1.
DSP Commands D1h 6-25 Turn on speaker Output D1h Remarks The speaker here refers to the connection of the digitized sound output to the amplifier input. It has no effect on the FM music. The DSP takes a maximum of 112 milliseconds to complete this command. Some important notes: See Also Available 1. On version 1.xx, the DSP will pause the DMA transfer after executing this command. 2. On DSP version 4.xx, this command has no practical effect on the output signal.
6-26 DSP Commands D3h Turn off speaker Output D3h Remarks The DSP takes a maximum of 220 milliseconds to complete this command. Some important notes: See Also Available 1. On version 1.xx, the DSP will pause the DMA transfer after executing this command. 2. On DSP version 4.xx, this command has no practical effect on the output signal. However, it will still set to ‘Off’ the DSP’s internal speaker On/Off flag so that command D8h, Get speaker status, will return the correct status.
DSP Commands D5h 6-27 Pause 16-bit DMA mode digitized sound I/O Output D5h Remarks This acts on I/O initiated by command Bxh. Applicable to both single-cycle and auto-init DMA modes. See Also command Bxh, Program 16-bit DMA mode digitized sound I/O command D6h, Continue 16-bit DMA mode digitized sound I/O Available 1.xx D6h 2.00 2.01+ 3.xx 4.xx 9 Continue 16-bit DMA mode digitized sound I/O Output D6h Remarks This acts on I/O initiated by command Bxh.
6-28 DSP Commands D8h Get speaker status Output D8h Remarks Returns the digitized sound output speaker status. After sending this command, read back a byte from the DSP. FFh indicates the speaker is on, 00h that it's off. See Also command D1h, Turn on speaker command D3h, Turn off speaker Available 1.xx D9h 2.00 9 2.01+ 9 3.xx 9 4.
DSP Commands DAh 6-29 Exit 8-bit auto-init DMA mode digitized sound I/O Output DAh Remarks Exits at the end of the current 8-bit auto-init DMA block transfer, and terminates the I/O process. See Also command Cxh, Program 8-bit DMA mode digitized sound I/O commands that initiate 8-bit auto-init DMA mode digitized sound I/O Available 1.xx E1h 2.00 9 2.01+ 9 3.xx 9 4.xx 9 Get DSP version number Output E1h Remarks After sending this command, read back two bytes from the DSP.
Appendix A Sound Blaster I/O Address Maps This appendix lists the I/O addresses used by Sound Blaster cards. The base I/O addresses are selectable to avoid conflicts with other add-on cards. The factory default base I/O address setting for all Sound Blaster cards is 220 Hex. In the following discussion, x is used to denote the selected base I/O address. The joystick port on Sound Blaster cards is identical to the standard PC Game Control Adapter (or game I/O port).
A-2 Sound Blaster I/O Address Maps SB1.5 I/O Address Map Sound Blaster version 1.5 or earlier uses I/O addresses 2x0h - 2xFh, where x is number from 1 to 6. Base Address 210h 220h 230h 240h 250h 260h I/O Addresses Used 210h to 21Fh 220h to 22Fh 230h to 23Fh 240h to 24Fh 250h to 25Fh 260h to 26Fh Table A-1: SB1.
Sound Blaster I/O Address Maps A-3 SBMCV I/O Address Map Sound Blaster for Micro Channel Version uses I/O addresses 2x0h - 2xFh, where x is a number from 1 to 6.
A-4 Sound Blaster I/O Address Maps SB2.0 I/O Address Map Sound Blaster 2.0 uses base I/O address 220h or 240h. These are jumper selectable. Base Address 220h 240h I/O Addresses Used 220h to 22Fh 240h to 24Fh Table A-5: SB2.
Sound Blaster I/O Address Maps SB2CD I/O Address Map Sound Blaster 2.0 CD Interface uses base I/O address 250h or 260h. These are jumper selectable.
A-6 Sound Blaster I/O Address Maps SBPRO I/O Address Map Sound Blaster Pro uses base I/O address 220h or 240h. These are jumper selectable. Base Address 220h 240h I/O Addresses Used 220h to 233h 240h to 253h Table A-9: SBPRO I/O Ports There are two versions of Sound Blaster Pro. The difference is in the FM chip used. The earlier version uses a two-operator FM (OPL2) chip, while the later version uses a four-operator FM (OPL3) chip.
Sound Blaster I/O Address Maps A-7 The following table lists the functions of the I/O ports on the Sound Blaster Pro that uses the OPL3 chip: I/O Address Base + 0h Base + 0h Base + 1h Base + 2h Base + 2h Base + 3h Base + 4h Base + 5h Base + 6h Base + 8h Base + 8h Base + 9h Base + Ah Base + Ch Base + Ch Base + Eh Base + 10h Base + 11h Base + 12h Base + 13h Description FM Music Status Port FM Music Register Address Port FM Music Data Port Advanced FM Music Status Port Advanced FM Music Register Address Por
A-8 Sound Blaster I/O Address Maps SBPRO MCV I/O Address Map Sound Blaster Pro for Micro Channel Version uses base I/O address 220h or 240h. These are jumper selectable.
Sound Blaster I/O Address Maps A-9 SB16 I/O Address Map Sound Blaster 16 uses base I/O address 220h, 240h, 260h or 280h. These are jumper selectable.
A-10 Sound Blaster I/O Address Maps Sound Blaster 16 also uses the following I/O addresses for MPU-401 UART mode support. The base I/O address is jumper selectable for either 300h or 330h. The factory default is 330h.
Appendix B File Format This appendix provides information about the Creative Voice File (.VOC) format and the Creative ADPCM wave type format registered with Microsoft. The Creative Voice File allows you to: embed ASCIIZ text and/or marker. include information on compression techniques. loop on a portion of the .VOC file. use digitized sound data with multiple sampling rates within a file.
B-2 File Format Creative Voice File (VOC) Format The Creative Voice File is organized in two main blocks, the Header Block and Data Block. The Header Block contains identifier, version number and pointer to the start of the Data Block. The Data Block is divided into sub-blocks of various types. The CT-VOICE driver only processes the Data Block. It is important that you pass the address of the Data Block and not the entire .VOC File when calling this driver to perform digitized sound output.
File Format Offset (Hex) Description 18H - 19H .VOC file identification code. B-3 This code allows your program to check that this file is a .VOC file. Its content is the complement of the file format version number, plus 1234 hex. For version of 1.20, it is complement(0114H) + 1234H = 111FH. Data Block The Data Block is sub-divided into multiple sub-blocks of data. The first byte of each sub-block is called the Block Type. It indicates the type of data contained in the sub-block.
B-4 File Format Block Type 1 This is a digitized sound data block. The Block Header is organized as follows: BYTE BYTE BYTE BYTE bBlockID; nBlockLen[3]; bTimeConstant; bPackMethod; // == 1 // 3-byte block length // Packing Method The header is followed immediately by the digitized sound data. Here is a discussion of various fields: bBlockID The Block Type identifier is 1. nBlockLen Length of the block (in bytes), excluding the bBlockID and nBlockLen fields.
File Format B-5 Some points to note for Block Type 1: 1. If this block is preceded by Block Type 8 (discussed later), the digitized sound attributes on Block Type 8 should be used. The digitized sound attributes in this block should be ignored. 2. If this block is alone, the digitized sound channels should be defaulted to mono. Block Type 2 This is a digitized sound continuation block.
B-6 File Format Here is a discussion of various fields: bBlockID The Block Type identifier is 3. nBlockLen Length of the block (in bytes), excluding the bBlockID and nBlockLen fields. The value is 3. wPausePeriod This is a 2-byte field which specifies the pause period in units of sampling cycles. Total pause cycle is wPausePeriod plus 1. bTimeConstant This is a 1-byte field which indicates the Time Constant of the pause period. The Time Constant calculation is the same as described in Block Type 1.
File Format B-7 During digitized sound output, the CT-VOICE and CTVDSK drivers update the digitized sound status word with this value when the marker is encountered. You program can check for the desired marker value to perform synchronization with the digitized sound output process. Block Type 5 This block enables you to embed a null-terminated ASCII string in the .VOC file.
B-8 File Format Here is a discussion of various fields: bBlockID The Block Type identifier is 6. nBlockLen Length of the block (in bytes), excluding the bBlockID and nBlockLen fields. The value is 2. wRepeatTimes This is a 2-byte field which specifies the number of times to repeat. It can be any value between 1 to 0FFFE hex inclusive. If this value is set to 0FFFF hex, an endless loop occurs. Block Type 7 This block indicates the end of a repeat loop. It works in conjunction with Block Type 6.
File Format B-9 Block Type 8 This is a special block that carries only the digitized sound attributes. It MUST precede Block Type 1. Usually, this block precedes the stereo or high speed digitized sound data. The Block Header is organized as follows: BYTE BYTE WORD BYTE BYTE bBlockID; nBlockLen[3]; wTimeConstant; bPackMethod; bVoiceMode; // // // // // == 8 3-byte block length 2-byte Time Constant Packing Method mono or stereo The header is followed immediately by Block Type 1.
B-10 File Format For a 22 050Hz sampling rate stereo digitized sound, the Time Constant is calculated as follows: Time Constant = 65536 - (256 000 000 / (2 * 22 050)) = 59732 (0E95H) bPackMethod This is a 1-byte field which indicates the packing method used by the digitized sound data of this block. The meaning of the field is the same as the bPackMethod field in Block Type 1: bVoiceMode This is a 1-byte field which indicates mono or stereo digitized sound (0 for mono and 1 for stereo).
File Format B-11 nBlockLen Length of the block (in bytes), excluding the bBlockID and nBlockLen fields. The value will be the digitized sound data length plus 12. dwSamplesPerSec This is the actual sampling frequency, not a Time Constant. There is no need to double the value when dealing with stereo I/O (unlike in Block Type 8). bBitsPerSample Actual number of bits per sample after compression (if any). bChannels This is 1 for mono or 2 for stereo.
B-12 File Format Creative ADPCM Wave Type Format WAVE_FORMAT_CREATIVE_ADPCM, the name for a new .WAV format tag, 0x0200 has been registered with Microsoft.
Appendix C Relevant Information If you need more information on the digital audio, MIDI, joystick, Programmable Interrupt Controller (PIC) or Direct Memory Access (DMA) Controller, you may refer to the following sources: Digital Audio For more information on digital audio, see the following books: Principles of Digital Audio Ken C. Pohlmann Howard W. Sams & Company Digital Audio Engineering, An Anthology Strawn John F. William Kaufmann, Inc.
C-2 Relevant Information MIDI For more information on MIDI, see the following book: MIDI: A Comprehensive introduction Joseph Rothstein A-R Editions, Inc PIC and DMA Controllers Programming For more information on the PIC and DMA controllers programming, see the following books: Intel Microsystem Components Handbook Peripherals Volume II 8259 Programmable Interrupt Controller Data Sheet 8253 Programmable DMA Controller Data Sheet Interfacing to the IBM Personal Computer Lewis C. Eggebrecht Howard W.
Index A______________________________ ADPCM mode auto-initialize 8-bit to 2-bit, 3-15 8-bit to 3-bit, 3-15 8-bit to 4-bit, 3-15 definition, 3-7 DSP versions supported, 3-8 reference byte, 3-7 single-cycle 8-bit to 2-bit, 3-13 8-bit to 3-bit, 3-13 8-bit to 4-bit, 3-13 Advanced Signal Processor, 1-2, 1-4 block diagram, 1-4 downloading, 1-5 features, 1-5 Auto-initialize mode 16-bit mono/stereo, 3-28 8-bit mono, 3-15, 3-28 8-bit mono ADPCM, 3-15 8-bit mono high-speed, 3-19 8-bit stereo, 3-28 8-bit stereo high-s
2 Index SB-MIDI UART mode, 5-3 sending MIDI data, 5-10 F______________________________ O______________________________ FIFO, 1-4, 6-23 FM Synthesizers OPL2, 1-3 OPL3, 1-3 Output mixing paths schematic, 4-13 P______________________________ Pulse Code Modulation, 3-2 H______________________________ High-speed mode auto-initialize, 3-6 definition, 3-6 DSP versions supported, 3-8 exiting, 3-6 single-cycle, 3-6 R______________________________ Reading MIDI data, 5-4, 5-10 Reference byte, 3-7, 3-13, 3-14
Index3