1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Strips back Vic-20 static analysis to the bare minimum.

Also corrects an unsafe assumption in fast loading.
This commit is contained in:
Thomas Harte 2018-03-25 13:37:33 -04:00
parent 37ef46e7bb
commit e15d6717a1
2 changed files with 36 additions and 31 deletions

View File

@ -98,8 +98,8 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std
}
// General approach: increase memory size conservatively such that the largest file found will fit.
for(File &file : files) {
std::size_t file_size = file.data.size();
// for(File &file : files) {
// std::size_t file_size = file.data.size();
// bool is_basic = file.is_basic();
/*if(is_basic)
@ -125,16 +125,16 @@ void Analyser::Static::Commodore::AddTargets(const Media &media, std::vector<std
// An unexpanded Vic has memory between 0x0000 and 0x0400; and between 0x1000 and 0x2000.
// A 3kb expanded Vic fills in the gap and has memory between 0x0000 and 0x2000.
// A 32kb expanded Vic has memory in the entire low 32kb.
uint16_t starting_address = file.starting_address;
// uint16_t starting_address = file.starting_address;
// If anything above the 8kb mark is touched, mark as a 32kb machine; otherwise if the
// region 0x0400 to 0x1000 is touched and this is an unexpanded machine, mark as 3kb.
if(starting_address + file_size > 0x2000)
target->memory_model = Target::MemoryModel::ThirtyTwoKB;
else if(target->memory_model == Target::MemoryModel::Unexpanded && !(starting_address >= 0x1000 || starting_address+file_size < 0x0400))
target->memory_model = Target::MemoryModel::ThirtyTwoKB;
// if(starting_address + file_size > 0x2000)
// target->memory_model = Target::MemoryModel::ThirtyTwoKB;
// else if(target->memory_model == Target::MemoryModel::Unexpanded && !(starting_address >= 0x1000 || starting_address+file_size < 0x0400))
// target->memory_model = Target::MemoryModel::ThirtyTwoKB;
// }
// }
}
}
if(!target->media.empty())

View File

@ -585,7 +585,9 @@ class ConcreteMachine:
uint8_t x = static_cast<uint8_t>(m6502_.get_value_of_register(CPU::MOS6502::Register::X));
if(x == 0xe) {
Storage::Tape::Commodore::Parser parser;
const uint64_t tape_position = tape_->get_tape()->get_offset();
std::unique_ptr<Storage::Tape::Commodore::Data> data = parser.get_next_data(tape_->get_tape());
if(data) {
uint16_t start_address, end_address;
start_address = static_cast<uint16_t>(user_basic_memory_[0xc1] | (user_basic_memory_[0xc2] << 8));
end_address = static_cast<uint16_t>(user_basic_memory_[0xae] | (user_basic_memory_[0xaf] << 8));
@ -611,6 +613,9 @@ class ConcreteMachine:
// ensure that the PC leaps to 0xfccf
m6502_.set_value_of_register(CPU::MOS6502::Register::ProgramCounter, 0xfccf);
*value = 0xea; // i.e. NOP implied
} else {
tape_->get_tape()->set_offset(tape_position);
}
}
}
}