cpu

package
v0.0.0-...-936437e Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT. This file was generated by robots at 2019-07-14 02:40:37.021871109 -0300 -03 m=+0.024669117

Code generated by go generate; DO NOT EDIT. This file was generated by robots at 2019-07-14 02:40:37.004851388 -0300 -03 m=+0.007649378

Index

Constants

View Source
const (
	Clock           = 4194304
	ColorModeClock  = Clock * 2
	Period          = time.Second / Clock
	ColorModePeriod = time.Second / ColorModeClock
)

Timings

View Source
const (
	VRamBase       = 0x8000
	AddrIntVblank  = 0x40
	AddrIntLcdstat = 0x48
	AddrIntTimer   = 0x50
	AddrIntSerial  = 0x58
	AddrIntJoypad  = 0x60
)

Addresses

View Source
const (
	NR10 uint16 = 0xff10
	NR11        = 0xff11
	NR12        = 0xff12
	NR13        = 0xff13
	NR14        = 0xff14
	NR21        = 0xff16
	NR22        = 0xff17
	NR23        = 0xff18
	NR24        = 0xff19
	NR30        = 0xff1a
	NR31        = 0xff1b
	NR32        = 0xff1c
	NR33        = 0xff1d
	NR34        = 0xff1e
	NR41        = 0xff20
	NR42        = 0xff21
	NR43        = 0xff22
	NR44        = 0xff23
	NR50        = 0xff24
	NR51        = 0xff25
	NR52        = 0xff26
)

Variables

View Source
var AllRegisters = []string{
	"A", "B", "C", "D", "E", "H", "L", "F",
}
View Source
var CBInstructions = []GBInstruction{}/* 256 elements not displayed */
View Source
var GBInstructions = []GBInstruction{}/* 256 elements not displayed */

Functions

This section is empty.

Types

type Catridge

type Catridge interface {
	LoadRom([]byte)
	RomName() string
	CatridgeRamSize() gameboy.RamSize
	RomSize() gameboy.RomSize
	MBCType() gameboy.MBCType
	GBC() bool

	// Memory Interface
	Write(addr uint16, val uint8)
	Read(addr uint16) uint8

	// Tools
	Reset()
	Randomize()
	DumpRam() []byte
	LoadRam([]byte)
}

type Core

type Core struct {
	Registers *Registers
	Memory    *Memory
	GPU       *GPU
	Timer     *Timer
	Keys      *GBKeys
	SoundCard *SoundCard
	Serial    *Serial
	// contains filtered or unexported fields
}

func MakeCore

func MakeCore() *Core

func (*Core) Continue

func (c *Core) Continue()

func (*Core) GetCurrentPage

func (c *Core) GetCurrentPage() (uint16, []byte)

func (*Core) GetDebugData

func (c *Core) GetDebugData() DebugData

func (*Core) GetStack

func (c *Core) GetStack() (uint16, []byte)

func (*Core) IsPaused

func (c *Core) IsPaused() bool

func (*Core) Pause

func (c *Core) Pause()

func (*Core) Reset

func (c *Core) Reset()

func (*Core) SetSpeedHack

func (c *Core) SetSpeedHack(mul float64)

func (*Core) Start

func (c *Core) Start()

func (*Core) Step

func (c *Core) Step()

func (*Core) Stop

func (c *Core) Stop()

type DebugData

type DebugData struct {
	PC, SP, A, B, C, D, E, F, H, L, HL       string
	AB, BB, CB, DB, EB, FB, LB, HB           string
	BC, DE, EI, EIB, IF, IFB                 string
	PCX, SPX                                 string
	IME                                      string
	GPUSCROLLX, GPUSCROLLY, GPUWINX, GPUWINY string
	GPUMODECLOCKS, GPULINE                   string
	HALTED                                   string
	RamBank                                  string
}

type DisasmInstruction

type DisasmInstruction struct {
	Address     int
	Opcode      uint8
	Instruction string
	Argument    []byte
	Cycles      []int
	ZSHC        string
	// contains filtered or unexported fields
}

func Disasm

func Disasm(offset int, data []byte) []DisasmInstruction

func (DisasmInstruction) String

func (d DisasmInstruction) String() string

type GBInstruction

type GBInstruction func(*Core)

type GBKeys

type GBKeys struct {
	// contains filtered or unexported fields
}

func MakeGBKeys

func MakeGBKeys(cpu *Core) *GBKeys

func (*GBKeys) Read

func (k *GBKeys) Read(addr uint16) uint8

func (*GBKeys) SetDirectionBit

func (k *GBKeys) SetDirectionBit(bit int, val bool)

func (*GBKeys) SetKeysBit

func (k *GBKeys) SetKeysBit(bit int, val bool)

func (*GBKeys) Update

func (k *GBKeys) Update(win *pixelgl.Window)

func (*GBKeys) Write

func (k *GBKeys) Write(addr uint16, val uint8)

type GPU

type GPU struct {
	// contains filtered or unexported fields
}

func MakeGPU

func MakeGPU(cpu *Core) *GPU

func (*GPU) CGBMode

func (g *GPU) CGBMode() bool

func (*GPU) Cycle

func (g *GPU) Cycle(clocks int)

func (*GPU) GetBGRam

func (g *GPU) GetBGRam() *pixel.PictureData

func (*GPU) GetLCDBuffer

func (g *GPU) GetLCDBuffer() *pixel.PictureData

func (*GPU) GetTileBuffer

func (g *GPU) GetTileBuffer() *pixel.PictureData

func (*GPU) GetWinRam

func (g *GPU) GetWinRam() *pixel.PictureData

func (*GPU) HBlankMode

func (g *GPU) HBlankMode() bool

func (*GPU) LycLy

func (g *GPU) LycLy() bool

func (*GPU) OamMode

func (g *GPU) OamMode() bool

func (*GPU) Read

func (g *GPU) Read(addr uint16) byte

func (*GPU) Reset

func (g *GPU) Reset()

func (*GPU) SetCGBMode

func (g *GPU) SetCGBMode(c bool)

func (*GPU) SetHighlightBG

func (g *GPU) SetHighlightBG(highLightBG bool)

func (*GPU) SetHighlightTile

func (g *GPU) SetHighlightTile(x, y float64)

func (*GPU) UpdateOAM

func (g *GPU) UpdateOAM(addr uint16, val uint8)

func (*GPU) UpdateVRAM

func (g *GPU) UpdateVRAM()

func (*GPU) VBlankMode

func (g *GPU) VBlankMode() bool

func (*GPU) Write

func (g *GPU) Write(addr uint16, val uint8)

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

func MakeMemory

func MakeMemory(cpu *Core) *Memory

func (*Memory) CatridgeRamSize

func (m *Memory) CatridgeRamSize() gameboy.RamSize

func (*Memory) GetVideoFrame

func (m *Memory) GetVideoFrame() *pixel.PictureData

func (*Memory) GetVideoSprite

func (m *Memory) GetVideoSprite() *pixel.Sprite

func (*Memory) InDoubleSpeedMode

func (m *Memory) InDoubleSpeedMode() bool

func (*Memory) LoadCatridgeRAMData

func (m *Memory) LoadCatridgeRAMData()

func (*Memory) LoadRom

func (m *Memory) LoadRom(data []byte)

func (*Memory) MBCType

func (m *Memory) MBCType() gameboy.MBCType

func (*Memory) Randomize

func (m *Memory) Randomize()

func (*Memory) Read

func (m *Memory) Read(addr uint16) byte

func (*Memory) ReadByte

func (m *Memory) ReadByte(addr uint16) byte

func (*Memory) ReadByteForPC

func (m *Memory) ReadByteForPC(addr uint16) byte

func (*Memory) ReadBytes

func (m *Memory) ReadBytes(addr uint16, length int) []byte

func (*Memory) ReadWord

func (m *Memory) ReadWord(addr uint16) uint16

func (*Memory) ReadWordForPC

func (m *Memory) ReadWordForPC(addr uint16) uint16

func (*Memory) Reset

func (m *Memory) Reset()

func (*Memory) RomName

func (m *Memory) RomName() string

func (*Memory) RomSize

func (m *Memory) RomSize() gameboy.RomSize

func (*Memory) SaveCatridgeRAMData

func (m *Memory) SaveCatridgeRAMData()

func (*Memory) SetSaveFile

func (m *Memory) SetSaveFile(filename string)

func (*Memory) WriteByte

func (m *Memory) WriteByte(addr uint16, val byte)

func (*Memory) WriteWord

func (m *Memory) WriteWord(addr uint16, val uint16)

type MemoryInterface

type MemoryInterface interface {
	Write(addr uint16, val uint8)
	Read(addr uint16) uint8
}

type Registers

type Registers struct {
	// Exposed Registers
	A, B, C, D, E, H, L, F byte

	PC, SP uint16

	InterruptEnable        bool
	EnabledInterrupts      byte
	InterruptsFired        byte
	CycleCount             int
	LastClockM, LastClockT int
	// contains filtered or unexported fields
}

func MakeRegisters

func MakeRegisters() *Registers

func (*Registers) BC

func (r *Registers) BC() uint16

func (*Registers) Clone

func (r *Registers) Clone() Registers

func (*Registers) DE

func (r *Registers) DE() uint16

func (*Registers) GetCarry

func (r *Registers) GetCarry() bool

func (*Registers) GetHalfCarry

func (r *Registers) GetHalfCarry() bool

func (*Registers) GetRegister

func (r *Registers) GetRegister(reg string) byte

func (*Registers) GetSub

func (r *Registers) GetSub() bool

func (*Registers) GetZero

func (r *Registers) GetZero() bool

func (*Registers) HL

func (r *Registers) HL() uint16

region Register Helpers

func (*Registers) LoadRegisters

func (r *Registers) LoadRegisters()

func (*Registers) Randomize

func (r *Registers) Randomize()

func (*Registers) Reset

func (r *Registers) Reset()

func (*Registers) SaveRegisters

func (r *Registers) SaveRegisters()

func (*Registers) SetCarry

func (r *Registers) SetCarry(v bool)

func (*Registers) SetHalfCarry

func (r *Registers) SetHalfCarry(v bool)

func (*Registers) SetRegister

func (r *Registers) SetRegister(reg string, v byte)

func (*Registers) SetSub

func (r *Registers) SetSub(v bool)

func (*Registers) SetZero

func (r *Registers) SetZero(v bool)

type Serial

type Serial struct {
	// contains filtered or unexported fields
}

func MakeSerial

func MakeSerial(cpu *Core) *Serial

func (*Serial) Cycle

func (s *Serial) Cycle(clocks int)

func (*Serial) Read

func (s *Serial) Read(addr uint16) byte

func (*Serial) Write

func (s *Serial) Write(addr uint16, val uint8)

type SoundCard

type SoundCard struct {
	// contains filtered or unexported fields
}

func MakeSoundCard

func MakeSoundCard(cpu *Core) *SoundCard

func (*SoundCard) Cycle

func (s *SoundCard) Cycle(clocks int)

func (*SoundCard) Read

func (s *SoundCard) Read(addr uint16) byte

func (*SoundCard) Write

func (s *SoundCard) Write(addr uint16, val uint8)

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

func MakeTimer

func MakeTimer(cpu *Core) *Timer

func (*Timer) Cycle

func (t *Timer) Cycle()

func (*Timer) Increment

func (t *Timer) Increment(clockM int)

func (*Timer) Read

func (t *Timer) Read(addr uint16) uint8

func (*Timer) Reset

func (t *Timer) Reset()

func (*Timer) Write

func (t *Timer) Write(addr uint16, val uint8)

Directories

Path Synopsis
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.

Jump to

Keyboard shortcuts

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