specification

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: GPL-3.0 Imports: 5 Imported by: 1

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

View Source
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

View Source
const (
	WidthTV    = ClksVisible
	WidthHDTV  = ClksVisible
	HeightTV   = WidthTV * 3 / 4
	HeightHDTV = WidthHDTV * 9 / 16
)

These width and height values can be used to create a TV image (pixel buffer) of the appropriate asepect ratio. The values can be scaled as appropriate

View Source
const AbsoluteMaxClks = AbsoluteMaxScanlines * ClksScanline

The absolute number of color clock allowed by the TV regardless of specification

View Source
const AbsoluteMaxScanlines = 350

The absolute number of scanlines allowed by the TV regardless of the current specification. The value here is arbitrary but it represents the natural resonance of the vertical oscilator

For reference, this is equivalent to a frequency of approximately 45Hz

View Source
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

View Source
var PaletteNTSC = []color.RGBA{}

PaletteNTSC is the collection of NTSC colours.

View Source
var PalettePAL = []color.RGBA{}

PalettePAL is the collection of PAL colours.

View Source
var PaletteSECAM = []color.RGBA{}

PaletteSECAM is the collection of SECAM colours.

View Source
var ReqSpecList = slices.Concat([]string{"AUTO"}, SpecList, []string{"PAL60"})

ReqSpecList is the list of specifications that can be requested. This is different to the actual spec list in that it includes "PAL60" and "AUTO" as an option

View Source
var SpecList = []string{"NTSC", "PAL", "PAL-M", "SECAM"}

SpecList is the list of specifications that the television may adopt.

View Source
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 NormaliseReqSpecID added in v0.32.0

func NormaliseReqSpecID(id string) (string, bool)

NormaliseReqSpecID converts the ID string such that it is one of the values in ReqSpecList. If the ID is not in ReqSpecList then false is returned.

For completeness, the empty string is converted to "AUTO". "PALM" is converted to "PAL-M"; and "PAL-60" converted to "PAL60".

func SearchReqSpec added in v0.32.0

func SearchReqSpec(s string) string

SearchReqSpec looks for a valid sub-string in s, that indicates a required TV specification. The returned value is one listed in ReqSpecList or the empty string to indicate that nothing was found in the supplied string.

This function is intended to be used for searching filenames or descriptions. It probably shouldn't be used as a general conversion tool.

Types

type Rotation added in v0.26.0

type Rotation int

Rotation indicates the orienation of the television

const (
	NormalRotation Rotation = iota
	LeftRotation
	FlippedRotation
	RightRotation
)

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

func (Rotation) String added in v0.26.0

func (r Rotation) String() string

type Spec

type Spec struct {
	ID     string
	Colors []color.RGBA

	// horizontal scan rate is used to calculate the refresh rate figure
	HorizontalScanRate float32

	// 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

	// the ideal visible top/bottom valuss are the inital values taken by the
	// resizer. in the case of PAL and SECAM these are the same as the Atari
	// Safe top/bottom values but in the case of NTSC and PAL_M the ideal values
	// create a slightly larger aperture in order to create a 4:3 image in the
	// majority of cases
	IdealVisibleTop    int
	IdealVisibleBottom 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 ExtendedVisibleTop an
	// ExtendedVisibleBottom 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.
	ExtendedVisibleTop    int
	ExtendedVisibleBottom int
}

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 SpecPAL_M Spec

SpecPAL_M is the specification for PALM television type

var SpecSECAM Spec

SpecSECAM is the specification for SECAM television type

func (*Spec) GetColor

func (spec *Spec) GetColor(col signal.ColorSignal) color.RGBA

GetColor translates a signals to the color type.

Jump to

Keyboard shortcuts

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