specification

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: GPL-3.0, GPL-3.0 Imports: 3 Imported by: 1

Documentation

Overview

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 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 SpecList = []string{"NTSC", "PAL", "PAL60"}

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 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 types.

var SpecPAL Spec

SpecPAL is the specification for PAL television types.

var SpecPAL60 Spec

SpecPAL60 is the specification for PAL60 television types.

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