Example #1
0
void scan_platform()
{
	uint32_t	cpuid_reg[4];

	build_pci_dt();

	calculate_freq();
	
	// Copy the values from calculate_freq()
	Platform.CPU.TSCFrequency = tscFrequency;
	Platform.CPU.FSBFrequency = fsbFrequency;
	Platform.CPU.CPUFrequency = cpuFrequency;
	
	do_cpuid(0, cpuid_reg);
	Platform.CPU.Vendor = cpuid_reg[1];
	
	do_cpuid(1, cpuid_reg);
	Platform.CPU.Model = bitfield(cpuid_reg[0], 7, 4);
	Platform.CPU.Family = bitfield(cpuid_reg[0], 11, 8);
	Platform.CPU.ExtModel = bitfield(cpuid_reg[0], 19, 16);
	Platform.CPU.ExtFamily = bitfield(cpuid_reg[0], 27, 20);

	// Get vendor specific cpu data 
	if((Platform.CPU.Vendor == 0x756E6547 /* Intel */) && ((Platform.CPU.Family == 0x06) || (Platform.CPU.Family == 0x0f)))
		scan_cpu_intel();
	else if((Platform.CPU.Vendor == 0x68747541 /* AMD */) && (Platform.CPU.Family == 0x0f))
		scan_cpu_amd();
}
void sn76_voicer::tick()
{
	if(present_note == 0xFF)
	{
		return;
	}

	if(tick_counter == 0)
	{
		if(instrument->amp_table.tick(amprunner))
		{
			core->set_amp(chipnum,channel,0x0f - instrument->amp_table.present_val(amprunner));
		}

		bool freqd = instrument->freq_table.tick(freqrunner);
		bool noted = instrument->note_table.tick(noterunner);
		if(freqd || noted)
		{
			calculate_freq(present_note);
		}
	}
	
	tick_counter++;
	if(tick_counter == tick_divider)
	{
		tick_counter = 0;
	}
}
void sn76_voicer::start_voice(unsigned char note,unsigned char vel)
{
	//reset the tables
	instrument->amp_table.reset(amprunner);
	instrument->note_table.reset(noterunner);
	instrument->freq_table.reset(freqrunner);

	tick_counter = 0;
	
	calculate_freq(note);
	core->set_amp(chipnum,channel,0x0F - instrument->amp_table.present_val(amprunner));
}
void sn76_voicer::change_voice(unsigned char note,unsigned char vel)
{
	int offset_note = note + instrument->note_table.present_val(noterunner);
	calculate_freq(note);
}