Documentation ¶
Overview ¶
Package specification contains the definitions, including colour, of the PAL and NTSC television protocols supported by the emulation.
Package specification contains the definitions, including colour, of the PAL and NTSC television protocols supported by the emulation.
Index ¶
Constants ¶
const ( ClksHBlank = 68 ClksVisible = 160 ClksScanline = 228 )
From the Stella Programmer's Guide:
"Each scan lines starts with 68 clock counts of horizontal blank (not seen on the TV screen) followed by 160 clock counts to fully scan one line of TV picture. When the electron beam reaches the end of a scan line, it returns to the left side of the screen, waits for the 68 horizontal blank clock counts, and proceeds to draw the next line below."
Clock counts are the same for both TV specifications. Vertical information should be accessed via SpecNTSC or SpecPAL
const AbsoluteMaxClks = AbsoluteMaxScanlines * ClksScanline
The absolute number of color clock allowed by the TV regardless of specification
const AbsoluteMaxScanlines = 313
The absolute number of scanlines allowed by the TV regardless of specification
This is one more than the number of scanlines allowed by the PAL specification. This is so that a ROM that uses the absolute maximum number of scanlines for PAL can accomodate the VSYNC signal, which may just tip over into the extra line
An example of such a ROM is the demo Chiphead ¶
The raises the quesion why we're choosing to render the VSYNC signal. For debugging purposes it is useful to see where the TV thinks it is but it can perhaps be done better
!!TODO: think about how we're sending VSYNC to the pixel renderer
const PALTrigger = 302
The number of scanlines at which to flip between the NTSC and PAL specifications. If the number of scanlines generated is greater than this value then the PAL specification should be assumed
Variables ¶
var PaletteNTSC = []color.RGBA{}
PaletteNTSC is the collection of NTSC colours.
var PalettePAL = []color.RGBA{}
PalettePAL is the collection of PAL colours.
var PaletteSECAM = []color.RGBA{}
PaletteSECAM is the collection of SECAM colours.
var SpecList = []string{"NTSC", "PAL", "PAL60", "SECAM"}
SpecList is the list of specifications that the television may adopt.
var VideoBlack = color.RGBA{0, 0, 0, 255}
VideoBlack is the color produced by a television in the absence of a color signal.
Functions ¶
func SearchSpec ¶ added in v0.12.1
SearchSpec looks for a valid sub-string in s, that indicates a required TV specification. The returned value is a canonical specication label as listed in SpecList.
If no valid sub-string can be found the empty string is returned.
Types ¶
type Rotation ¶ added in v0.26.0
type Rotation int
Rotation indicates the orienation of the television
List of valid Rotation values. The values are arranged so that they can be thought of as the number of 90 degrees turns to get to that position. Alternatively, multiplying the Rotation value by 1.5708 will give the number of radians required for the rotation
type Spec ¶
type Spec struct { ID string Colors []color.RGBA // the nominal refresh rate for the specification. this refresh rate will // be produced if the actual number of scanlines per frame is the same as // OptimalTotal defined below. RefreshRate float32 // the number of scanlines the 2600 Programmer's guide recommends for the // top/bottom parts of the screen: // // "A typical frame will consists of 3 vertical sync (VSYNC) lines*, 37 vertical // blank (VBLANK) lines, 192 TV picture lines, and 30 overscan lines. Atari’s // research has shown that this pattern will work on all types of TV sets." // // the quoted figures above are in reference to the NTSC protocol ScanlinesVSync int ScanlinesVBlank int ScanlinesVisible int ScanlinesOverscan int // the optimal number of total scanlines for the entire frame. is the sum of // the four regions defined above. // // if the actual TV frame has a different number than this then the refresh // rate will not be optimal. ScanlinesTotal int // the scanline at which the VBLANK should be turned off (Top) and // turned back on again (Bottom). the period between the top and bottom // scanline is the visible portion of the screen. // // in practice, the VCS can turn VBLANK on and off at any time; what the // two values below represent what "Atari's research" (according to page 1 // of the "Stella Programmer's Guide") has shown to be safe. by definition // this means that: // // Top = VSync + Vblank // // Bottom = Top + Visible // // or // // Bottom = Total - Overscan AtariSafeVisibleTop int AtariSafeVisibleBottom int // resizing of the TV is problematic because we can't rely on the VBLANK to // tell us when the pixels are meant to be in view. The NewSafeVisibleTop an // SafeBottom are the min/max values that the resizer should allow. // // think of these as the "modern" safe values as compared to the Atari // defined safe values. NewSafeVisibleTop int NewSafeVisibleBottom int // AaspectBias transforms the scaling factor for the X axis. // values taken from Stella emulator. useful for A/B testing AspectBias float32 }
Spec is used to define the two television specifications.
var SpecNTSC Spec
SpecNTSC is the specification for NTSC television type
var SpecPAL Spec
SpecPAL is the specification for PAL television type
var SpecPAL60 Spec
SpecPAL60 is the specification for PAL60 television type
var SpecSECAM Spec
SpecSECAM is the specification for SECAM television type