mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-01 11:49:58 +00:00
Reintroduced emergency vertical sync — so that output occurs even when the emulation isn't catching syncs properly — and switched some spaces to tabs.
This commit is contained in:
parent
14adcd2096
commit
98efae2536
@ -20,7 +20,7 @@ Machine::Machine()
|
|||||||
_lastOutputStateDuration = 0;
|
_lastOutputStateDuration = 0;
|
||||||
_lastOutputState = OutputState::Sync;
|
_lastOutputState = OutputState::Sync;
|
||||||
_crt = new Outputs::CRT(228, 256, 1, 4);
|
_crt = new Outputs::CRT(228, 256, 1, 4);
|
||||||
_piaTimerStatus = 0xff;
|
_piaTimerStatus = 0xff;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -273,12 +273,12 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
|
|||||||
if ((address&0x1280) == 0x280) {
|
if ((address&0x1280) == 0x280) {
|
||||||
if(isReadOperation(operation)) {
|
if(isReadOperation(operation)) {
|
||||||
switch(address & 0xf) {
|
switch(address & 0xf) {
|
||||||
case 0x04: returnValue &= _piaTimerValue >> _piaTimerShift; break;
|
case 0x04: returnValue &= _piaTimerValue >> _piaTimerShift; break;
|
||||||
case 0x05: returnValue &= _piaTimerStatus; _piaTimerStatus &= ~0x40; break;
|
case 0x05: returnValue &= _piaTimerStatus; _piaTimerStatus &= ~0x40; break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(address & 0x0f) {
|
switch(address & 0x0f) {
|
||||||
case 0x04: _piaTimerShift = 0; _piaTimerValue = *value << 0; _piaTimerStatus &= ~0xc0; break;
|
case 0x04: _piaTimerShift = 0; _piaTimerValue = *value << 0; _piaTimerStatus &= ~0xc0; break;
|
||||||
case 0x05: _piaTimerShift = 3; _piaTimerValue = *value << 3; _piaTimerStatus &= ~0xc0; break;
|
case 0x05: _piaTimerShift = 3; _piaTimerValue = *value << 3; _piaTimerStatus &= ~0xc0; break;
|
||||||
case 0x06: _piaTimerShift = 6; _piaTimerValue = *value << 6; _piaTimerStatus &= ~0xc0; break;
|
case 0x06: _piaTimerShift = 6; _piaTimerValue = *value << 6; _piaTimerStatus &= ~0xc0; break;
|
||||||
case 0x07: _piaTimerShift = 10; _piaTimerValue = *value << 10; _piaTimerStatus &= ~0xc0; break;
|
case 0x07: _piaTimerShift = 10; _piaTimerValue = *value << 10; _piaTimerStatus &= ~0xc0; break;
|
||||||
@ -291,13 +291,13 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
|
|||||||
*value = returnValue;
|
*value = returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_piaTimerValue < cycle_count) {
|
if(_piaTimerValue < cycle_count) {
|
||||||
_piaTimerValue = 0x100 - cycle_count + _piaTimerValue;
|
_piaTimerValue = 0x100 - cycle_count + _piaTimerValue;
|
||||||
_piaTimerShift = 0;
|
_piaTimerShift = 0;
|
||||||
_piaTimerStatus |= 0xc0;
|
_piaTimerStatus |= 0xc0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_piaTimerValue -= cycle_count;
|
_piaTimerValue -= cycle_count;
|
||||||
|
|
||||||
return cycle_count;
|
return cycle_count;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class Machine: public CPU6502::Processor<Machine> {
|
|||||||
// the timer
|
// the timer
|
||||||
unsigned int _piaTimerValue;
|
unsigned int _piaTimerValue;
|
||||||
unsigned int _piaTimerShift;
|
unsigned int _piaTimerShift;
|
||||||
uint8_t _piaTimerStatus;
|
uint8_t _piaTimerStatus;
|
||||||
|
|
||||||
// graphics registers
|
// graphics registers
|
||||||
uint8_t _playfield[3], _playfieldControl;
|
uint8_t _playfield[3], _playfieldControl;
|
||||||
|
@ -11,7 +11,7 @@ import Cocoa
|
|||||||
class Atari2600Document: NSDocument, CSCathodeRayViewDelegate {
|
class Atari2600Document: NSDocument, CSCathodeRayViewDelegate {
|
||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
super.init()
|
super.init()
|
||||||
// Add your subclass-specific initialization here.
|
// Add your subclass-specific initialization here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ CRT::CRT(int cycles_per_line, int height_of_display, int number_of_buffers, ...)
|
|||||||
const int scanlinesVerticalRetraceTime = 10; // source: ibid
|
const int scanlinesVerticalRetraceTime = 10; // source: ibid
|
||||||
|
|
||||||
_time_multiplier = (1000 + cycles_per_line - 1) / cycles_per_line;
|
_time_multiplier = (1000 + cycles_per_line - 1) / cycles_per_line;
|
||||||
|
height_of_display += (height_of_display / 20); // this is the overrun area we'll use to
|
||||||
|
|
||||||
// store fundamental display configuration properties
|
// store fundamental display configuration properties
|
||||||
_height_of_display = height_of_display;// + (height_of_display / 10);
|
_height_of_display = height_of_display;// + (height_of_display / 10);
|
||||||
@ -105,14 +106,10 @@ CRT::SyncEvent CRT::next_vertical_sync_event(bool vsync_is_charging, int cycles_
|
|||||||
int proposedSyncTime = cycles_to_run_for;
|
int proposedSyncTime = cycles_to_run_for;
|
||||||
|
|
||||||
// have we overrun the maximum permitted number of horizontal syncs for this frame?
|
// have we overrun the maximum permitted number of horizontal syncs for this frame?
|
||||||
// if (!_vretrace_counter)
|
if (!_vretrace_counter && _rasterPosition.y == 0xffffffff) {
|
||||||
// {
|
proposedSyncTime = 0;
|
||||||
// float raster_distance = _scanSpeed.y * proposedSyncTime;
|
proposedEvent = SyncEvent::StartVSync;
|
||||||
// if(_rasterPosition.y < 1.02f && _rasterPosition.y + raster_distance >= 1.02f) {
|
}
|
||||||
// proposedSyncTime = (int)(1.02f - _rasterPosition.y) / _scanSpeed.y;
|
|
||||||
// proposedEvent = SyncEvent::StartVSync;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// will an acceptable vertical sync be triggered?
|
// will an acceptable vertical sync be triggered?
|
||||||
if (vsync_is_charging && !_vretrace_counter) {
|
if (vsync_is_charging && !_vretrace_counter) {
|
||||||
@ -430,7 +427,7 @@ void CRTFrameBuilder::allocate_write_area(int required_length)
|
|||||||
|
|
||||||
_write_x_position = _next_write_x_position;
|
_write_x_position = _next_write_x_position;
|
||||||
_write_y_position = _next_write_y_position;
|
_write_y_position = _next_write_y_position;
|
||||||
_write_target_pointer = (_write_y_position * frame.size.width) + _write_x_position;
|
_write_target_pointer = (_write_y_position * frame.size.width) + _write_x_position;
|
||||||
_next_write_x_position += required_length;
|
_next_write_x_position += required_length;
|
||||||
frame.dirty_size.width = std::max(frame.dirty_size.width, _next_write_x_position);
|
frame.dirty_size.width = std::max(frame.dirty_size.width, _next_write_x_position);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user