cartridge

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: 7 Imported by: 0

Documentation

Overview

Package cartridge fully implements loading of mapping of cartridge memory.

There are many different types of cartridge most of which are supported by the package. Some cartridge types contain additional RAM but the main difference is how they map additional ROM to the relatively small address space available for cartridges in the VCS. This is called bank-switching. All of these differences are handled transparently by the package.

Currently supported cartridge types are listed below. The strings in quotation marks are the identifiers that should be used to specify a particular format in the Format field of cartridgeloader.Loader:

Atari 2k "2k" Atari 4k "4k" Atari 8k "F8" Atari 16k "F6" Atari 32k "F4" CBS case "FA" M-Network "E7" Parker Bros "E0" Tigervision "3F"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cartridge

type Cartridge struct {
	bus.DebuggerBus
	bus.CPUBus

	Filename string
	Hash     string
	// contains filtered or unexported fields
}

Cartridge defines the information and operations for a VCS cartridge

func NewCartridge

func NewCartridge() *Cartridge

NewCartridge is the preferred method of initialisation for the cartridge type

func (*Cartridge) Attach

func (cart *Cartridge) Attach(cartload cartridgeloader.Loader) error

Attach the cartridge loader to the VCS and make available the data to the CPU bus

func (*Cartridge) Eject

func (cart *Cartridge) Eject()

Eject removes memory from cartridge space and unlike the real hardware, attaches a bank of empty memory - for convenience of the debugger

func (Cartridge) Format

func (cart Cartridge) Format() string

Format returns the cartridge format ID

func (Cartridge) GetBank

func (cart Cartridge) GetBank(addr uint16) int

GetBank returns the current bank number for the specified address

WARNING: For some cartridge types this is the same as asking for the current address

Address must be a normlised cartridge address.

func (Cartridge) GetRAMinfo

func (cart Cartridge) GetRAMinfo() []RAMinfo

GetRAMinfo returns an instance of RAMinfo or nil if catridge contains no RAM

func (*Cartridge) Initialise

func (cart *Cartridge) Initialise()

Initialise the cartridge

func (*Cartridge) IsEjected

func (cart *Cartridge) IsEjected() bool

IsEjected returns true if no cartridge is attached

func (Cartridge) Listen

func (cart Cartridge) Listen(addr uint16, data uint8)

Listen for data at the specified address. Very wierd requirement of the tigervision cartridge format. If there was a better way of implementing the tigervision format, there'd be no need for this function. Address must be normalised.

func (Cartridge) NumBanks

func (cart Cartridge) NumBanks() int

NumBanks returns the number of banks in the catridge

func (*Cartridge) Patch

func (cart *Cartridge) Patch(offset uint16, data uint8) error

Patch writes to cartridge memory. Offset is measured from the start of cartridge memory. It differs from Poke in that respect

func (*Cartridge) Peek

func (cart *Cartridge) Peek(addr uint16) (uint8, error)

Peek is an implementation of memory.DebuggerBus. Address must be normalised.

func (*Cartridge) Poke

func (cart *Cartridge) Poke(addr uint16, data uint8) error

Poke is an implementation of memory.DebuggerBus. This poke pokes the current cartridge bank. See Patch for a different method. Address must be normalised.

func (*Cartridge) Read

func (cart *Cartridge) Read(addr uint16) (uint8, error)

Read is an implementation of memory.CPUBus. Address must be normalised.

func (*Cartridge) RestoreState

func (cart *Cartridge) RestoreState(state interface{}) error

RestoreState retuns the state of the cartridge to a previously known state

func (*Cartridge) SaveState

func (cart *Cartridge) SaveState() interface{}

SaveState notes and returns the current state of the cartridge (RAM contents, selected bank)

func (*Cartridge) SetBank

func (cart *Cartridge) SetBank(addr uint16, bank int) error

SetBank maps the specified address such that it references the specified bank. For many cart mappers this just means switching banks for the entire cartridge. Address must be normalised.

NOTE: For some cartridge types, the specific address is not important

func (Cartridge) String

func (cart Cartridge) String() string

func (Cartridge) Summary

func (cart Cartridge) Summary() string

Summary returns brief information about the cartridge. Two lines: first line is the path to the cartridge and the second line is information about the mapper, including bank information

func (*Cartridge) Write

func (cart *Cartridge) Write(addr uint16, data uint8) error

Write is an implementation of memory.CPUBus. Address must be normalised.

type RAMinfo

type RAMinfo struct {
	Label       string
	Active      bool
	ReadOrigin  uint16
	ReadMemtop  uint16
	WriteOrigin uint16
	WriteMemtop uint16
}

RAMinfo details the read/write addresses for any cartridge ram

func (RAMinfo) ReadLen

func (ri RAMinfo) ReadLen() int

ReadLen returns the number of read addresses

func (RAMinfo) WriteLen

func (ri RAMinfo) WriteLen() int

WriteLen returns the number of write addresses

Jump to

Keyboard shortcuts

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