cpu

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag uint8
const (
	CarryFlag     Flag = 1 << 4
	HalfCarryFlag Flag = 1 << 5
	NegativeFlag  Flag = 1 << 6
	ZeroFlag      Flag = 1 << 7
)

type Instruction

type Instruction func(c *SM83)

type OpCode

type OpCode struct {
	Name       string
	Len        uint8
	Cycles     uint8
	CondCycles uint8 // Used for conditional instructions
	Exec       Instruction
}

func (*OpCode) Code

func (o *OpCode) Code() int

func (*OpCode) String

func (o *OpCode) String() string

type SM83

type SM83 struct {
	PPU   *ppu.PPU
	Sound *sound.Sound

	Input *input.Input

	RAM  [consts.RAMSize]byte  // 8KB of RAM
	HRAM [consts.HRAMSize]byte // 127 bytes of HRAM

	TMA    uint8 // Timer Modulo register, used for the timer
	TAC    byte  // Timer Control register, used to control the timer operation
	OAMDMA byte  // Object Attribute Memory DMA register, used for sprite data transfer
	// contains filtered or unexported fields
}

func NewSM83

func NewSM83(config *config.Config, cartridge *cartridge.Cartridge) *SM83

func (*SM83) DebugRegisters

func (c *SM83) DebugRegisters() string

func (*SM83) GetFlag

func (c *SM83) GetFlag(flag Flag) bool

func (*SM83) GetInterruptEnableFlag

func (c *SM83) GetInterruptEnableFlag(flag impls.Interrupt) bool

func (*SM83) GetInterruptFlag

func (c *SM83) GetInterruptFlag(flag impls.Interrupt) bool

func (*SM83) GetPC

func (c *SM83) GetPC() uint16

func (*SM83) Halt

func (c *SM83) Halt()

func (*SM83) IsHalted

func (c *SM83) IsHalted() bool

func (*SM83) Quit

func (c *SM83) Quit()

func (*SM83) Reset

func (c *SM83) Reset()

func (*SM83) Resume

func (c *SM83) Resume()

func (*SM83) Run

func (c *SM83) Run()

func (*SM83) RunUntilFrame

func (c *SM83) RunUntilFrame() [23040]byte

func (*SM83) SetFlag

func (c *SM83) SetFlag(flag Flag, val bool)

func (*SM83) SetInterruptFlag

func (c *SM83) SetInterruptFlag(flag impls.Interrupt, val bool)

func (*SM83) Step

func (c *SM83) Step() int

Jump to

Keyboard shortcuts

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