reflection

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: GPL-3.0, GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package reflection monitors the emulated hardware for conditions that would otherwise not be visible. In particular it signals the reflection renderer when certain memory addresses have been written to. For example, the HMOVE register.

In addition it monitors the state of WSYNC and signals the reflection renderer when the CPU is idle. This makes for quite a nice visual indication of "lost cycles" or potential extra cycles that could be regained with a bit of reorgnisation.

There are lots of other things we could potentially do with the reflection idea but as it is, it is a little underdeveloped. In particular, it's rather slow but I'm not too worried about that because this is for debugging not actually playing games and such.

I think the next thing this needs is a way of making the various monitors switchable at runtime. As it is, what's compiled is what we get. If we monitored every possible thing, a visual display would get cluttered very quickly. It would be nice to be able to define groups (say, a player sprites group, a HMOVE group, etc.) and to turn them on and off according to our needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

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

Monitor watches for writes to specific video related memory locations. when these locations are written to, a signal is sent to the Renderer implementation. moreover, if the monitor detects that the effect of the memory write is delayed or sustained, then the signal is repeated as appropriate.

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() error

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

type ReflectPixel

type ReflectPixel struct {
	Label string

	// Renderer implementations are free to use the color information
	// as they wish (adding alpha information seems a probable scenario).
	Red, Green, Blue, Alpha byte

	// whether the attribute is one that is "instant" or resolves after a
	// short scheduled delay
	Scheduled bool
}

ReflectPixel contains additional debugging information from the last video cycle. it is up to the Renderer to match this up with the last television signal

type Renderer

type Renderer interface {
	SetReflectPixel(ReflectPixel) error
}

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

type StubRenderer

type StubRenderer struct{}

StubRenderer is a minimal implementation of reflection.StubRenderer

func (*StubRenderer) SetReflectPixel

func (mpx *StubRenderer) SetReflectPixel(_ ReflectPixel) error

SetReflectPixel implements the relfection.Renderer interface

Jump to

Keyboard shortcuts

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