1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Add commentary, and TODOs.

This commit is contained in:
Thomas Harte 2023-05-18 16:50:46 -04:00
parent c76048bff9
commit ce8bd011d7

View File

@ -35,12 +35,16 @@ Base<personality>::Base() :
// "For a line interrupt, /INT is pulled low 608 mclks into the appropriate scanline relative to pixel 0.
// This is 3 mclks before the rising edge of /HSYNC which starts the next scanline."
//
// i.e. it's 304 internal clocks after the end of the left border.
mode_timing_.line_interrupt_position = (LineLayout<personality>::EndOfLeftBorder + 304) % LineLayout<personality>::CyclesPerLine;
// For a frame interrupt, /INT is pulled low 607 mclks into scanline 192 (of scanlines 0 through 261) relative to pixel 0.
// This is 4 mclks before the rising edge of /HSYNC which starts the next scanline.
//
// i.e. it's 1/2 cycle before the line interrupt position, which I have rounded. Ugh.
mode_timing_.end_of_frame_interrupt_position.column = mode_timing_.line_interrupt_position - 1;
mode_timing_.end_of_frame_interrupt_position.row = 193;
mode_timing_.end_of_frame_interrupt_position.row = 192 + (LineLayout<personality>::EndOfLeftBorder + 304) / LineLayout<personality>::CyclesPerLine;
}
if constexpr (is_yamaha_vdp(personality)) {
@ -81,6 +85,7 @@ TMS9918<personality>::TMS9918() {
template <Personality personality>
void TMS9918<personality>::set_tv_standard(TVStandard standard) {
// TODO: the Yamaha is programmable on this at runtime.
this->tv_standard_ = standard;
switch(standard) {
case TVStandard::PAL:
@ -214,8 +219,10 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
// ---------------------------------------
// Latch scrolling position, if necessary.
// ---------------------------------------
// TODO: shouldn't this happen one per frame?
if constexpr (is_sega_vdp(personality)) {
if(this->fetch_pointer_.column < 61 && end_column >= 61) {
constexpr auto latch_time = to_internal<personality, Clock::Grauw>(61); // TODO: where did this magic constant come from? Is it the same for the Game Gear, etc?
if(this->fetch_pointer_.column < latch_time && end_column >= latch_time) {
if(!this->fetch_pointer_.row) {
Storage<personality>::latched_vertical_scroll_ = Storage<personality>::vertical_scroll_;