Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBit(value byte, bit int) bool
- func ClearBit(value byte, bit int) byte
- func SetBit(value byte, bit int) byte
- type APU
- type APURingBuffer
- type APUWave
- type APUWaveType
- type CPU
- func (c *CPU) CheckFlag(flag byte) bool
- func (c *CPU) ClearAllFlags()
- func (c *CPU) ClearFlag(flag byte)
- func (c *CPU) FlipFlag(flag byte)
- func (c *CPU) Halted() bool
- func (c *CPU) InterruptIsAboutToRaise() bool
- func (c *CPU) InterruptPending() CPUInterrupt
- func (c *CPU) KeepCarryFlag()
- func (c *CPU) KeepZeroFlag()
- func (c *CPU) MemoryLoad(addr uint16, value byte)
- func (c *CPU) MemoryRead(addr uint16) byte
- func (c *CPU) MemoryRetrieve(addr uint16) byte
- func (c *CPU) MemoryWrite(addr uint16, value byte)
- func (c *CPU) RequestInterrupt(interrupt CPUInterrupt)
- func (c *CPU) Reset()
- func (c *CPU) ResetDIVCycles()
- func (c *CPU) ResetTIMACycles()
- func (c *CPU) ServeInterrupt(interrupt CPUInterrupt)
- func (c *CPU) SetFlag(flag byte)
- func (c *CPU) SetZeroFlag(result byte)
- func (c *CPU) Step(count byte) byte
- func (c *CPU) UpdateSerial(clockCycles byte)
- func (c *CPU) UpdateTimers(clockCycles byte)
- type CPUInterrupt
- type CPUOpCodeEntity
- type CPURegister
- func (cr *CPURegister) Decrement()
- func (cr *CPURegister) Get() uint16
- func (cr *CPURegister) GetHigh() byte
- func (cr *CPURegister) GetHighPointer() *byte
- func (cr *CPURegister) GetLow() byte
- func (cr *CPURegister) GetLowPointer() *byte
- func (cr *CPURegister) Increment()
- func (cr *CPURegister) Set(value uint16)
- func (cr *CPURegister) SetHigh(value byte)
- func (cr *CPURegister) SetLow(value byte)
- type Cartridge
- type CartridgeType
- type Console
- func (console *Console) GetLCDColor(index int) color.RGBA
- func (console *Console) LoadFromBuffer(data []byte)
- func (console *Console) RunToVBlank()
- func (console *Console) SetButtonState(button int, pressed bool)
- func (console *Console) SetPixels(pixels []byte)
- func (console *Console) SetSoundBuffer(buffer []byte)
- type Controller
- type EnvelopeDirection
- type GameBoyColorPixelFormat
- type GameBoyKeys
- type Memory
- func (m *Memory) CommonPerformRead(addr uint16) byte
- func (m *Memory) CommonPerformWrite(addr uint16, value byte)
- func (m *Memory) IORegistersPerformRead(addr uint16) byte
- func (m *Memory) IORegistersPerformWrite(addr uint16, value byte)
- func (m *Memory) Load(addr uint16, value byte)
- func (m *Memory) PerformDMA(value byte)
- func (m *Memory) Read(addr uint16) byte
- func (m *Memory) Reset()
- func (m *Memory) Retrieve(addr uint16) byte
- func (m *Memory) SetMemoryBankController()
- func (m *Memory) Write(addr uint16, value byte)
- type MemoryBankController
- func NewMemoryBankControllerMBC1(console *Console) MemoryBankController
- func NewMemoryBankControllerMBC2(console *Console) MemoryBankController
- func NewMemoryBankControllerMBC3(console *Console) MemoryBankController
- func NewMemoryBankControllerMBC5(console *Console) MemoryBankController
- func NewMemoryBankControllerNoMBC(console *Console) MemoryBankController
- type MemoryBankControllerMBC1
- type MemoryBankControllerMBC2
- type MemoryBankControllerMBC3
- type MemoryBankControllerMBC5
- type MemoryBankControllerNoMBC
- type PPU
- func (p *PPU) CompareLYToLYC()
- func (p *PPU) DisableScreen()
- func (p *PPU) EnableScreen()
- func (p *PPU) GetCurrentStatusMode() int
- func (p *PPU) GetIRQ48Signal() byte
- func (p *PPU) RenderBG(line int, pixel int)
- func (p *PPU) RenderSprites(line int)
- func (p *PPU) RenderWindow(line int)
- func (p *PPU) Reset()
- func (p *PPU) ResetWindowLine()
- func (p *PPU) ScanLine(line int)
- func (p *PPU) SetIRQ48Signal(signal byte)
- func (p *PPU) Step(clockCycles *byte) bool
- func (p *PPU) UpdateStatRegister()
- type RTCRegisters
- type SweepDirection
Constants ¶
View Source
const ( // must be power of two SAMPLES_PER_SECONDS = 44100 CLOCKS_PER_SECONDS = 4194304 CLOCKS_PER_SAMPLE = CLOCKS_PER_SECONDS / SAMPLES_PER_SECONDS )
View Source
const ( APU_WAVE_FORM_SQUARE APUWaveType = 0 APU_WAVE_FORM_WAVE = 1 APU_WAVE_FORM_NOISE = 2 )
View Source
const ( CARTRIDGE_NO_MBC CartridgeType = 0 CARTRIDGE_MBC1 = 1 CARTRIDGE_MBC2 = 2 CARTRIDGE_MBC3 = 3 CARTRIDGE_MBC5 = 4 CARTRIDGE_MBC1_MULTI = 5 CARTRIDGE_NOT_SUPPORTED = 6 )
View Source
const ( KEY_A GameBoyKeys = 4 KEY_B = 5 KEY_START = 7 KEY_SELECT = 6 KEY_RIGHT = 0 KEY_LEFT = 1 KEY_UP = 2 KEY_DOWN = 3 )
View Source
const ( CPUFLAG_NONE = 0x00 CPUFLAG_CARRY = 0x10 CPUFLAG_HALF = 0x20 CPUFLAG_SUB = 0x40 CPUFLAG_ZERO = 0x80 )
View Source
const ( INTERRUPT_NONE CPUInterrupt = 0x00 INTERRUPT_VBLANK = 0x01 INTERRUPT_LCDSTAT = 0x02 INTERRUPT_TIMER = 0x04 INTERRUPT_SERIAL = 0x08 INTERRUPT_JOYPAD = 0x10 )
View Source
const ( GBC_PIXEL_RGB565 GameBoyColorPixelFormat = 0 GBC_PIXEL_RGB555 = 1 GBC_PIXEL_BGR565 = 2 GBC_PIXEL_BGR555 = 3 )
View Source
const APU_RING_BUFFER_SIZE int = 16 * 512 * 4
View Source
const GAMEBOY_HEIGHT = 144
View Source
const GAMEBOY_WIDTH = 160
View Source
const MBC1RAMBanksSize = 0x8000
View Source
const MBC2RAMBanksSize = 0x8000
View Source
const MBC3RAMBanksSize = 0x8000
View Source
const MBC5RAMBanksSize = 0x20000
Variables ¶
View Source
var InitialValuesForFFXX = [256]byte{}/* 256 elements not displayed */
From Gambatte emulator
View Source
var OPCodeAccurate = [256]byte{}/* 256 elements not displayed */
View Source
var OPCodeBranchMachineCycles = [256]byte{}/* 256 elements not displayed */
View Source
var OPCodeCBAccurate = [256]byte{}/* 256 elements not displayed */
View Source
var OPCodeCBMachineCycles = [256]byte{}/* 256 elements not displayed */
View Source
var OPCodeMachineCycles = [256]byte{}/* 256 elements not displayed */
Functions ¶
Types ¶
type APU ¶
type APU struct {
// contains filtered or unexported fields
}
func (*APU) ReadSoundBuffer ¶
type APURingBuffer ¶
type APURingBuffer struct {
// contains filtered or unexported fields
}
func NewAPURingBuffer ¶
func NewAPURingBuffer() *APURingBuffer
func (*APURingBuffer) Read ¶
func (a *APURingBuffer) Read(preSizedBuf []byte) []byte
func (*APURingBuffer) Write ¶
func (a *APURingBuffer) Write(bytes []byte) (writeCount int)
type APUWaveType ¶
type APUWaveType int
type CPU ¶
type CPU struct { AF *CPURegister BC *CPURegister DE *CPURegister HL *CPURegister PC *CPURegister SP *CPURegister OpCodeTable [256]CPUOpCodeEntity OpCodeCBTable [256]CPUOpCodeEntity IME bool Halt bool BranchTaken bool SkipPCBug bool CurrentClockCycles uint64 DIVCycles uint32 TIMACycles uint32 SerialBit int SerialCycles int IMECycles int UnhaltCycles int InterruptDelayCycles int AccurateOpeCodeState int SpeedMultiplier int ReadCache byte // contains filtered or unexported fields }
func (*CPU) ClearAllFlags ¶
func (c *CPU) ClearAllFlags()
func (*CPU) InterruptIsAboutToRaise ¶
func (*CPU) InterruptPending ¶
func (c *CPU) InterruptPending() CPUInterrupt
func (*CPU) MemoryLoad ¶
func (*CPU) MemoryRead ¶
func (*CPU) MemoryRetrieve ¶
func (*CPU) MemoryWrite ¶
func (*CPU) RequestInterrupt ¶
func (c *CPU) RequestInterrupt(interrupt CPUInterrupt)
func (*CPU) ResetDIVCycles ¶
func (c *CPU) ResetDIVCycles()
func (*CPU) ResetTIMACycles ¶
func (c *CPU) ResetTIMACycles()
func (*CPU) ServeInterrupt ¶
func (c *CPU) ServeInterrupt(interrupt CPUInterrupt)
func (*CPU) SetZeroFlag ¶
func (*CPU) UpdateSerial ¶
func (*CPU) UpdateTimers ¶
type CPUInterrupt ¶
type CPUInterrupt int
type CPUOpCodeEntity ¶
type CPUOpCodeEntity struct {
// contains filtered or unexported fields
}
type CPURegister ¶
type CPURegister struct {
// contains filtered or unexported fields
}
func NewCPURegister ¶
func NewCPURegister() *CPURegister
func (*CPURegister) Decrement ¶
func (cr *CPURegister) Decrement()
func (*CPURegister) Get ¶
func (cr *CPURegister) Get() uint16
func (*CPURegister) GetHigh ¶
func (cr *CPURegister) GetHigh() byte
func (*CPURegister) GetHighPointer ¶
func (cr *CPURegister) GetHighPointer() *byte
func (*CPURegister) GetLow ¶
func (cr *CPURegister) GetLow() byte
func (*CPURegister) GetLowPointer ¶
func (cr *CPURegister) GetLowPointer() *byte
func (*CPURegister) Increment ¶
func (cr *CPURegister) Increment()
func (*CPURegister) Set ¶
func (cr *CPURegister) Set(value uint16)
func (*CPURegister) SetHigh ¶
func (cr *CPURegister) SetHigh(value byte)
func (*CPURegister) SetLow ¶
func (cr *CPURegister) SetLow(value byte)
type Cartridge ¶
type Cartridge struct { ROM []byte RTCPresent bool RumblePresent bool // contains filtered or unexported fields }
func NewCartridge ¶
func (*Cartridge) IsRTCPresent ¶ added in v1.2.0
func (*Cartridge) LoadFromBuffer ¶
func (*Cartridge) UpdateCurrentRTC ¶ added in v1.2.0
func (c *Cartridge) UpdateCurrentRTC()
type CartridgeType ¶
type CartridgeType int
type Console ¶
type Console struct { CPU *CPU Memory *Memory PPU *PPU APU *APU Cartridge *Cartridge Controller *Controller // contains filtered or unexported fields }
func NewConsole ¶
func NewConsole() *Console
func (*Console) LoadFromBuffer ¶
func (*Console) RunToVBlank ¶
func (console *Console) RunToVBlank()
func (*Console) SetButtonState ¶
func (*Console) SetSoundBuffer ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(console *Console) *Controller
func (*Controller) KeyPressed ¶
func (c *Controller) KeyPressed(key GameBoyKeys)
func (*Controller) KeyReleased ¶
func (c *Controller) KeyReleased(key GameBoyKeys)
func (*Controller) Read ¶
func (c *Controller) Read() byte
func (*Controller) Reset ¶
func (c *Controller) Reset()
func (*Controller) Step ¶
func (c *Controller) Step(clockCycles byte)
func (*Controller) Update ¶
func (c *Controller) Update()
func (*Controller) Write ¶
func (c *Controller) Write(value byte)
type EnvelopeDirection ¶
type EnvelopeDirection bool
const ( ENVELOPE_UP EnvelopeDirection = true ENVELOPE_DOWN = false )
type GameBoyColorPixelFormat ¶
type GameBoyColorPixelFormat int
type GameBoyKeys ¶
type GameBoyKeys int
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) CommonPerformRead ¶
func (*Memory) CommonPerformWrite ¶
func (*Memory) IORegistersPerformRead ¶
func (*Memory) IORegistersPerformWrite ¶
func (*Memory) PerformDMA ¶
func (*Memory) SetMemoryBankController ¶
func (m *Memory) SetMemoryBankController()
type MemoryBankController ¶
type MemoryBankController interface { PerformRead(addr uint16) byte PerformWrite(addr uint16, value byte) }
func NewMemoryBankControllerMBC1 ¶
func NewMemoryBankControllerMBC1(console *Console) MemoryBankController
func NewMemoryBankControllerMBC2 ¶
func NewMemoryBankControllerMBC2(console *Console) MemoryBankController
func NewMemoryBankControllerMBC3 ¶ added in v1.2.0
func NewMemoryBankControllerMBC3(console *Console) MemoryBankController
func NewMemoryBankControllerMBC5 ¶ added in v1.2.0
func NewMemoryBankControllerMBC5(console *Console) MemoryBankController
func NewMemoryBankControllerNoMBC ¶
func NewMemoryBankControllerNoMBC(console *Console) MemoryBankController
type MemoryBankControllerMBC1 ¶
type MemoryBankControllerMBC1 struct {
// contains filtered or unexported fields
}
func (*MemoryBankControllerMBC1) PerformRead ¶
func (m *MemoryBankControllerMBC1) PerformRead(addr uint16) byte
func (*MemoryBankControllerMBC1) PerformWrite ¶
func (m *MemoryBankControllerMBC1) PerformWrite(addr uint16, value byte)
type MemoryBankControllerMBC2 ¶
type MemoryBankControllerMBC2 struct {
// contains filtered or unexported fields
}
func (*MemoryBankControllerMBC2) PerformRead ¶
func (m *MemoryBankControllerMBC2) PerformRead(addr uint16) byte
func (*MemoryBankControllerMBC2) PerformWrite ¶
func (m *MemoryBankControllerMBC2) PerformWrite(addr uint16, value byte)
type MemoryBankControllerMBC3 ¶ added in v1.2.0
type MemoryBankControllerMBC3 struct {
// contains filtered or unexported fields
}
func (*MemoryBankControllerMBC3) PerformRead ¶ added in v1.2.0
func (m *MemoryBankControllerMBC3) PerformRead(addr uint16) byte
func (*MemoryBankControllerMBC3) PerformWrite ¶ added in v1.2.0
func (m *MemoryBankControllerMBC3) PerformWrite(addr uint16, value byte)
func (*MemoryBankControllerMBC3) UpdateRTC ¶ added in v1.2.0
func (m *MemoryBankControllerMBC3) UpdateRTC()
type MemoryBankControllerMBC5 ¶ added in v1.2.0
type MemoryBankControllerMBC5 struct {
// contains filtered or unexported fields
}
func (*MemoryBankControllerMBC5) PerformRead ¶ added in v1.2.0
func (m *MemoryBankControllerMBC5) PerformRead(addr uint16) byte
func (*MemoryBankControllerMBC5) PerformWrite ¶ added in v1.2.0
func (m *MemoryBankControllerMBC5) PerformWrite(addr uint16, value byte)
type MemoryBankControllerNoMBC ¶
type MemoryBankControllerNoMBC struct {
// contains filtered or unexported fields
}
func (*MemoryBankControllerNoMBC) PerformRead ¶
func (m *MemoryBankControllerNoMBC) PerformRead(addr uint16) byte
func (*MemoryBankControllerNoMBC) PerformWrite ¶
func (m *MemoryBankControllerNoMBC) PerformWrite(addr uint16, value byte)
type PPU ¶
type PPU struct { SpriteXCacheBuffer [GAMEBOY_WIDTH * GAMEBOY_HEIGHT]int ColorCacheBuffer [GAMEBOY_WIDTH * GAMEBOY_HEIGHT]byte FrameBuffer [GAMEBOY_WIDTH * GAMEBOY_HEIGHT]byte ColorFrameBuffer [GAMEBOY_WIDTH * GAMEBOY_HEIGHT]uint16 GameBoyColorSpritePalettes [8][4][2]uint16 GameBoyColorBackgroundPalettes [8][4][2]uint16 // contains filtered or unexported fields }
func (*PPU) CompareLYToLYC ¶
func (p *PPU) CompareLYToLYC()
func (*PPU) DisableScreen ¶
func (p *PPU) DisableScreen()
func (*PPU) EnableScreen ¶
func (p *PPU) EnableScreen()
func (*PPU) GetCurrentStatusMode ¶
func (*PPU) GetIRQ48Signal ¶
func (*PPU) RenderSprites ¶
func (*PPU) RenderWindow ¶
func (*PPU) ResetWindowLine ¶
func (p *PPU) ResetWindowLine()
func (*PPU) SetIRQ48Signal ¶
func (*PPU) UpdateStatRegister ¶
func (p *PPU) UpdateStatRegister()
type RTCRegisters ¶ added in v1.2.0
type RTCRegisters struct {
// contains filtered or unexported fields
}
type SweepDirection ¶
type SweepDirection bool
const ( SWEEP_UP SweepDirection = false SWEEP_DOWN = true )
Source Files ¶
- apu.go
- apu_ring_buffer.go
- apu_waves.go
- cartridge.go
- console.go
- controller.go
- cpu.go
- cpu_cb_opcodes.go
- cpu_instructions.go
- cpu_opcodes.go
- cpu_register.go
- memory.go
- memory_bank_controller_mbc1.go
- memory_bank_controller_mbc2.go
- memory_bank_controller_mbc3.go
- memory_bank_controller_mbc5.go
- memory_bank_controller_no_mbc.go
- ppu.go
Click to show internal directories.
Click to hide internal directories.