Documentation ¶
Overview ¶
Package memory defines memory components
Index ¶
- Constants
- type Bank
- type BankMap
- type DefaultMapper
- type Mapper
- type MaskMapper
- type Memory
- func (memory *Memory) Bank(index int) *Bank
- func (memory *Memory) Banks() []*BankMap
- func (memory *Memory) Init()
- func (memory *Memory) LoadRAM(address uint16, data []byte)
- func (memory *Memory) Map(index int) *BankMap
- func (memory *Memory) Mapper() Mapper
- func (memory *Memory) Read(address uint16) byte
- func (memory *Memory) Reset()
- func (memory *Memory) SetMap(index int, bank *BankMap)
- func (memory *Memory) SetMapper(mapper Mapper)
- func (memory *Memory) Switch(current, new int)
- func (memory *Memory) Write(address uint16, data byte)
Constants ¶
const ( Size00K = 0x0000 Size128B = 0x0080 Size256B = 0x0100 Size512B = 0x0200 Size1K = 0x0400 Size2K = 0x0800 Size4K = 0x1000 Size8K = 0x2000 Size16K = 0x4000 Size32K = 0x8000 Size48K = 0xC000 Size64K = 0x10000 )
Common memory sizes
const (
DataDefault byte = 0
)
Defaults
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bank ¶
type Bank struct { OnAccess device.EventBus OnPostAccess device.EventBus // contains filtered or unexported fields }
Bank is a memory bank of bytes
type BankMap ¶
type BankMap struct {
// contains filtered or unexported fields
}
BankMap contains a bank bus and mapping information
func NewBankMap ¶
NewBankMap creates a memory bank map
type DefaultMapper ¶
type DefaultMapper struct {
// contains filtered or unexported fields
}
DefaultMapper is a simple but inefficient memory mapper
func (*DefaultMapper) Init ¶
func (mapper *DefaultMapper) Init(memory *Memory)
Init inits the mapper
func (*DefaultMapper) SelectBank ¶
func (mapper *DefaultMapper) SelectBank(address uint16) (*BankMap, uint16)
SelectBank selects the first active bank mapped at address
func (*DefaultMapper) SelectBankWrite ¶
func (mapper *DefaultMapper) SelectBankWrite(address uint16) (*BankMap, uint16)
SelectBankWrite selects the first active bank mapped at address for write
type Mapper ¶
type Mapper interface { // Init inits the mapper Init(memory *Memory) // SelectBank for Read access SelectBank(address uint16) (*BankMap, uint16) // SelectBank for Write access SelectBankWrite(address uint16) (*BankMap, uint16) }
Mapper memory bank mapper interface
type MaskMapper ¶
MaskMapper is a efficient memory mapper based on address bits (shift and mask)
func (*MaskMapper) SelectBank ¶
func (mapper *MaskMapper) SelectBank(address uint16) (*BankMap, uint16)
SelectBank selects read bank mapped at address
func (*MaskMapper) SelectBankWrite ¶
func (mapper *MaskMapper) SelectBankWrite(address uint16) (*BankMap, uint16)
SelectBankWrite selects write bank mapped at address
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is a memory structure of banks or bus devices