memory

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: GPL-3.0, GPL-3.0 Imports: 8 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 Memory added in v0.7.1

type Memory struct {
	bus.DebugBus
	bus.CPUBus

	// the four memory areas
	RIOT *vcs.ChipMemory
	TIA  *vcs.ChipMemory
	RAM  *vcs.RAM
	Cart *cartridge.Cartridge

	// the following are only used by the debugging interface. it would be
	// lovely to remove these for non-debugging emulation but there's not much
	// impact on performance so they can stay for now:
	//
	//  . a note of the last (unmapped) 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 ID of the last memory access (currently a timestamp)
	LastAccessAddress       uint16
	LastAccessAddressMapped uint16
	LastAccessValue         uint8
	LastAccessWrite         bool
	LastAccessID            int
	// contains filtered or unexported fields
}

Memory is the monolithic representation of the memory in 2600.

func NewMemory added in v0.7.1

func NewMemory(prefs *preferences.Preferences) *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) bus.DebugBus

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

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

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)

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

func (*Memory) ReadZeroPage added in v0.7.1

func (mem *Memory) ReadZeroPage(address uint8) (uint8, error)

ReadZeroPage 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) 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 addresses contains all information about VCS addresses and registers, including canonical symbols for read and write addresses and registers.
Package addresses contains all information about VCS addresses and registers, including canonical symbols for read and write addresses and registers.
Package bus defines the memory bus concept.
Package bus defines the memory bus concept.
Package cartridge fully implements loading of mapping of cartridge memory.
Package cartridge fully implements loading of mapping of cartridge memory.
harmony
Package harmony implements the Harmony cartridge.
Package harmony implements the Harmony cartridge.
harmony/arm7tdmi
Package arm7tdmi imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference: http://www.ecs.csun.edu/~smirzaei/docs/ece425/arm7tdmi_instruction_set_reference.pdf For this project we only need to emulte the Thumb architecture.
Package arm7tdmi imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference: http://www.ecs.csun.edu/~smirzaei/docs/ece425/arm7tdmi_instruction_set_reference.pdf For this project we only need to emulte the Thumb architecture.
harmony/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.
harmony/cdf
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
Package cdf implemnents the various CDF type cartridge mappers including CDFJ.
harmony/dpcplus
Package dpcplus implements the DPC+ cartridge mapper.
Package dpcplus implements the DPC+ 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.
supercharger
Package supercharger implements the tape based cartridge format.
Package supercharger implements the tape based cartridge format.
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