mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-08 14:25:05 +00:00
Reduced back-and-forth between Cycles
and int
s within the Oric.
This commit is contained in:
@@ -29,6 +29,26 @@ template <class T> class WrappedInt {
|
|||||||
return *static_cast<T *>(this);
|
return *static_cast<T *>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline T &operator ++() {
|
||||||
|
++ length_;
|
||||||
|
return *static_cast<T *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T &operator ++(int) {
|
||||||
|
length_ ++;
|
||||||
|
return *static_cast<T *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T &operator --() {
|
||||||
|
-- length_;
|
||||||
|
return *static_cast<T *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T &operator --(int) {
|
||||||
|
length_ --;
|
||||||
|
return *static_cast<T *>(this);
|
||||||
|
}
|
||||||
|
|
||||||
inline T &operator %=(const T &rhs) {
|
inline T &operator %=(const T &rhs) {
|
||||||
length_ %= rhs.length_;
|
length_ %= rhs.length_;
|
||||||
return *static_cast<T *>(this);
|
return *static_cast<T *>(this);
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
using namespace Oric;
|
using namespace Oric;
|
||||||
|
|
||||||
Machine::Machine() :
|
Machine::Machine() :
|
||||||
cycles_since_video_update_(0),
|
|
||||||
use_fast_tape_hack_(false),
|
use_fast_tape_hack_(false),
|
||||||
typer_delay_(2500000),
|
typer_delay_(2500000),
|
||||||
keyboard_read_count_(0),
|
keyboard_read_count_(0),
|
||||||
@@ -142,7 +141,7 @@ void Machine::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::update_video() {
|
void Machine::update_video() {
|
||||||
video_output_->run_for(Cycles(cycles_since_video_update_));
|
video_output_->run_for(cycles_since_video_update_);
|
||||||
cycles_since_video_update_ = 0;
|
cycles_since_video_update_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +205,6 @@ void Machine::run_for(const Cycles &cycles) {
|
|||||||
|
|
||||||
Machine::VIA::VIA() :
|
Machine::VIA::VIA() :
|
||||||
MOS::MOS6522<Machine::VIA>(),
|
MOS::MOS6522<Machine::VIA>(),
|
||||||
cycles_since_ay_update_(0),
|
|
||||||
tape(new TapePlayer) {}
|
tape(new TapePlayer) {}
|
||||||
|
|
||||||
void Machine::VIA::set_control_line_output(Port port, Line line, bool value) {
|
void Machine::VIA::set_control_line_output(Port port, Line line, bool value) {
|
||||||
@@ -235,19 +233,19 @@ uint8_t Machine::VIA::get_port_input(Port port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::VIA::flush() {
|
void Machine::VIA::flush() {
|
||||||
ay8910->run_for(Cycles(cycles_since_ay_update_));
|
ay8910->run_for(cycles_since_ay_update_);
|
||||||
ay8910->flush();
|
ay8910->flush();
|
||||||
cycles_since_ay_update_ = 0;
|
cycles_since_ay_update_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::VIA::run_for(const Cycles &cycles) {
|
void Machine::VIA::run_for(const Cycles &cycles) {
|
||||||
cycles_since_ay_update_ += cycles.as_int();
|
cycles_since_ay_update_ += cycles;
|
||||||
MOS::MOS6522<VIA>::run_for(cycles);
|
MOS::MOS6522<VIA>::run_for(cycles);
|
||||||
tape->run_for(cycles);
|
tape->run_for(cycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::VIA::update_ay() {
|
void Machine::VIA::update_ay() {
|
||||||
ay8910->run_for(Cycles((int)cycles_since_ay_update_));
|
ay8910->run_for(cycles_since_ay_update_);
|
||||||
cycles_since_ay_update_ = 0;
|
cycles_since_ay_update_ = 0;
|
||||||
ay8910->set_control_lines( (GI::AY38910::ControlLines)((ay_bdir_ ? GI::AY38910::BCDIR : 0) | (ay_bc1_ ? GI::AY38910::BC1 : 0) | GI::AY38910::BC2));
|
ay8910->set_control_lines( (GI::AY38910::ControlLines)((ay_bdir_ ? GI::AY38910::BCDIR : 0) | (ay_bc1_ ? GI::AY38910::BC1 : 0) | GI::AY38910::BC2));
|
||||||
}
|
}
|
||||||
|
@@ -104,7 +104,7 @@ class Machine:
|
|||||||
// RAM and ROM
|
// RAM and ROM
|
||||||
std::vector<uint8_t> basic11_rom_, basic10_rom_, microdisc_rom_, colour_rom_;
|
std::vector<uint8_t> basic11_rom_, basic10_rom_, microdisc_rom_, colour_rom_;
|
||||||
uint8_t ram_[65536], rom_[16384];
|
uint8_t ram_[65536], rom_[16384];
|
||||||
int cycles_since_video_update_;
|
Cycles cycles_since_video_update_;
|
||||||
inline void update_video();
|
inline void update_video();
|
||||||
|
|
||||||
// ROM bookkeeping
|
// ROM bookkeeping
|
||||||
@@ -154,7 +154,7 @@ class Machine:
|
|||||||
private:
|
private:
|
||||||
void update_ay();
|
void update_ay();
|
||||||
bool ay_bdir_, ay_bc1_;
|
bool ay_bdir_, ay_bc1_;
|
||||||
int cycles_since_ay_update_;
|
Cycles cycles_since_ay_update_;
|
||||||
};
|
};
|
||||||
VIA via_;
|
VIA via_;
|
||||||
std::shared_ptr<Keyboard> keyboard_;
|
std::shared_ptr<Keyboard> keyboard_;
|
||||||
|
Reference in New Issue
Block a user