memory

package
v0.0.0-...-fa24f98 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus [256][]Handler

func (*Bus) ClearMapping

func (b *Bus) ClearMapping(offset, length uint16)

func (*Bus) Length

func (b *Bus) Length() uint16

func (*Bus) MapHandler

func (b *Bus) MapHandler(offset uint16, length uint16, h Handler)

func (Bus) MemRead

func (b Bus) MemRead(offset uint16) byte

func (Bus) MemWrite

func (b Bus) MemWrite(offset uint16, val byte) byte

func (Bus) Ptr

func (b Bus) Ptr() uintptr

func (Bus) String

func (b Bus) String() string

type Handler

type Handler interface {
	MemRead(offset uint16) byte
	MemWrite(offset uint16, val byte) byte
	Length() uint16
	Ptr() uintptr
}

func Slice

func Slice(h Handler, start, end int) Handler

Slice can slice a RAM or ROM device

type Master

type Master interface {
	Handler
	MapHandler(offset uint16, length uint16, h Handler)
	ClearMapping(offset, length uint16)
}

func NewBus

func NewBus() Master

type Null

type Null struct{}

func (Null) Length

func (n Null) Length() uint16

func (Null) MemRead

func (n Null) MemRead(offset uint16) byte

func (Null) MemWrite

func (n Null) MemWrite(offset uint16, v byte) byte

func (Null) Ptr

func (n Null) Ptr() uintptr

func (Null) String

func (n Null) String() string

type RAM

type RAM []byte

func NewRAM

func NewRAM(siz int) RAM

func (RAM) Length

func (r RAM) Length() uint16

func (RAM) MemRead

func (r RAM) MemRead(offset uint16) byte

func (RAM) MemWrite

func (r RAM) MemWrite(offset uint16, val byte) byte

func (RAM) Ptr

func (r RAM) Ptr() uintptr

func (RAM) Resize

func (r RAM) Resize(newsize int) RAM

Resize will return a copy of RAM with the specified size. If RAM is large enough to accomodate the new size (less or equal to capacity), then the exact same memory buffer will be returned. If however it is required to grow the memory buffer, a new buffer will be allocated, and data will be copied

Reducing the size of a memory will not free memory, and re-growing it will cause data that was written there to be still there.

func (RAM) String

func (r RAM) String() string

type ROM

type ROM []byte

func (ROM) Length

func (r ROM) Length() uint16

func (ROM) MemRead

func (r ROM) MemRead(offset uint16) byte

func (ROM) MemWrite

func (r ROM) MemWrite(offset uint16, val byte) byte

func (ROM) Ptr

func (r ROM) Ptr() uintptr

func (ROM) String

func (r ROM) String() string

Jump to

Keyboard shortcuts

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