mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-13 00:25:26 +00:00
Take slightly wrong-headed steps towards proper command timing.
This commit is contained in:
@@ -159,7 +159,7 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(fetch_cycles_pool) {
|
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(
|
const int fetch_cycles = std::min(
|
||||||
Timing<personality>::CyclesPerLine - this->fetch_pointer_.column,
|
Timing<personality>::CyclesPerLine - this->fetch_pointer_.column,
|
||||||
fetch_cycles_pool
|
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->minimum_access_column_ = this->fetch_pointer_.column + this->cycles_until_access_;
|
||||||
this->cycles_until_access_ -= fetch_cycles;
|
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.
|
// Latch scrolling position, if necessary.
|
||||||
|
@@ -187,6 +187,27 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
|||||||
CommandContext command_context_;
|
CommandContext command_context_;
|
||||||
std::unique_ptr<Command> command_ = nullptr;
|
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 {
|
Storage() noexcept {
|
||||||
// Perform sanity checks on the event lists.
|
// Perform sanity checks on the event lists.
|
||||||
#ifndef NDEBUG
|
#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
|
// Don't do anything if the required time for the access to become executable
|
||||||
// has yet to pass.
|
// has yet to pass.
|
||||||
if(queued_access_ == MemoryAccess::None || access_column < minimum_access_column_) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user