mirror of
https://github.com/TomHarte/CLK.git
synced 2024-06-30 22:29:56 +00:00
Corrects video counter values.
The built-in speed test now passes.
This commit is contained in:
parent
3162873a9c
commit
24fcb0c24b
|
@ -742,9 +742,9 @@ class ConcreteMachine:
|
||||||
// printf("%06x %s %02x%s\n", address, isReadOperation(operation) ? "->" : "<-", *value,
|
// printf("%06x %s %02x%s\n", address, isReadOperation(operation) ? "->" : "<-", *value,
|
||||||
// operation == CPU::WDC65816::BusOperation::ReadOpcode ? " [*]" : "");
|
// operation == CPU::WDC65816::BusOperation::ReadOpcode ? " [*]" : "");
|
||||||
// }
|
// }
|
||||||
if(operation == CPU::WDC65816::BusOperation::ReadOpcode) {
|
// if(operation == CPU::WDC65816::BusOperation::ReadOpcode) {
|
||||||
log = (address >= 0xff6ac7) && (address < 0xff6b09);
|
// log = (address >= 0xff6ac7) && (address < 0xff6b09);
|
||||||
}
|
// }
|
||||||
// log &= !((operation == CPU::WDC65816::BusOperation::ReadOpcode) && ((address < 0xff6a2c) || (address >= 0xff6a9c)));
|
// log &= !((operation == CPU::WDC65816::BusOperation::ReadOpcode) && ((address < 0xff6a2c) || (address >= 0xff6a9c)));
|
||||||
if(log) {
|
if(log) {
|
||||||
printf("%06x %s %02x [%s]", address, isReadOperation(operation) ? "->" : "<-", *value, (is_1Mhz || (speed_register_ & motor_flags_)) ? "1.0" : "2.8");
|
printf("%06x %s %02x [%s]", address, isReadOperation(operation) ? "->" : "<-", *value, (is_1Mhz || (speed_register_ & motor_flags_)) ? "1.0" : "2.8");
|
||||||
|
|
|
@ -458,7 +458,7 @@ Video::Counters Video::get_counters(Cycles offset) {
|
||||||
// mode (vertical line count of 312). Vertical counter value $100 corresponds to scan line
|
// mode (vertical line count of 312). Vertical counter value $100 corresponds to scan line
|
||||||
// zero in NTSC mode."
|
// zero in NTSC mode."
|
||||||
|
|
||||||
// Work out the internal offset into frame.
|
// Work out the internal offset into frame; a modulo willoccur momentarily...
|
||||||
auto cycles_into_frame = cycles_into_frame_ + offset.as<int>();
|
auto cycles_into_frame = cycles_into_frame_ + offset.as<int>();
|
||||||
|
|
||||||
// Nudge slightly so that the regular start of line matches mine.
|
// Nudge slightly so that the regular start of line matches mine.
|
||||||
|
@ -466,9 +466,10 @@ Video::Counters Video::get_counters(Cycles offset) {
|
||||||
cycles_into_frame = (cycles_into_frame + 25 - start_of_pixels)%(Lines * CyclesPerLine);
|
cycles_into_frame = (cycles_into_frame + 25 - start_of_pixels)%(Lines * CyclesPerLine);
|
||||||
|
|
||||||
// Break it down.
|
// Break it down.
|
||||||
const auto cycles_into_line = cycles_into_frame / (CyclesPerLine * CyclesPerTick);
|
const auto cycles_into_line = (cycles_into_frame % CyclesPerLine) / CyclesPerTick;
|
||||||
const auto lines_into_frame = (cycles_into_frame % (CyclesPerLine * CyclesPerTick)) + 0x100;
|
auto lines_into_frame = cycles_into_frame / CyclesPerLine;
|
||||||
|
|
||||||
|
lines_into_frame += 0x100;
|
||||||
return Counters(
|
return Counters(
|
||||||
lines_into_frame - ((lines_into_frame / 0x200) * 0x106), // TODO: this assumes NTSC.
|
lines_into_frame - ((lines_into_frame / 0x200) * 0x106), // TODO: this assumes NTSC.
|
||||||
cycles_into_line + bool(cycles_into_line) * 0x40);
|
cycles_into_line + bool(cycles_into_line) * 0x40);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user