phaseclock

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2023 License: GPL-3.0, GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package phaseclock defines the two phase clock generator used to drive the various polynomial counters in the TIA.

From the TIA_HW_Notes document:

Beside each counter there is a two-phase clock generator. This takes the
incoming 3.58 MHz colour clock (CLK) and divides by 4 using a couple of
flip-flops. Two AND gates are then used to generate two independent clock
signals thusly:
 ___         ___         ___
_| |_________| |_________| |_________  PHASE-1 (H@1)
       ___         ___         ___
_______| |_________| |_________| |___  PHASE-2 (H@2)

Even though the two phases are independent these types of clocks never overlap (the skew margin is always positive). This means that the implementation can be simplified to a simple count from 0 to 3.

The phaseclock can be "ticked" along by incrementing the integer and making sure it doesn't exceed the possible values: The accepted pattern is:

p++
if p >= phaseclock.NumStates {
	p = 0
}

Resetting and aligning the phase clock can be done by simply assigning the correct value to the PhaseClock instance. Use ResetValue and AlignValue for most purposes.

This file is part of Gopher2600.

Gopher2600 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Gopher2600 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const AlignValue = RisingPhi1

ResetValue is used to align the phaseclock.

View Source
const NumStates = 4

NumStates is the number of phases the clock can be in.

View Source
const ResetValue = RisingPhi2

ResetValue is used to reset the phaseclock.

Variables

This section is empty.

Functions

This section is empty.

Types

type PhaseClock

type PhaseClock int

The four-phase clock can be represent as an integer.

const (
	RisingPhi1 PhaseClock = iota
	FallingPhi1
	RisingPhi2
	FallingPhi2
)

Valid PhaseClock values/states

Note that the labels H@1 and H@2 are used in the TIA schematics for the HSYNC circuit. the phase clocks for the other polycounters are labelled differently, eg. P@1 and P@2 for the player sprites. to avoid confusion, we're using the labels Phi1 and Phi2, applicable to all polycounter phaseclocks.

func (PhaseClock) String

func (clk PhaseClock) String() string

String creates a single line ASCII representation of the current state of the PhaseClock.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL