mmu

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2013 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DMG_STATUS_REG            types.Word = 0xFF50
	CGB_INFRARED_PORT_REG     types.Word = 0xFF56
	CGB_WRAM_BANK_SELECT      types.Word = 0xFF70
	CGB_DOUBLE_SPEED_PREP_REG types.Word = 0xFF4D
	CGB_HDMA_SOURCE_HIGH_REG  types.Word = 0xFF51
	CGB_HDMA_SOURCE_LOW_REG   types.Word = 0xFF52
	CGB_HDMA_DEST_HIGH_REG    types.Word = 0xFF53
	CGB_HDMA_DEST_LOW_REG     types.Word = 0xFF54
	CGB_HDMA_REG              types.Word = 0xFF55
)
View Source
const PREFIX = "MMU"
View Source
const ZERO byte = 0

Variables

View Source
var ROMIsBiggerThanRegion error = errors.New("ROM is bigger than addressable region")

Functions

This section is empty.

Types

type GbcMMU

type GbcMMU struct {
	DMARegister byte

	RunningColorGBHardware bool
	// contains filtered or unexported fields
}

func NewGbcMMU

func NewGbcMMU() *GbcMMU

func (*GbcMMU) ConnectPeripheral

func (mmu *GbcMMU) ConnectPeripheral(p components.Peripheral, startAddr, endAddr types.Word)

func (*GbcMMU) ConnectPeripheralOn

func (mmu *GbcMMU) ConnectPeripheralOn(p components.Peripheral, addrs ...types.Word)

Helper method for connecting peripherals that don't look at contiguous chunks of memory

func (*GbcMMU) IsCartridgeColor

func (mmu *GbcMMU) IsCartridgeColor() bool

func (*GbcMMU) LoadBIOS

func (mmu *GbcMMU) LoadBIOS(data []byte) (bool, error)

Puts BIOS ROM into special area in MMU

func (*GbcMMU) LoadCartridge

func (mmu *GbcMMU) LoadCartridge(cart *cartridge.Cartridge)

func (*GbcMMU) LoadCartridgeRam

func (mmu *GbcMMU) LoadCartridgeRam(savesDir string)

func (*GbcMMU) PrintPeripheralMap

func (mmu *GbcMMU) PrintPeripheralMap()

func (*GbcMMU) ReadByte

func (mmu *GbcMMU) ReadByte(addr types.Word) byte

func (*GbcMMU) ReadByteFromRegister

func (mmu *GbcMMU) ReadByteFromRegister(addr types.Word) byte

This area deals with registers (some only applicable to CGB hardware)

func (*GbcMMU) ReadFromWorkingRAM

func (mmu *GbcMMU) ReadFromWorkingRAM(addr types.Word) byte

func (*GbcMMU) ReadWord

func (mmu *GbcMMU) ReadWord(addr types.Word) types.Word

func (*GbcMMU) RequestInterrupt

func (mmu *GbcMMU) RequestInterrupt(interrupt byte)

USE SHARED CONSTANTS FOR FLAGS AND STUFF TOO - for reuse in the CPU

func (*GbcMMU) Reset

func (mmu *GbcMMU) Reset()

func (*GbcMMU) SaveCartridgeRam

func (mmu *GbcMMU) SaveCartridgeRam(savesDir string)

func (*GbcMMU) SetInBootMode

func (mmu *GbcMMU) SetInBootMode(mode bool)

When the MMU is in boot mode, the area below 0x0100 is reserved for the BIOS

func (*GbcMMU) WriteByte

func (mmu *GbcMMU) WriteByte(addr types.Word, value byte)

func (*GbcMMU) WriteByteToRegister

func (mmu *GbcMMU) WriteByteToRegister(addr types.Word, value byte)

This area deals with registers (some only applicable to CGB hardware)

func (*GbcMMU) WriteToWorkingRAM

func (mmu *GbcMMU) WriteToWorkingRAM(addr types.Word, value byte)

func (*GbcMMU) WriteWord

func (mmu *GbcMMU) WriteWord(addr types.Word, value types.Word)

type HDMATransfer

type HDMATransfer struct {
	Source      types.Word
	Destination types.Word
	Length      int
	HblankMode  bool
	Running     bool
}

type MemoryMappedUnit

type MemoryMappedUnit interface {
	WriteByte(address types.Word, value byte)
	WriteWord(address types.Word, value types.Word)
	ReadByte(address types.Word) byte
	ReadWord(address types.Word) types.Word
	SetInBootMode(mode bool)
	LoadBIOS(data []byte) (bool, error)
	LoadCartridge(cart *cartridge.Cartridge)
	Reset()
}

Jump to

Keyboard shortcuts

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