mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-05 21:32:55 +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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Setup
|
||||||
|
|
||||||
void Machine::setup_output(float aspect_ratio)
|
void Machine::setup_output(float aspect_ratio)
|
||||||
{
|
{
|
||||||
_mos6560 = std::unique_ptr<MOS::MOS6560>(new MOS::MOS6560());
|
_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)
|
void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
|
||||||
{
|
{
|
||||||
uint8_t *target = nullptr;
|
uint8_t *target = nullptr;
|
||||||
|
size_t max_length = 0x2000;
|
||||||
switch(slot)
|
switch(slot)
|
||||||
{
|
{
|
||||||
case ROMSlotKernel: target = _kernelROM; break;
|
case ROMSlotKernel: target = _kernelROM; break;
|
||||||
case ROMSlotCharacters: target = _characterROM; break;
|
case ROMSlotCharacters: target = _characterROM; max_length = 0x1000; break;
|
||||||
case ROMSlotBASIC: target = _basicROM; break;
|
case ROMSlotBASIC: target = _basicROM; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target)
|
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);
|
memcpy(target, data, length_to_copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,9 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _characterROM[0x1000];
|
uint8_t _characterROM[0x1000];
|
||||||
uint8_t _basicROM[0x1000];
|
uint8_t _basicROM[0x2000];
|
||||||
uint8_t _kernelROM[0x1000];
|
uint8_t _kernelROM[0x2000];
|
||||||
|
uint8_t _ram[0x1000];
|
||||||
|
|
||||||
std::unique_ptr<MOS::MOS6560> _mos6560;
|
std::unique_ptr<MOS::MOS6560> _mos6560;
|
||||||
};
|
};
|
||||||
|
@ -48,10 +48,12 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe
|
|||||||
// establish and provide the audio queue, taking advice as to an appropriate sampling rate
|
// establish and provide the audio queue, taking advice as to an appropriate sampling rate
|
||||||
let maximumSamplingRate = AudioQueue.preferredSamplingRate()
|
let maximumSamplingRate = AudioQueue.preferredSamplingRate()
|
||||||
let selectedSamplingRate = self.machine().idealSamplingRateFromRange(NSRange(location: 0, length: NSInteger(maximumSamplingRate)))
|
let selectedSamplingRate = self.machine().idealSamplingRateFromRange(NSRange(location: 0, length: NSInteger(maximumSamplingRate)))
|
||||||
|
if selectedSamplingRate > 0 {
|
||||||
audioQueue = AudioQueue(samplingRate: Float64(selectedSamplingRate))
|
audioQueue = AudioQueue(samplingRate: Float64(selectedSamplingRate))
|
||||||
self.machine().audioQueue = self.audioQueue
|
self.machine().audioQueue = self.audioQueue
|
||||||
self.machine().setAudioSamplingRate(selectedSamplingRate)
|
self.machine().setAudioSamplingRate(selectedSamplingRate)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func close() {
|
override func close() {
|
||||||
actionLock.lock()
|
actionLock.lock()
|
||||||
|
@ -21,7 +21,7 @@ class Vic20Document: MachineDocument {
|
|||||||
self.intendedCyclesPerSecond = 1022727
|
self.intendedCyclesPerSecond = 1022727
|
||||||
// TODO: or 1108405 for PAL; see http://www.antimon.org/dl/c64/code/stable.txt
|
// 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.setKernelROM(kernel)
|
||||||
vic20.setBASICROM(basic)
|
vic20.setBASICROM(basic)
|
||||||
vic20.setCharactersROM(characters)
|
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 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