core

package
v0.0.0-...-51a18f4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HMax represents max H counter value
	HMax = 339
	// VBSNTSC represents VBlank start counter value in NTSC
	VBSNTSC = 224
	// VBSPAL represents VBlank start counter value in PAL
	VBSPAL = 239
	// VMaxNTSC represents max V counter value in NTSC
	VMaxNTSC = 261
	// VMaxPAL represents max V counter value in PAL
	VMaxPAL = 311
)
View Source
const HBLANKEND = 3
View Source
const HBLANKSTART = 1096
View Source
const HEIGHT = 250
View Source
const TILE_SIZE = 8
View Source
const WIDTH = 250

Variables

This section is empty.

Functions

func NewState

func NewState() *state

Types

type BreakpointData

type BreakpointData struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Data       uint8  `json:"data"`
	IsRegister bool
}

type CPU

type CPU struct {
	C   uint16 // Accumulator register
	DBR uint8  // Data bank register
	D   uint16 // The direct register
	K   uint8  // The program bank register
	PC  uint16 // The program counter

	S uint16 // The stack pointer register
	X uint16 // The X index register
	Y uint16 // The Y index register
	// contains filtered or unexported fields
}

CPU represents the cpu 65C816

func (*CPU) Export

func (cpu *CPU) Export() map[string]interface{}

func (*CPU) HandleIRQ

func (cpu *CPU) HandleIRQ()

func (*CPU) Init

func (cpu *CPU) Init()

Init inits the CPU

type Emulator

type Emulator struct {
	CPU    *CPU
	Memory *Memory
	PPU    *PPU

	BreakpointCh chan BreakpointData
	// contains filtered or unexported fields
}

Emulator gathers the components required for emulation (PPU, CPU, Memory)

func New

func New(renderer render.Renderer, debug bool) *Emulator

New creates a new Emulator (creating the underlying components)

func (*Emulator) IsPaused

func (e *Emulator) IsPaused() bool

IsPaused checks if the execution is paused

func (*Emulator) Pause

func (e *Emulator) Pause()

Pause the execution

func (*Emulator) ReadROM

func (e *Emulator) ReadROM(filename string)

ReadROM open the rom at filename and load it in memory

func (*Emulator) Resume

func (e *Emulator) Resume()

Resume resumes the execution

func (*Emulator) SetBreakpoint

func (e *Emulator) SetBreakpoint(addr uint32)

func (*Emulator) SetRegisterBreakpoint

func (e *Emulator) SetRegisterBreakpoint(registers string)

func (*Emulator) Start

func (e *Emulator) Start()

Start the main emulator loop

func (*Emulator) StepAndWait

func (e *Emulator) StepAndWait(n int)

StepAndWait continues the execution for the given number of steps (if given 0 it will loop until a pause is triggered or the emulator is stopped) then it waits for the emulator to reach the pause status

func (*Emulator) Stop

func (e *Emulator) Stop()

Stop stops the emulation

type Memory

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

Memory struct containing SNES working RAM, cartridge static RAM, special hardware registers and default memory buffer for ROM

func (*Memory) ExportRam

func (mem *Memory) ExportRam() []byte

func (*Memory) GetByte

func (memory *Memory) GetByte(index uint32) uint8

GetByte gets a byte by its complete address

func (*Memory) GetByteBank

func (memory *Memory) GetByteBank(K uint8, offset uint16) uint8

GetByteBank gets a byte by memory bank and offset

func (*Memory) LoadROM

func (memory *Memory) LoadROM(r rom.ROM)

LoadROM takes a memory buffer and load it into memory depending ROM type

func (*Memory) SetByte

func (memory *Memory) SetByte(value uint8, index uint32)

SetByte sets a byte by its complete address

func (*Memory) SetByteBank

func (memory *Memory) SetByteBank(value uint8, K uint8, offset uint16)

SetByteBank sets a byte by memory bank and offset

type PPU

type PPU struct {
	Registers [0x40]*io.Register // Registers represents the ppu registers as methods
	// contains filtered or unexported fields
}

PPU represents the Picture Processing Unit of the SNES

func (*PPU) Backgrounds

func (ppu *PPU) Backgrounds() []image.Image

func (*PPU) ExportVRam

func (ppu *PPU) ExportVRam() []byte

func (*PPU) HCounter

func (ppu *PPU) HCounter() uint16

func (*PPU) Palette

func (ppu *PPU) Palette() color.Palette

Palette exports the content of the cgram

func (*PPU) Sprites

func (ppu *PPU) Sprites() []image.Image

Sprites returns all the sprites in image.Image format

func (*PPU) VCounter

func (ppu *PPU) VCounter() uint16

func (*PPU) VDisplay

func (ppu *PPU) VDisplay() uint16

VDisplay returns of the vertical size of the screen depending on the mode (NTSC/PAL)

func (*PPU) VDisplayEnd

func (ppu *PPU) VDisplayEnd() uint16

VDisplayEnd returns the extra VBLANK area of the screen depending on the mode (NTSC/PAL)

Jump to

Keyboard shortcuts

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