memory

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package memory implements the Atari VCS memory model. The addresses and memory sub-packages help with this.

It is important to understand that memory is viewed differently by different parts of the VCS system. To help with this, the emulation uses what we call memory buses. These buses have nothing to do with the real hardware; they are purely conceptual and are implemented through Go interfaces.

The following ASCII diagram tries to show how the different components of the VCS are connected to the memory. What may not be clear from this diagram is that the peripheral bus only ever writes to memory. The other buses are bidirectional.

                    PERIPHERALS

                         |
                         |
                         \/

                     periph bus

                         |
                         |
                         \/

CPU ---- cpu bus ---- MEMORY ---- chip bus ---- TIA
                                            \
                         |                   \
                         |                    \---- RIOT

                    debugger bus

                         |
                         |

                      DEBUGGER

The memory itself is divided into areas, defined in the memorymap package. Removing the periph bus and debugger bus from the picture, the above diagram with memory areas added is as follows:

                       ===* TIA ---- chip bus ---- TIA
                      |
                      |===* RIOT ---- chip bus ---- RIOT
CPU ---- cpu bus -----
                      |===* PIA RAM
                      |
                       ==== Cartridge

The asterisk indicates that addresses used by the CPU are mapped to the primary mirror address. The memorymap package contains more detail on this.

Cartridge memory is accessed by whatever mirror address the CPU wants. This is because some cartridge formats might be sensitive to which mirror is being used (eg. Supercharger). Cartridges also implement a Listen() function. This is a special function outside of the bussing system. See cartridge package for details.

Note that the RIOT registers and PIA RAM are all part of the same hardware package, the PIA 6532. However, for our purposes the two memory areas are considered to be entirely separate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area added in v0.35.2

type Area interface {
	Read(address uint16) (uint8, uint8, error)
	Write(address uint16, data uint8) error
	Peek(address uint16) (uint8, error)
	Poke(address uint16, value uint8) error
}

Area defines the meta-operations for all memory areas

type Memory added in v0.7.1

type Memory struct {
	RIOT *vcs.RIOTMemory
	TIA  *vcs.TIAMemory
	RAM  *vcs.RAM
	Cart *cartridge.Cartridge

	// the following are only used by the debugging interface
	//
	//  . a note of the last literal memory address to be accessed
	//  . as above but the mapped address
	//  . the value that was written/read from the last address accessed
	//  . whether the last address accessed was written or read
	//
	// * the literal address is the address as it appears in the 6507 program.
	// and therefore it might be more than 13 bits wide. as such it is not
	// representative of what happens on the address bus
	//
	// it is sometimes useful to know what the literal address is, distinct
	// from the mapped address, for debugging purposes.
	LastCPUAddressLiteral uint16
	LastCPUAddressMapped  uint16
	LastCPUData           uint8
	LastCPUWrite          bool

	// the actual values that have been put on the address and data buses.
	AddressBus uint16
	DataBus    uint8

	// not all pins of the databus are driven at all times. bits set in
	// the DataBusDriven field indicate the pins that are being driven
	DataBusDriven uint8
	// contains filtered or unexported fields
}

Memory is the monolithic representation of the memory in 2600.

func NewMemory added in v0.7.1

func NewMemory(env *environment.Environment) *Memory

NewMemory is the preferred method of initialisation for Memory.

func (*Memory) GetArea added in v0.7.1

func (mem *Memory) GetArea(area memorymap.Area) Area

GetArea returns the actual memory of the specified area type.

func (*Memory) Peek added in v0.7.1

func (mem *Memory) Peek(address uint16) (uint8, error)

Peek implements the DebugBus interface.

func (*Memory) Plumb added in v0.8.0

func (mem *Memory) Plumb(env *environment.Environment, fromDifferentEmulation bool)

Plumb makes sure everything is ship-shape after a rewind event.

The fromDifferentEmulation indicates that the State has been created by a different VCS emulation than the one being plumbed into.

func (*Memory) Poke added in v0.7.1

func (mem *Memory) Poke(address uint16, data uint8) error

Poke implements the DebugBus interface.

func (*Memory) Read added in v0.7.1

func (mem *Memory) Read(address uint16) (uint8, error)

Readt is an implementation of CPUBus. Address will be normalised and processed by the correct memory areas.

func (*Memory) Reset added in v0.7.1

func (mem *Memory) Reset()

Reset contents of memory.

func (*Memory) Snapshot added in v0.7.1

func (mem *Memory) Snapshot() *Memory

Snapshot creates a copy of the current memory state.

func (*Memory) String added in v0.20.0

func (mem *Memory) String() string

func (*Memory) Write added in v0.7.1

func (mem *Memory) Write(address uint16, data uint8) error

Write is an implementation of CPUBus. Address will be normalised and processed by the correct memory areas.

Directories

Path Synopsis
Package cartridge fully implements loading of mapping of cartridge memory.
Package cartridge fully implements loading of mapping of cartridge memory.
ace
Package ace implements the ACE cartridge mapper.
Package ace implements the ACE cartridge mapper.
arm
Package arm imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference:
Package arm imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference:
arm/architecture
Package architecture defines the Map type that is used to specify the differences in cartridge and ARM archtectures.
Package architecture defines the Map type that is used to specify the differences in cartridge and ARM archtectures.
arm/callfn
Package Callfn facilitates the ARM CALLFN process common to both DPC+ and CDF* cartridge mappers.
Package Callfn facilitates the ARM CALLFN process common to both DPC+ and CDF* cartridge mappers.
arm/peripherals
Package peripherals implements the optional modules that can make up the ARM processor.
Package peripherals implements the optional modules that can make up the ARM processor.
cdf
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
dpcplus
Package dpcplus implements the DPC+ cartridge mapper.
Package dpcplus implements the DPC+ cartridge mapper.
elf
Package ace implements the ELF cartridge mapper.
Package ace implements the ELF cartridge mapper.
mapper
Package mapper contains the CartMapper interface.
Package mapper contains the CartMapper interface.
moviecart
Package moviecart implements the Movie Cart special cartridge type.
Package moviecart implements the Movie Cart special cartridge type.
plusrom
Package plusrom implements the PlusROM cartridge as developed by Wolfgang Stubig.
Package plusrom implements the PlusROM cartridge as developed by Wolfgang Stubig.
plusrom/plusnet
Package plusnet contains details of the PlusNET protocol.
Package plusnet contains details of the PlusNET protocol.
supercharger
Package supercharger implements the tape based cartridge format.
Package supercharger implements the tape based cartridge format.
Package chipbus defines the operations, addresses and symbols that are required by the TIA and RIOT chips when accessing memory.
Package chipbus defines the operations, addresses and symbols that are required by the TIA and RIOT chips when accessing memory.
Package cpubus defines the addresses and symbols that are required by the CPU when accessing memory from the CPU.
Package cpubus defines the addresses and symbols that are required by the CPU when accessing memory from the CPU.
Package memorymap facilitates the translation of addresses to primary address equivalents.
Package memorymap facilitates the translation of addresses to primary address equivalents.
Package vcs represents the areas of memory that are internal to the VCS hardware.
Package vcs represents the areas of memory that are internal to the VCS hardware.

Jump to

Keyboard shortcuts

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