reflection

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: GPL-3.0, GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package reflection monitors the emulated hardware for conditions that would otherwise not be visible through normal emulation. The reflection system is run every video cycle.

Index

Constants

This section is empty.

Variables

View Source
var OverlayList = []string{"WSYNC", "Collisions", "HMOVE", "Optimised"}

OverlayList is the list of overlays that should be supported by a reflection.Renderer.

View Source
var PaletteElements = []color.RGBA{
	{R: 17, G: 17, B: 17, A: 255},
	{R: 132, G: 200, B: 252, A: 255},
	{R: 146, G: 70, B: 192, A: 255},
	{R: 144, G: 28, B: 0, A: 255},
	{R: 232, G: 232, B: 74, A: 255},
	{R: 213, G: 130, B: 74, A: 255},
	{R: 50, G: 132, B: 50, A: 255},
}

PaletteElements lists the colors to be used when displaying TIA video in a debugger's "debug colors" mode. The default colors are the same as the the debug colors found in the Stella emulator.

View Source
var PaletteEvents = map[string]color.RGBA{
	"WSYNC":         {R: 50, G: 50, B: 255, A: 100},
	"Collision":     {R: 255, G: 25, B: 25, A: 200},
	"CXCLR":         {R: 255, G: 25, B: 255, A: 200},
	"HMOVE delay":   {R: 150, G: 50, B: 50, A: 150},
	"HMOVE":         {R: 50, G: 150, B: 50, A: 150},
	"HMOVE latched": {R: 50, G: 50, B: 150, A: 150},
	"Optimised":     {R: 255, G: 100, B: 25, A: 150},
}

PaletteEvents lists the colors to be used for reflected events. For example, when WSYNC is active the PaletteEvent["WSYNC"] entry should be used.

Functions

This section is empty.

Types

type Hmove added in v0.2.1

type Hmove struct {
	DelayCt  int
	Delay    bool
	Latch    bool
	RippleCt uint8
}

Hmove groups the HMOVE reflection information. It's too complex a property to distil into a single variable.

Ordering of the structure is important.

type IdentifyReflector added in v0.7.1

type IdentifyReflector interface {
	GetReflectionRenderer() Renderer
}

IdentifyReflector implementations can identify a reflection.Renderer.

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor should be run (with the Check() function) every video cycle. The (reflection) Renderer's Reflect() function is consequently also called every video cycle with a populated instance of LastResult.

func NewMonitor

func NewMonitor(vcs *hardware.VCS, renderer Renderer) *Monitor

NewMonitor is the preferred method of initialisation for the Monitor type.

func (*Monitor) Check

func (mon *Monitor) Check(bank mapper.BankInfo) error

Check should be called every video cycle to record the current state of the emulation/system.

func (*Monitor) SyncFrame added in v0.7.1

func (mon *Monitor) SyncFrame()

SyncFrame implements the television.ReflectionSynchronising interface.

func (*Monitor) SyncReflectionPixel added in v0.7.1

func (mon *Monitor) SyncReflectionPixel(idx int) error

SyncReflectionPixel implements the television.ReflectionSynchronising interface.

type Optimisations added in v0.8.0

type Optimisations struct {
	ReusePixel       bool
	NoCollisionCheck bool
}

Optimisations records if a code "short-cut" has taken place during the generation of the reflected video step (or color clock, or "pixel", if you prefer to think of it like that).

type Renderer

type Renderer interface {
	Reflect(VideoStep) error
}

Renderer implementations accepts ReflectPixel values and associates it in some way with the most recent television signal.

type VideoStep added in v0.8.0

type VideoStep struct {
	CPU          execution.Result
	Bank         mapper.BankInfo
	VideoElement video.Element
	TV           signal.SignalAttributes
	Hmove        Hmove
	WSYNC        bool
	IsRAM        bool

	// detail of the optimisations used during the production of this videostep
	Optimisations Optimisations

	// whether Hblank is on. there's no other way of knowing this except
	// directly from the TIA. the TIA does send VideoBlank to the television
	// when Hblank is active but this seems a roundabout way of detecting
	// whether Hblank is active.
	IsHblank bool

	// string representation of collision state for this videostep
	Collision video.Collisions
}

VideoStep packages together the details of the the last video step that would otherwise be difficult for a debugger to access.

It includes the CPU execution result, the bank from which the instruction originates, the video element that produced the last video pixel on screen; among other information.

Note that ordering of the structure is important. There's a saving of about 2MB per frame compared to the unoptimal ordering.

Jump to

Keyboard shortcuts

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