mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-23 18:29:16 +00:00
I'm ashamed to admit, I: played with numbers until enough things looked stable such that I can investigate other things. Discovery: my PAL autodetection was way off. Fixed, hopefully.
This commit is contained in:
parent
55017b78a5
commit
5313b48ebd
@ -135,6 +135,9 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
|
||||
|
||||
void Machine::output_pixels(int count)
|
||||
{
|
||||
const int32_t start_of_sync = 214;
|
||||
const int32_t end_of_sync = 188;
|
||||
|
||||
_timestamp += count;
|
||||
while(count--)
|
||||
{
|
||||
@ -143,7 +146,7 @@ void Machine::output_pixels(int count)
|
||||
// logic: if in vsync, output that; otherwise if in vblank then output that;
|
||||
// otherwise output a pixel
|
||||
if(_vSyncEnabled) {
|
||||
state = (_horizontalTimer < 212) ? OutputState::Sync : OutputState::Blank;
|
||||
state = (_horizontalTimer < start_of_sync) ? OutputState::Sync : OutputState::Blank;
|
||||
} else {
|
||||
|
||||
// blank is decoded as 68 counts; sync and colour burst as 16 counts
|
||||
@ -155,8 +158,8 @@ void Machine::output_pixels(int count)
|
||||
|
||||
// it'll be about 43 cycles from start of hsync to start of visible frame, so...
|
||||
// guesses, until I can find information: 26 cycles blank, 16 sync, 40 blank, 160 pixels
|
||||
if(_horizontalTimer >= 212) state = OutputState::Blank;
|
||||
else if (_horizontalTimer >= 196) state = OutputState::Sync;
|
||||
if(_horizontalTimer >= start_of_sync) state = OutputState::Blank;
|
||||
else if (_horizontalTimer >= end_of_sync) state = OutputState::Sync;
|
||||
else if (_horizontalTimer >= 160) state = OutputState::Blank;
|
||||
else {
|
||||
if(_vBlankEnabled) {
|
||||
@ -259,11 +262,11 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
|
||||
case 0x0e: _playfield[1] = *value; break;
|
||||
case 0x0f: _playfield[2] = *value; break;
|
||||
|
||||
case 0x10: _playerPosition[0] = _horizontalTimer; break;
|
||||
case 0x11: _playerPosition[1] = _horizontalTimer; break;
|
||||
case 0x12: _missilePosition[0] = _horizontalTimer; break;
|
||||
case 0x13: _missilePosition[1] = _horizontalTimer; break;
|
||||
case 0x14: _ballPosition = _horizontalTimer; break;
|
||||
case 0x10: _playerPosition[0] = _horizontalTimer - 5; break;
|
||||
case 0x11: _playerPosition[1] = _horizontalTimer - 5; break;
|
||||
case 0x12: _missilePosition[0] = _horizontalTimer - 4; break;
|
||||
case 0x13: _missilePosition[1] = _horizontalTimer - 4; break;
|
||||
case 0x14: _ballPosition = _horizontalTimer - 4; break;
|
||||
|
||||
case 0x1c:
|
||||
_ballGraphicsEnable = _ballGraphicsEnableLatch;
|
||||
|
@ -31,7 +31,7 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
|
||||
|
||||
if(!didDetectVSync)
|
||||
{
|
||||
_failedVSyncCount++;
|
||||
_failedVSyncCount+=2;
|
||||
|
||||
if(_failedVSyncCount == 60)
|
||||
{
|
||||
@ -40,7 +40,7 @@ struct Atari2600CRTDelegate: public Outputs::CRT::CRTDelegate {
|
||||
}
|
||||
else
|
||||
{
|
||||
_failedVSyncCount = MAX(_failedVSyncCount - 2, 0);
|
||||
_failedVSyncCount = MAX(_failedVSyncCount - 1, 0);
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
@ -176,6 +176,7 @@ const char *fragmentShader =
|
||||
"in float lateralVarying;"
|
||||
"out vec4 fragColour;\n"
|
||||
"uniform sampler2D texID;\n"
|
||||
"uniform float alpha;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
|
@ -20,9 +20,9 @@ static const uint32_t kCRTFixedPointOffset = 0x08000000;
|
||||
|
||||
void CRT::set_new_timing(int cycles_per_line, int height_of_display)
|
||||
{
|
||||
const int syncCapacityLineChargeThreshold = 4;
|
||||
const int millisecondsHorizontalRetraceTime = 10; // source: Dictionary of Video and Television Technology, p. 234
|
||||
const int scanlinesVerticalRetraceTime = 7; // source: ibid
|
||||
const int syncCapacityLineChargeThreshold = 5;
|
||||
const int millisecondsHorizontalRetraceTime = 7; // source: Dictionary of Video and Television Technology, p. 234
|
||||
const int scanlinesVerticalRetraceTime = 10; // source: ibid
|
||||
|
||||
_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
|
||||
@ -299,7 +299,7 @@ void CRT::advance_cycles(int number_of_cycles, bool hsync_requested, const bool
|
||||
{
|
||||
_current_frame_builder->complete();
|
||||
_frames_with_delegate++;
|
||||
_delegate->crt_did_end_frame(this, &_current_frame_builder->frame, _did_detect_hsync);
|
||||
_delegate->crt_did_end_frame(this, &_current_frame_builder->frame, _did_detect_vsync);
|
||||
}
|
||||
|
||||
if(_frames_with_delegate < kCRTNumberOfFrames)
|
||||
|
Loading…
x
Reference in New Issue
Block a user