specification

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 4 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 AbsoluteMaxClks = AbsoluteMaxScanlines * ClksScanline

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

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

View Source
const AspectBias = 0.91

AspectBias transforms the scaling factor for the X axis. in other words, for width of every pixel is height of every pixel multiplied by the aspect bias

Earlier versions of the emulator set this according to the specification that was in use. However, I now believe this is wrong and a nominal value of 0.91 is good for all specifications. For comparison, the historical value for PAL output was set to 1.09

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 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 SearchSpec added in v0.12.1

func SearchSpec(s string) string

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

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

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

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

SpecPALM 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