savekey

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package savekey implements the SaveKey external memory card. It contains 32KB of non-volatile memory. Suitable for saving high scores, game settings, etc.

The SaveKey type implements the ports.Peripheral interface and can be inserted into a VCS port like any other peripheral.

SaveKey information taken from "AtariVox Programmer's Guide" (16/11/04) by Alex Herbert

allocation list at https://atariage.com/atarivox/atarivox_mem_list.html (13/09/2020).

Index

Constants

View Source
const (
	EEPROMsize     = 0x8000
	EEPROMpageSize = 0x40
	EEPROMnumPages = EEPROMsize / EEPROMpageSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	logger.Permission
}

type DataDirection

type DataDirection int

DataDirection indicates the direction of data flow between the console and the SaveKey.

const (
	Reading DataDirection = iota
	Writing
)

Valid DataDirection values.

type EEPROM

type EEPROM struct {

	// the next address an i2c read/write operation will access
	Address uint16

	// current data
	Data []uint8

	// the data as it is on disk. data is mutable and we need a way of
	// comparing what's on disk with what's in memory.
	Disk []uint8
	// contains filtered or unexported fields
}

EEPROM represents the non-volatile memory in the SaveKey peripheral.

func (*EEPROM) IsSaved added in v0.7.5

func (ee *EEPROM) IsSaved() bool

IsSaved returns true if disk data is the same as data

func (*EEPROM) Restore added in v0.7.5

func (ee *EEPROM) Restore()

Restore is exposed so that it can be used by an external package - like a GUI package once we add it

func (*EEPROM) Save added in v0.7.5

func (ee *EEPROM) Save()

Save is exposed so that it can be used by an external package - like a GUI package once we add it

type SaveKey

type SaveKey struct {

	// only two bits of the SWCHA value is of interest to the i2c protocol.
	// from the perspective of the second player (in which port the SaveKey is
	// usually inserted) pin 2 is the data signal (SDA) and pin 3 is the
	// clock signal (SCL)
	SDA i2c.Trace
	SCL i2c.Trace

	// incoming data is interpreted depending on the state of the i2c protocol.
	// we also need to know the direction of data flow at any given time and
	// whether the next bit should be acknowledged
	State SaveKeyState
	Dir   DataDirection
	Ack   bool

	// data is sent by the console one bit at a time. see recvBit(), sendBit() and resetBits()
	Bits   uint8
	BitsCt int

	// the core of the SaveKey is an EEPROM.
	EEPROM *EEPROM
	// contains filtered or unexported fields
}

SaveKey represents the SaveKey peripheral. It implements the Peripheral interface.

func NewSaveKey

func NewSaveKey(ctx Context, r peripherals.RIOT, t peripherals.TIA, portRight bool) *SaveKey

NewSaveKey is the preferred method of initialisation for the SaveKey type.

func (*SaveKey) IsAnalogue

func (sk *SaveKey) IsAnalogue() bool

func (*SaveKey) IsController

func (sk *SaveKey) IsController() bool

func (*SaveKey) Reset

func (sk *SaveKey) Reset()

func (*SaveKey) Tick

func (sk *SaveKey) Tick()

func (*SaveKey) Unplug

func (sk *SaveKey) Unplug()

func (*SaveKey) Update

func (sk *SaveKey) Update(inp gui.Input) error

type SaveKeyState

type SaveKeyState int

SaveKeyState records how incoming signals to the SaveKey will be interpreted.

const (
	SaveKeyStopped SaveKeyState = iota
	SaveKeyStarting
	SaveKeyAddressHi
	SaveKeyAddressLo
	SaveKeyData
)

List of valid SaveKeyState values.

Directories

Path Synopsis
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.

Jump to

Keyboard shortcuts

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