hardware

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: GPL-3.0, GPL-3.0 Imports: 19 Imported by: 3

Documentation

Overview

Package hardware is the base package for the VCS emulation. It and its sub-package contain everything required for a headless emulation.

The VCS type is the root of the emulation and contains external references to all the VCS sub-systems. From here, the emulation can either be started to run continuously (with optional callback to check for continuation); or it can be stepped cycle by cycle. Both CPU and video cycle stepping are supported.

Index

Constants

View Source
const ColorClocksPerCPUCycle = 3

The number of times the TIA updates every CPU cycle.

View Source
const PerformanceBrake = 100

While the continueCheck() function only runs at the end of a CPU instruction (unlike the corresponding function in VCS.Step() which runs every video cycle), it can still be expensive to do a full continue check every time.

It depends on context whether it is used or not but the PerformanceBrake is a standard value that can be used to filter out expensive code paths within a continueCheck() implementation. For example:

performanceFilter++
if performanceFilter >= hardware.PerfomrmanceBrake {
	performanceFilter = 0
	if end_condition == true {
		return govern.Ending, nill
	}
}
return govern.Running, nill

Variables

This section is empty.

Functions

This section is empty.

Types

type VCS

type VCS struct {
	Env *environment.Environment

	// the television is not "part" of the VCS console but it's part of the VCS system
	TV *television.Television

	// references to the different components of the VCS. do not take copies of
	// these pointer values because the rewind feature will change them.
	CPU  *cpu.CPU
	Mem  *memory.Memory
	RIOT *riot.RIOT
	TIA  *tia.TIA

	Input *input.Input

	// The Clock defines the basic speed at which the the machine is runningt. This governs
	// the speed of the CPU, the RIOT and attached peripherals. The TIA runs at
	// exactly three times this speed.
	//
	// The different clock speeds are due to the nature of the different TV
	// specifications. Put simply, a PAL machine must run slightly slower in
	// order to be able to send a correct PAL signal to the television.
	//
	// Unlike the real hardware however, it is not the console that governs the
	// clock speed but the television. A ROM will send a signal to the
	// television, the timings of which will be used by the tv implementation
	// to decide what type of TV signal (PAL or NTSC) is being sent. When the
	// television detects a change in the TV signal it will notify the emulated
	// console, allowing it to note the new implied clock speed.
	Clock float32
}

VCS struct is the main container for the emulated components of the VCS.

func NewVCS

func NewVCS(tv *television.Television, prefs *preferences.Preferences) (*VCS, error)

NewVCS creates a new VCS and everything associated with the hardware. It is used for all aspects of emulation: debugging sessions, and regular play.

The two arguments must be supplied. In the case of the prefs field it can by nil and a new preferences instance will be created. Providing a non-nil value allows the preferences of more than one VCS emulation to be synchronised.

The Instance.Context field should be updated except in the case of the "main" emulation.

func (*VCS) AttachCartridge

func (vcs *VCS) AttachCartridge(cartload cartridgeloader.Loader, reset bool) error

AttachCartridge to this VCS. While this function can be called directly it is advised that the setup package be used in most circumstances.

The emulated VCS is *not* reset after AttachCartridge() unless the reset argument is true.

Note that the emulation should always be reset before emulation commences but some applications might need to prepare the emulation further before that happens.

func (*VCS) DetatchEmulationExtras added in v0.15.0

func (vcs *VCS) DetatchEmulationExtras()

DetatchEmulationExtras removes all possible monitors, recorders, etc. from the emulation. Currently this mean: the TIA audio tracker, the RIOT event recorders and playback, and RIOT plug monitor.

func (*VCS) End added in v0.15.0

func (vcs *VCS) End()

End cleans up any resources that may be dangling.

func (*VCS) FingerprintPeripheral added in v0.18.0

func (vcs *VCS) FingerprintPeripheral(id plugging.PortID, cartload cartridgeloader.Loader) error

FingerprintPeripheral inserts the peripheral that is thought to be best suited for the current inserted cartridge.

func (*VCS) Plumb added in v0.16.0

func (vcs *VCS) Plumb(fromDifferentEmulation bool)

Plumb the various VCS sub-systems together after a rewind.

The fromDifferentEmulation indicates that the State has been created by a different VCS emulation than the one being plumbed into.

func (*VCS) Reset

func (vcs *VCS) Reset() error

Reset emulates the reset switch on the console panel.

func (*VCS) Run

func (vcs *VCS) Run(continueCheck func() (govern.State, error)) error

Run sets the emulation running as quickly as possible

func (*VCS) RunForFrameCount

func (vcs *VCS) RunForFrameCount(numFrames int, continueCheck func(frame int) (govern.State, error)) error

RunForFrameCount sets emulator running for the specified number of frames. Useful for FPS and regression tests. Not used by the debugger because traps (and volatile traps) are more flexible.

func (*VCS) SetClockSpeed added in v0.8.0

func (vcs *VCS) SetClockSpeed(tvSpec string) error

SetClockSpeed is an implemtation of the television.VCSReturnChannel interface.

func (*VCS) Step

func (vcs *VCS) Step(videoCycleCallback func() error) error

Step the emulator state one CPU instruction. With a bit of work the optional videoCycleCallback argument can be used for video-cycle stepping.

Directories

Path Synopsis
cpu
Package cpu emulates the 6507 microprocessor found in the Atari VCS.
Package cpu emulates the 6507 microprocessor found in the Atari VCS.
execution
Package execution tracks the result of instruction execution on the CPU.
Package execution tracks the result of instruction execution on the CPU.
functional_test
Package functional_test runs the 6502 functional test as defined by Klaus Dormann.
Package functional_test runs the 6502 functional test as defined by Klaus Dormann.
instructions
Package instructions defines the table of instruction for the 6507.
Package instructions defines the table of instruction for the 6507.
registers
Package registers implements the three types of registers found in the 6507.
Package registers implements the three types of registers found in the 6507.
registers/test
Package test contains functions useful for testing CPU registers.
Package test contains functions useful for testing CPU registers.
Pacakge input coordinates all the different types of input into the VCS.
Pacakge input coordinates all the different types of input into the VCS.
Package memory implements the Atari VCS memory model.
Package memory implements the Atari VCS memory model.
cartridge
Package cartridge fully implements loading of mapping of cartridge memory.
Package cartridge fully implements loading of mapping of cartridge memory.
cartridge/ace
Package ace implements the ACE cartridge mapper.
Package ace implements the ACE cartridge mapper.
cartridge/arm
Package arm imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference:
Package arm imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference:
cartridge/arm/architecture
Package architecture defines the Map type that is used to specify the differences in cartridge and ARM archtectures.
Package architecture defines the Map type that is used to specify the differences in cartridge and ARM archtectures.
cartridge/arm/callfn
Package Callfn facilitates the ARM CALLFN process common to both DPC+ and CDF* cartridge mappers.
Package Callfn facilitates the ARM CALLFN process common to both DPC+ and CDF* cartridge mappers.
cartridge/arm/peripherals
Package peripherals implements the optional modules that can make up the ARM processor.
Package peripherals implements the optional modules that can make up the ARM processor.
cartridge/cdf
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
cartridge/dpcplus
Package dpcplus implements the DPC+ cartridge mapper.
Package dpcplus implements the DPC+ cartridge mapper.
cartridge/elf
Package ace implements the ELF cartridge mapper.
Package ace implements the ELF cartridge mapper.
cartridge/mapper
Package mapper contains the CartMapper interface.
Package mapper contains the CartMapper interface.
cartridge/moviecart
Package moviecart implements the Movie Cart special cartridge type.
Package moviecart implements the Movie Cart special cartridge type.
cartridge/plusrom
Package plusrom implements the PlusROM cartridge as developed by Wolfgang Stubig.
Package plusrom implements the PlusROM cartridge as developed by Wolfgang Stubig.
cartridge/plusrom/plusnet
Package plusnet contains details of the PlusNET protocol.
Package plusnet contains details of the PlusNET protocol.
cartridge/supercharger
Package supercharger implements the tape based cartridge format.
Package supercharger implements the tape based cartridge format.
chipbus
Package chipbus defines the operations, addresses and symbols that are required by the TIA and RIOT chips when updated values in memory.
Package chipbus defines the operations, addresses and symbols that are required by the TIA and RIOT chips when updated values in memory.
cpubus
Package cpubus defines the operations, addresses and symbols that are required by the CPU when reading/writing to memory.
Package cpubus defines the operations, addresses and symbols that are required by the CPU when reading/writing to memory.
memorymap
Package memorymap facilitates the translation of addresses to primary address equivalents.
Package memorymap facilitates the translation of addresses to primary address equivalents.
vcs
Package vcs represents the areas of memory that are internal to the VCS hardware.
Package vcs represents the areas of memory that are internal to the VCS hardware.
Package peripherals is a container package for all the various peripherals for the Atari 2600 that are emulated.
Package peripherals is a container package for all the various peripherals for the Atari 2600 that are emulated.
atarivox
Package atarivox implements the atarivox peripheral.
Package atarivox implements the atarivox peripheral.
atarivox/atarivoxengines
Package atarivoxengines contains implementations of the AtariVoxEngine interface, for use with the AtariVox peripheral.
Package atarivoxengines contains implementations of the AtariVoxEngine interface, for use with the AtariVox peripheral.
controllers
Package controllers contains the implementations for all the emulated controllers for the VCS.
Package controllers contains the implementations for all the emulated controllers for the VCS.
savekey
Package savekey implements the SaveKey external memory card.
Package savekey implements the SaveKey external memory card.
savekey/i2c
Package i2c facilitates the reading of i2c data for the SaveKey (and AtariVox) peripherals.
Package i2c facilitates the reading of i2c data for the SaveKey (and AtariVox) peripherals.
Package preferences (sub-package of the hardware package) coordinates the options for all variations in hardware operation.
Package preferences (sub-package of the hardware package) coordinates the options for all variations in hardware operation.
Package riot (RIOT) represents the active part of the PIA 6532.
Package riot (RIOT) represents the active part of the PIA 6532.
ports
Package ports represents the input/output parts of the VCS (the IO in RIOT).
Package ports represents the input/output parts of the VCS (the IO in RIOT).
ports/panel
Package panel implements the front control panel of the VCS.
Package panel implements the front control panel of the VCS.
ports/plugging
Package plugging conceptualises the act of plugging devices into the VCS ports.
Package plugging conceptualises the act of plugging devices into the VCS ports.
timer
Package timer represents the timer part of the RIOT (the T in RIOT).
Package timer represents the timer part of the RIOT (the T in RIOT).
Package television implements the output device of the emulated VCS.
Package television implements the output device of the emulated VCS.
coords
Package coords represents and can work with television coorindates
Package coords represents and can work with television coorindates
signal
Package signal exposes the interface between the VCS and the television implementation.
Package signal exposes the interface between the VCS and the television implementation.
specification
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.
tia
Package TIA implements the custom video/audio chip found in the the VCS.
Package TIA implements the custom video/audio chip found in the the VCS.
audio
Package audio implements the audio generation of the TIA.
Package audio implements the audio generation of the TIA.
audio/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.
delay
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.
hmove
Package hmove represents the TIA HMOVE process.
Package hmove represents the TIA HMOVE process.
phaseclock
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.
polycounter
Package polycounter implements the polynomial counters found in the TIA.
Package polycounter implements the polynomial counters found in the TIA.
revision
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.
video
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