gb

package
v0.0.0-...-1fe299f Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const KB, MB = 1024, 1024 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type DumpCmd

type DumpCmd = uint8
const (
	DUMP_SAVE DumpCmd = iota
)

type GB

type GB struct {
	Model Model // ハードウェアの種類
	CPU   *cpu.CPU
	PPU   *ppu.PPU
	APU   *apu.APU
	Cart  *cartridge.Cartridge

	debugger.Debugger
	// contains filtered or unexported fields
}

func New

func New(model Model, audioBuffer io.Writer) *GB

func (*GB) AttachDebugger

func (g *GB) AttachDebugger(d debugger.Debugger)

func (*GB) CreateSnapshot

func (g *GB) CreateSnapshot() Snapshot

func (*GB) Deserialize

func (g *GB) Deserialize(state io.Reader) bool

func (*GB) DirectBoot

func (g *GB) DirectBoot()

func (*GB) Dump

func (g *GB) Dump(cmd DumpCmd, args ...any) ([]uint8, error)

func (*GB) GetChunk

func (g *GB) GetChunk(chunkID uint64) []uint8

func (*GB) GetValue

func (g *GB) GetValue(which uint64) uint64

GetValue returns the value of the specified state.

func (*GB) HandleGDB

func (g *GB) HandleGDB(data string) string

data は $[data]#[checksum] の data部分

func (*GB) IsColor

func (g *GB) IsColor() bool

IsCGBMode returns true if the hardware has CGB features (i.e., it's a CGB or AGB).

func (*GB) Load

func (g *GB) Load(cmd LoadCmd, args ...any) error

func (*GB) LoadROM

func (g *GB) LoadROM(rom []uint8) error

func (*GB) LoadSave

func (g *GB) LoadSave(savedata []uint8) error

func (*GB) PokeMemory

func (g *GB) PokeMemory(memID int, addr uint32, width int, data uint32) bool

func (*GB) Quit

func (g *GB) Quit()

func (*GB) Read

func (g *GB) Read(addr uint16) uint8

func (*GB) Reset

func (g *GB) Reset()

func (*GB) Resolution

func (g *GB) Resolution() (w int, h int)

func (*GB) RestoreSnapshot

func (g *GB) RestoreSnapshot(snap Snapshot) bool

func (*GB) RunFrame

func (g *GB) RunFrame()

func (*GB) Screen

func (g *GB) Screen() []color.NRGBA

func (*GB) Serialize

func (g *GB) Serialize(state io.Writer) bool

func (*GB) SetKeyInput

func (g *GB) SetKeyInput(key string, press bool)

func (*GB) ViewMemory

func (g *GB) ViewMemory(_ int, addr uint32, width int) uint32

func (*GB) Write

func (g *GB) Write(addr uint16, val uint8)
type Header struct {
	Magic    [4]uint8  // "DAWN"
	Version  uint64    // 今は0
	Reserved [64]uint8 // 拡張用
}

type LoadCmd

type LoadCmd = uint8
const (
	LOAD_ROM LoadCmd = iota
	LOAD_SAVE
	LOAD_BIOS
)

type Model

type Model uint8
const (
	MODEL_DMG Model = iota
	MODEL_SGB
	MODEL_CGB
	MODEL_AGB
)

ハードウェアの種類

type Snapshot

type Snapshot struct {
	Header
	Model    uint8
	CPU      cpu.Snapshot
	PPU      ppu.Snapshot
	APU      apu.Snapshot
	Cart     cartridge.Snapshot
	WRAM     [4 * KB * 8]uint8
	WRAMBank uint8
	Reserved [2 * KB]uint8 // 拡張用
}

Directories

Path Synopsis
apu
psg
cpu
ppu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳