1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-21 05:29:13 +00:00

Support only the Vic-20 for PRGs for now.

This commit is contained in:
Thomas Harte 2025-02-18 20:46:43 -05:00
parent 7f480e8e56
commit a1d10adaa3
2 changed files with 37 additions and 29 deletions

View File

@ -269,13 +269,14 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
accumulator.try_standard<Tape::ZX80O81P>(TargetPlatform::ZX8081, "p81");
static constexpr auto PRGTargets = TargetPlatform::Vic20; //Commodore8bit; // Disabled until analysis improves.
if(accumulator.name_matches("prg")) {
// Try instantiating as a ROM; failing that accept as a tape.
try {
accumulator.insert<Cartridge::PRG>(TargetPlatform::Commodore8bit, file_name);
accumulator.insert<Cartridge::PRG>(PRGTargets, file_name);
} catch(...) {
try {
accumulator.insert<Tape::PRG>(TargetPlatform::Commodore8bit, file_name);
accumulator.insert<Tape::PRG>(PRGTargets, file_name);
} catch(...) {}
}
}

View File

@ -241,8 +241,7 @@ public:
}
// HACK. NOCOMMIT.
int pulse_num_ = 0;
bool superspeed_ = false;
// int pulse_num_ = 0;
Cycles perform_bus_operation(
const CPU::MOS6502::BusOperation operation,
@ -312,22 +311,18 @@ public:
// superspeed_ &= (address != 0xe68b) && (address != 0xe68d);
// }
constexpr bool use_hle = !true;
constexpr bool use_hle = true;
if(
use_fast_tape_hack_ &&
operation == CPU::MOS6502Esque::BusOperation::ReadOpcode &&
address == 0xe5fd
) {
printf("Pulse %d from %lld ",
pulse_num_,
tape_player_->serialiser()->offset()
);
if(tape_player_->serialiser()->offset() == 108080) {
printf("");
}
}
// if(
// use_fast_tape_hack_ &&
// operation == CPU::MOS6502Esque::BusOperation::ReadOpcode &&
// address == 0xe5fd
// ) {
// printf("Pulse %d from %lld ",
// pulse_num_,
// tape_player_->serialiser()->offset()
// );
// }
if(
use_fast_tape_hack_ &&
@ -338,20 +333,20 @@ public:
address == 0xe68d
)
) {
++pulse_num_;
// ++pulse_num_;
if(use_hle) {
read_dipole();
}
using Flag = CPU::MOS6502::Flag;
using Register = CPU::MOS6502::Register;
const auto flags = m6502_.value_of(Register::Flags);
printf("to %lld: %c%c%c\n",
tape_player_->serialiser()->offset(),
flags & Flag::Sign ? 'n' : '-',
flags & Flag::Overflow ? 'v' : '-',
flags & Flag::Carry ? 'c' : '-'
);
// using Flag = CPU::MOS6502::Flag;
// using Register = CPU::MOS6502::Register;
// const auto flags = m6502_.value_of(Register::Flags);
// printf("to %lld: %c%c%c\n",
// tape_player_->serialiser()->offset(),
// flags & Flag::Sign ? 'n' : '-',
// flags & Flag::Overflow ? 'v' : '-',
// flags & Flag::Carry ? 'c' : '-'
// );
*value = 0x60;
} else {
if(is_read(operation)) {
@ -361,7 +356,18 @@ public:
}
}
// TODO: rdbyte and ldsync is probably sufficient?
// if(use_fast_tape_hack_ && operation == CPU::MOS6502Esque::BusOperation::ReadOpcode) {
// constexpr uint16_t ldsync = 0;
// switch(address) {
// default: break;
//
// case ldsync:
// break;
// }
//
// if(address == 0xe9cc) {
// // Skip the `jsr rdblok` that opens `fah` (i.e. find any header), performing
// // its function as a high-level emulation.
@ -763,6 +769,7 @@ private:
bool play_button_ = false;
bool allow_fast_tape_hack_ = false; // TODO: implement fast-tape hack.
bool use_fast_tape_hack_ = false;
bool superspeed_ = false;
void set_use_fast_tape() {
use_fast_tape_hack_ =
allow_fast_tape_hack_ && tape_player_->motor_control() && rom_is_paged_ && !tape_player_->is_at_end();