tia

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package TIA implements the custom video/audio chip found in the the VCS. The TIA is an extremely tricky device and great effort has been expended in creating an accurate emulation. There are undoubtedly subtleties not considered by the emulation but none-the-less it seems accurate for a great many of the ROMs that have been tested.

For clarity the emulation is split across six packages, which coordinates the other five. The principle of the TIA emulation is as follows:

Three times for every tick of the CPU, the TIA Step() function is called. The Step() function takes a single argument saying whether TIA memory should be checked for side-effects. The timing of this is handled by the VCS type in the hardware package but generally speaking there is three video cycles (TIA Step()s) for every one CPU cycle.

The best description of how the TIA works is to be found in the document:

Atari 2600 TIA Hardware Notes, v1.0, by Andrew Towers

The file is often named TIA_HW_Notes.txt and that is the label that is used when referring to it, throughout the commentary in this emulation. The remainder of this Overview relates the high level concepts described in that document with the emulation. Sub-package documentation go into further detail, and code commentary into even more.

The two-phase clock generator is implemented in the phaseclock package. Each phase clock is ticked forward whenever the part of the TIA affected is active. For the Horizontal Clock, the phase clock is ticked forward on every call to Step().

Closely related to the phase clock is the polynomial counter or polycounter (and found in the package of that name). A polycounter is ticked forward whenever its controlling phase clock reaches the rising edge of the second phase. In this emulation that means whenever the phase clock's Phi2() function returns true.

The most important use of the polycounter is the HSYNC counter. The HSYNC counter controls the horizontal scanline of the television screen. At key points in the polycounter sequence, signals are sent to the television. and are used to synchronise the VCS and the TV (eg. HBLANK)

Updating of TIA registers happens in carefully orchestrated cascade. I defer to the code and commentary for the fuller description of what is happening, but it is sufficient to say here that some side effects must take place before others. The various Update*() functions in the tia package and sub-packages help achieve this.

At the end of every Step() function (the end of the video cycle) the TV signal is compiled and sent to the attached television.

The audio signal is also calculated at this point and sent along at the same time. The VCS audio implementation can found in the audio sub-package.

A very important concept in the emulation of the TIA is the concept of delays. Delays occur in the TIA as a consequence of the electric circuit design and also because of the presence of digital latches. For the emulation I have not considered the difference causes in too much detail and have implemented delays in the future package. The TIA code is sprinkled with references to future Events throughout all packages and sub-packages; the timing of when these Events are ticked forward is critically important to the accuracy of the emulation. Again, I defer to the code and commentary for detailed explanations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TIA

type TIA struct {
	Rev *revision.TIARevision

	// for clarity we think of tia video and audio as sub-systems
	Video *video.Video
	Audio *audio.Audio

	// horizontal blank controls whether to send colour information to the
	// television. it is turned on at the end of the visible screen and turned
	// on depending on the HMOVE latch. it is also used to control when sprite
	// counters are ticked.
	Hblank bool

	// Hmove information
	Hmove hmove.Hmove
	// contains filtered or unexported fields
}

TIA contains all the sub-components of the VCS TIA sub-system.

func NewTIA

func NewTIA(tv signal.TelevisionTIA, mem bus.ChipBus, input bus.UpdateBus, cpu *cpu.CPU) (*TIA, error)

NewTIA creates a TIA, to be used in a VCS emulation.

func (*TIA) Label

func (tia *TIA) Label() string

Label returns an identifying label for the TIA.

func (*TIA) Plumb added in v0.7.1

func (tia *TIA) Plumb(tv signal.TelevisionTIA, mem bus.ChipBus, input bus.UpdateBus, cpu *cpu.CPU)

Plumb the a new ChipBus into the TIA.

func (*TIA) RSYNCstate added in v0.10.1

func (tia *TIA) RSYNCstate() (bool, bool)

RSYNCstate returns whether the RSYNC alignment and reset latches are active. Both are scheduled at the same time and align takes less time to complete than the reset.

func (*TIA) ReadMemTIA added in v0.12.1

func (tia *TIA) ReadMemTIA(data bus.ChipData) bool

ReadMemTIA checks for side effects in the TIA sub-system.

Returns true if ChipData has *not* been serviced.

func (*TIA) Snapshot added in v0.7.1

func (tia *TIA) Snapshot() *TIA

Snapshot creates a copy of the TIA in its current state.

func (*TIA) Step

func (tia *TIA) Step(readMemory bool)

Step moves the state of the tia forward one video cycle.

func (*TIA) String

func (tia *TIA) String() string

Directories

Path Synopsis
Package audio implements the audio generation of the TIA.
Package audio implements the audio generation of the TIA.
mix
Package mix is used to combine two distinct sound sources into either a mono or stereo signal.
Package mix is used to combine two distinct sound sources into either a mono or stereo signal.
Package delay is a replacement for the future package, which has now been removed.
Package delay is a replacement for the future package, which has now been removed.
Package hmove represents the TIA HMOVE process.
Package hmove represents the TIA HMOVE process.
Package phaseclock defines the two phase clock generator used to drive the various polynomial counters in the TIA.
Package phaseclock defines the two phase clock generator used to drive the various polynomial counters in the TIA.
Package polycounter implements the polynomial counters found in the TIA.
Package polycounter implements the polynomial counters found in the TIA.
Package revision handles/documents the differences in the TIA across different models of the Atari 2600.
Package revision handles/documents the differences in the TIA across different models of the Atari 2600.
Package video implements pixel generation for the emulated TIA.
Package video implements pixel generation for the emulated TIA.

Jump to

Keyboard shortcuts

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