mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Some mild fixes get me up to having a rolling screen of vertical lines. Which is what I was hoping for right now!
This commit is contained in:
parent
1cc13b2799
commit
92754ace7a
@ -130,8 +130,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
} else {
|
||||
const uint16_t decodedAddress = address & 0x3f;
|
||||
switch(decodedAddress) {
|
||||
case 0x00: update_video(); tia_->set_vsync(!!(*value & 0x02)); break;
|
||||
case 0x01: update_video(); tia_->set_vblank(!!(*value & 0x02)); break;
|
||||
case 0x00: update_video(); tia_->set_sync(!!(*value & 0x02)); break;
|
||||
case 0x01: update_video(); tia_->set_blank(!!(*value & 0x02)); break;
|
||||
|
||||
case 0x02:
|
||||
set_ready_line(true);
|
||||
|
@ -11,12 +11,17 @@
|
||||
using namespace Atari2600;
|
||||
namespace {
|
||||
const int cycles_per_line = 228;
|
||||
|
||||
const int sync_flag = 0x1;
|
||||
const int blank_flag = 0x2;
|
||||
}
|
||||
|
||||
TIA::TIA() :
|
||||
horizontal_counter_(0),
|
||||
output_cursor_(0),
|
||||
pixel_target_(nullptr)
|
||||
pixel_target_(nullptr),
|
||||
requested_output_mode_(0),
|
||||
output_mode_(0)
|
||||
{
|
||||
crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 + 1, 1, Outputs::CRT::DisplayType::NTSC60, 1));
|
||||
crt_->set_output_device(Outputs::CRT::Television);
|
||||
@ -95,12 +100,14 @@ void TIA::run_for_cycles(int number_of_cycles)
|
||||
}
|
||||
}
|
||||
|
||||
void TIA::set_vsync(bool vsync)
|
||||
void TIA::set_sync(bool sync)
|
||||
{
|
||||
requested_output_mode_ = (requested_output_mode_ & ~sync_flag) | (sync ? sync_flag : 0);
|
||||
}
|
||||
|
||||
void TIA::set_vblank(bool vblank)
|
||||
void TIA::set_blank(bool blank)
|
||||
{
|
||||
requested_output_mode_ = (requested_output_mode_ & ~blank_flag) | (blank ? blank_flag : 0);
|
||||
}
|
||||
|
||||
void TIA::reset_horizontal_counter()
|
||||
@ -230,7 +237,12 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
8 cycles: blank or pixels, depending on whether the blank extend bit is set
|
||||
152 cycles: pixels
|
||||
*/
|
||||
// if(output_mode_ != requested_output_mode_)
|
||||
// {
|
||||
// // flush the old output
|
||||
// }
|
||||
horizontal_counter_ += number_of_cycles;
|
||||
|
||||
if(!output_cursor_ && horizontal_counter_ >= 16)
|
||||
{
|
||||
crt_->output_blank(32);
|
||||
@ -248,7 +260,7 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
}
|
||||
if(output_cursor_ == 48 && horizontal_counter_ >= 68)
|
||||
{
|
||||
crt_->output_default_colour_burst(40);
|
||||
crt_->output_blank(40);
|
||||
output_cursor_ = 68;
|
||||
}
|
||||
if(horizontal_counter_ > 68)
|
||||
@ -272,10 +284,29 @@ void TIA::output_for_cycles(int number_of_cycles)
|
||||
}
|
||||
}
|
||||
horizontal_counter_ %= cycles_per_line;
|
||||
output_cursor_ %= cycles_per_line;
|
||||
}
|
||||
|
||||
void TIA::output_line()
|
||||
{
|
||||
// TODO: optimise special case
|
||||
output_for_cycles(cycles_per_line);
|
||||
output_mode_ = requested_output_mode_;
|
||||
switch(output_mode_)
|
||||
{
|
||||
default:
|
||||
// TODO: optimise special case
|
||||
output_for_cycles(cycles_per_line);
|
||||
break;
|
||||
case sync_flag:
|
||||
case sync_flag | blank_flag:
|
||||
crt_->output_sync(32);
|
||||
crt_->output_blank(32);
|
||||
crt_->output_sync(392);
|
||||
break;
|
||||
case blank_flag:
|
||||
crt_->output_blank(32);
|
||||
crt_->output_sync(32);
|
||||
crt_->output_default_colour_burst(32);
|
||||
crt_->output_blank(360);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ class TIA {
|
||||
void run_for_cycles(int number_of_cycles);
|
||||
void set_output_mode(OutputMode output_mode);
|
||||
|
||||
void set_vsync(bool vsync);
|
||||
void set_vblank(bool vblank);
|
||||
void set_sync(bool sync);
|
||||
void set_blank(bool blank);
|
||||
void reset_horizontal_counter(); // Reset is delayed by four cycles.
|
||||
|
||||
int get_cycles_until_horizontal_blank(unsigned int from_offset);
|
||||
@ -68,7 +68,11 @@ class TIA {
|
||||
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
||||
|
||||
int horizontal_counter_;
|
||||
|
||||
int output_cursor_;
|
||||
int output_mode_;
|
||||
int requested_output_mode_;
|
||||
|
||||
uint8_t *pixel_target_;
|
||||
|
||||
void output_for_cycles(int number_of_cycles);
|
||||
|
@ -69,7 +69,6 @@
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
enableAddressSanitizer = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "NO">
|
||||
<BuildableProductRunnable
|
||||
|
Loading…
Reference in New Issue
Block a user