mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-13 22:32:03 +00:00
Fixed ROM naming and sizes, ensured machines without sound outputs don't end up with an audio queue.
This commit is contained in:
parent
f922d38ed2
commit
0b221e773f
@ -20,6 +20,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma mark - Setup
|
||||
|
||||
void Machine::setup_output(float aspect_ratio)
|
||||
{
|
||||
_mos6560 = std::unique_ptr<MOS::MOS6560>(new MOS::MOS6560());
|
||||
@ -28,16 +30,17 @@ void Machine::setup_output(float aspect_ratio)
|
||||
void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
|
||||
{
|
||||
uint8_t *target = nullptr;
|
||||
size_t max_length = 0x2000;
|
||||
switch(slot)
|
||||
{
|
||||
case ROMSlotKernel: target = _kernelROM; break;
|
||||
case ROMSlotCharacters: target = _characterROM; break;
|
||||
case ROMSlotBASIC: target = _basicROM; break;
|
||||
case ROMSlotKernel: target = _kernelROM; break;
|
||||
case ROMSlotCharacters: target = _characterROM; max_length = 0x1000; break;
|
||||
case ROMSlotBASIC: target = _basicROM; break;
|
||||
}
|
||||
|
||||
if(target)
|
||||
{
|
||||
size_t length_to_copy = std::max((size_t)0x1000, length);
|
||||
size_t length_to_copy = std::min(max_length, length);
|
||||
memcpy(target, data, length_to_copy);
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,9 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
|
||||
private:
|
||||
uint8_t _characterROM[0x1000];
|
||||
uint8_t _basicROM[0x1000];
|
||||
uint8_t _kernelROM[0x1000];
|
||||
uint8_t _basicROM[0x2000];
|
||||
uint8_t _kernelROM[0x2000];
|
||||
uint8_t _ram[0x1000];
|
||||
|
||||
std::unique_ptr<MOS::MOS6560> _mos6560;
|
||||
};
|
||||
|
@ -48,9 +48,11 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe
|
||||
// establish and provide the audio queue, taking advice as to an appropriate sampling rate
|
||||
let maximumSamplingRate = AudioQueue.preferredSamplingRate()
|
||||
let selectedSamplingRate = self.machine().idealSamplingRateFromRange(NSRange(location: 0, length: NSInteger(maximumSamplingRate)))
|
||||
audioQueue = AudioQueue(samplingRate: Float64(selectedSamplingRate))
|
||||
self.machine().audioQueue = self.audioQueue
|
||||
self.machine().setAudioSamplingRate(selectedSamplingRate)
|
||||
if selectedSamplingRate > 0 {
|
||||
audioQueue = AudioQueue(samplingRate: Float64(selectedSamplingRate))
|
||||
self.machine().audioQueue = self.audioQueue
|
||||
self.machine().setAudioSamplingRate(selectedSamplingRate)
|
||||
}
|
||||
}
|
||||
|
||||
override func close() {
|
||||
|
@ -21,7 +21,7 @@ class Vic20Document: MachineDocument {
|
||||
self.intendedCyclesPerSecond = 1022727
|
||||
// TODO: or 1108405 for PAL; see http://www.antimon.org/dl/c64/code/stable.txt
|
||||
|
||||
if let kernel = rom("kernel"), basic = rom("basic"), characters = rom("characters-english") {
|
||||
if let kernel = rom("kernel-ntsc"), basic = rom("basic"), characters = rom("characters-english") {
|
||||
vic20.setKernelROM(kernel)
|
||||
vic20.setBASICROM(basic)
|
||||
vic20.setCharactersROM(characters)
|
||||
|
@ -43,7 +43,7 @@ struct SpeakerDelegate: public Outputs::Speaker::Delegate {
|
||||
{
|
||||
return speaker->get_ideal_clock_rate_in_range((int)range.location, (int)(range.location + range.length));
|
||||
}
|
||||
return (int)range.location;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user