static bool Tandy_InitializeSB() { /* see if soundblaster module available and at what port/IRQ/DMA */ Bitu sbport, sbirq, sbdma; if (SB_Get_Address(sbport, sbirq, sbdma)) { tandy_sb.port=(Bit16u)(sbport&0xffff); tandy_sb.irq =(Bit8u)(sbirq&0xff); tandy_sb.dma =(Bit8u)(sbdma&0xff); return true; } else { /* no soundblaster accessible, disable Tandy DAC */ tandy_sb.port=0; return false; } }
TANDYSOUND(Section* configuration):Module_base(configuration){ Section_prop * section=static_cast<Section_prop *>(configuration); bool enable_hw_tandy_dac=true; Bitu sbport, sbirq, sbdma; if (SB_Get_Address(sbport, sbirq, sbdma)) { enable_hw_tandy_dac=false; } //Select the correct tandy chip implementation if (machine == MCH_PCJR) activeDevice = &device_sn76496; else activeDevice = &device_ncr8496; real_writeb(0x40,0xd4,0x00); if (IS_TANDY_ARCH) { /* enable tandy sound if tandy=true/auto */ if ((strcmp(section->Get_string("tandy"),"true")!=0) && (strcmp(section->Get_string("tandy"),"on")!=0) && (strcmp(section->Get_string("tandy"),"auto")!=0)) return; } else { /* only enable tandy sound if tandy=true */ if ((strcmp(section->Get_string("tandy"),"true")!=0) && (strcmp(section->Get_string("tandy"),"on")!=0)) return; /* ports from second DMA controller conflict with tandy ports */ CloseSecondDMAController(); if (enable_hw_tandy_dac) { WriteHandler[2].Install(0x1e0,SN76496Write,IO_MB,2); WriteHandler[3].Install(0x1e4,TandyDACWrite,IO_MB,4); // ReadHandler[3].Install(0x1e4,TandyDACRead,IO_MB,4); } } Bit32u sample_rate = section->Get_int("tandyrate"); tandy.chan=MixerChan.Install(&SN76496Update,sample_rate,"TANDY"); WriteHandler[0].Install(0xc0,SN76496Write,IO_MB,2); if (enable_hw_tandy_dac) { // enable low-level Tandy DAC emulation WriteHandler[1].Install(0xc4,TandyDACWrite,IO_MB,4); ReadHandler[1].Install(0xc4,TandyDACRead,IO_MB,4); tandy.dac.enabled=true; tandy.dac.chan=MixerChanDAC.Install(&TandyDACUpdate,sample_rate,"TANDYDAC"); tandy.dac.hw.base=0xc4; tandy.dac.hw.irq =7; tandy.dac.hw.dma =1; } else { tandy.dac.enabled=false; tandy.dac.hw.base=0; tandy.dac.hw.irq =0; tandy.dac.hw.dma =0; } tandy.dac.control=0; tandy.dac.mode =0; tandy.dac.irq_activated=false; tandy.dac.frequency=0; tandy.dac.amplitude=0; tandy.dac.dma.last_sample=0; tandy.enabled=false; real_writeb(0x40,0xd4,0xff); /* BIOS Tandy DAC initialization value */ ((device_t&)device).device_start(); device.convert_samplerate(sample_rate); }