private void galwayInit() { if (active) { return; } // Check all important parameters are legal short r = convertAddr(0x1d); galTones = reg[r]; reg[r] = 0; galInitLength = reg[convertAddr(0x3d)]; if (galInitLength == 0) { return; } galLoopWait = reg[convertAddr(0x3f)]; if (galLoopWait == 0) { return; } galNullWait = reg[convertAddr(0x5d)]; if (galNullWait == 0) { return; } // Load the other parameters r = convertAddr(0x1e); address = SIDEndian.endian_16(reg[r + 1], reg[r]); volShift = (short)(reg[convertAddr(0x3e)] & 0x0f); mode = FM_GALWAY; active = true; cycles = 0; outputs = 0; sampleLimit = 8; sample = (byte)(galVolume - 8); galwayTonePeriod(); // Calculate the sample offset m_xsid.sampleOffsetCalc(); // Schedule a sample update m_context.schedule(m_xsid.xsidEvent, 0, m_phase); m_context.schedule(galwayEvent, cycleCount, m_phase); }
/// <summary> /// Common address resolution procedure /// </summary> /// <param name="c64data"></param> /// <param name="fileOffset2"></param> /// <returns></returns> protected bool resolveAddrs(short[] c64data, int fileOffset2) { // Originally used as a first attempt at an RSID // style format. Now reserved for future use if (info.playAddr == 0xffff) { info.playAddr = 0; } // loadAddr = 0 means, the address is stored in front of the C64 data. if (info.loadAddr == 0) { if (info.c64dataLen < 2) { //info.statusstring = txt_corrupt; return(false); } info.loadAddr = SIDEndian.endian_16(c64data[fileOffset + 1], c64data[fileOffset + 0]); fileOffset += 2; // c64data += 2; info.c64dataLen -= 2; } if (info.compatibility == SIDTUNE_COMPATIBILITY_BASIC) { if (info.initAddr != 0) { //info.statusstring = txt_badAddr; return(false); } } else if (info.initAddr == 0) { info.initAddr = info.loadAddr; } return(true); }
private void sampleInit() { if (active && (mode == FM_GALWAY)) { return; } // Check all important parameters are legal short r = convertAddr(0x1d); volShift = (short)((0 - reg[r]) >> 1); reg[r] = 0; r = convertAddr(0x1e); address = SIDEndian.endian_16(reg[r + 1], reg[r]); r = convertAddr(0x3d); samEndAddr = SIDEndian.endian_16(reg[r + 1], reg[r]); if (samEndAddr <= address) { return; } samScale = reg[convertAddr(0x5f)]; r = convertAddr(0x5d); samPeriod = SIDEndian.endian_16(reg[r + 1], reg[r]) >> samScale; if (samPeriod == 0) { // Stop this channel reg[convertAddr(0x1d)] = 0xfd; checkForInit(); return; } // Load the other parameters samNibble = 0; samRepeat = reg[convertAddr(0x3f)]; samOrder = reg[convertAddr(0x7d)]; r = convertAddr(0x7e); samRepeatAddr = SIDEndian.endian_16(reg[r + 1], reg[r]); cycleCount = samPeriod; // Support Galway Samples, but that // mode is setup only when a Galway // Noise sequence begins if (mode == FM_NONE) { mode = FM_HUELS; } active = true; cycles = 0; outputs = 0; sampleLimit = (short)(8 >> volShift); sample = sampleCalculate(); // Calculate the sample offset m_xsid.sampleOffsetCalc(); // Schedule a sample update m_context.schedule(m_xsid.xsidEvent, 0, m_phase); m_context.schedule(sampleEvent, cycleCount, m_phase); }