delay

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: GPL-3.0, GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package delay is a replacement for the future package, which has now been removed. This package (and the package it replaces) helps emulate the latching delays of the TIA.

The future package served it's purpose during early, exploratory phases of the emulator's development. I wasn't sure at first what was needed and the future package developed as a way of supporting experimentation with the various elements of the TIA system.

The delay package is a lot simpler and consequently a lot more efficient.

The only element in the package is the Event type. An Event type instance represents a single future change to the TIA system, which will take place after the stated number of cycles.

To effectively emulate the electronics of the TIA these Events can be dropped, rescheduled or premepted almost at will.

Ordering of Events is rarely significant but in the instances where it is comments are included in the code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

Event represents something that will occur in the future.

func (*Event) AboutToEnd

func (e *Event) AboutToEnd() bool

AboutToEnd returns true if the event expires on the next call to Tick().

func (*Event) Drop

func (e *Event) Drop()

Drop or cancel an event. Used by ball and player sprites.

func (*Event) Force

func (e *Event) Force() uint8

Force an event to end now, returning the value. Used by missile and player sprites.

func (*Event) IsActive

func (e *Event) IsActive() bool

IsActive returns true if the event is still active. Paused event will still report as being active.

func (*Event) JustStarted

func (e *Event) JustStarted() bool

JustStarted returns true if Tick() has not yet been called.

func (*Event) Pause

func (e *Event) Pause()

Pause the ticking of the event. Tick() will have no effect. There is no Resume() function because it is not needed. However, a paused event can be Forced() (missile and player sprites) or Dropped() (ball and player sprites).

func (*Event) Push

func (e *Event) Push()

Push event so that it starts again. Same as dropping and rescheduling although JustStarted() will not return true for a pushed event. Used by player, missile and ball sprites.

func (*Event) Remaining

func (e *Event) Remaining() int

The number of remaining cycles.

func (*Event) Resume added in v0.10.1

func (e *Event) Resume()

func (*Event) Schedule

func (e *Event) Schedule(delay int, value uint8)

Schedule an event to occur in the future. To keep things simple and easily copyable (essential for the rewind system) only one value of type uint8 can be stored in an Event.

func (*Event) Tick

func (e *Event) Tick() (uint8, bool)

Tick the event forward one cycle. Should be called once per color clock from the TIA or TIA controlled subsystem (eg. the player sprite).

Jump to

Keyboard shortcuts

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