mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Take slightly wrong-headed steps towards proper command timing.
This commit is contained in:
parent
8a673a697b
commit
95e00dd958
@ -159,7 +159,7 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
||||
#endif
|
||||
|
||||
if(fetch_cycles_pool) {
|
||||
// Determine how much writing to do.
|
||||
// Determine how much writing to do; at the absolute most go to the end of this line.
|
||||
const int fetch_cycles = std::min(
|
||||
Timing<personality>::CyclesPerLine - this->fetch_pointer_.column,
|
||||
fetch_cycles_pool
|
||||
@ -171,6 +171,15 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
||||
this->minimum_access_column_ = this->fetch_pointer_.column + this->cycles_until_access_;
|
||||
this->cycles_until_access_ -= fetch_cycles;
|
||||
|
||||
// ... and to any pending Yamaha commands.
|
||||
if constexpr (is_yamaha_vdp(personality)) {
|
||||
if(Storage<personality>::command_) {
|
||||
Storage<personality>::minimum_command_column_ =
|
||||
this->fetch_pointer_.column + Storage<personality>::command_->cycles;
|
||||
Storage<personality>::command_->cycles -= fetch_cycles;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------
|
||||
// Latch scrolling position, if necessary.
|
||||
|
@ -187,6 +187,27 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
CommandContext command_context_;
|
||||
std::unique_ptr<Command> command_ = nullptr;
|
||||
|
||||
enum class CommandStep {
|
||||
None,
|
||||
ReadPixel,
|
||||
WritePixel,
|
||||
};
|
||||
CommandStep next_command_step_ = CommandStep::None;
|
||||
int minimum_command_column_ = 0;
|
||||
|
||||
void update_command_step() {
|
||||
if(!command_) {
|
||||
next_command_step_ = CommandStep::None;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(command_->access) {
|
||||
case Command::AccessType::PlotPoint:
|
||||
next_command_step_ = CommandStep::ReadPixel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Storage() noexcept {
|
||||
// Perform sanity checks on the event lists.
|
||||
#ifndef NDEBUG
|
||||
@ -552,6 +573,17 @@ template <Personality personality> struct Base: public Storage<personality> {
|
||||
// Don't do anything if the required time for the access to become executable
|
||||
// has yet to pass.
|
||||
if(queued_access_ == MemoryAccess::None || access_column < minimum_access_column_) {
|
||||
if constexpr (is_yamaha_vdp(personality)) {
|
||||
// if(
|
||||
// Storage<personality>::next_command_step_ == Storage<personality>::CommandStep::None ||
|
||||
// access_column < Storage<personality>::minimum_access_column_
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// TODO: command-engine action.
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user