nes

package
v0.0.0-...-45a14b4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CONTROLLER_1_ADDRESS = 0x4016
View Source
const CONTROLLER_2_ADDRESS = 0x4017
View Source
const CONTROLLER_A byte = 0x80
View Source
const CONTROLLER_ARROW_DOWN byte = 0x04
View Source
const CONTROLLER_ARROW_LEFT byte = 0x02
View Source
const CONTROLLER_ARROW_RIGHT byte = 0x01
View Source
const CONTROLLER_ARROW_UP byte = 0x08
View Source
const CONTROLLER_B byte = 0x40
View Source
const CONTROLLER_SELECT byte = 0x20
View Source
const CONTROLLER_START byte = 0x10
View Source
const RAM_HIGHER_ADDRESS = types.Address(0x1FFF)
View Source
const RAM_LAST_REAL_ADDRESS = types.Address(0x07FF)
View Source
const RAM_LOWER_ADDRESS = types.Address(0x0000)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressModeMethod

type AddressModeMethod func(programCounter types.Address) (finalAddress types.Address, operand [3]byte, cycles int, pageCrossed bool)

type CPUMemory

type CPUMemory struct {
	DmaTransfer   bool
	DmaPage       byte
	DmaWaiting    bool
	DmaAddress    byte
	DmaReadBuffer byte
	// contains filtered or unexported fields
}

func (*CPUMemory) DisableDMWaiting

func (cm *CPUMemory) DisableDMWaiting()

func (*CPUMemory) GetDMAAddress

func (cm *CPUMemory) GetDMAAddress() byte

func (*CPUMemory) GetDMAPage

func (cm *CPUMemory) GetDMAPage() byte

func (*CPUMemory) GetDMAReadBuffer

func (cm *CPUMemory) GetDMAReadBuffer() byte

func (*CPUMemory) IncrementDMAAddress

func (cm *CPUMemory) IncrementDMAAddress()

func (*CPUMemory) IsDMATransfer

func (cm *CPUMemory) IsDMATransfer() bool

func (*CPUMemory) IsDMAWaiting

func (cm *CPUMemory) IsDMAWaiting() bool

func (*CPUMemory) Peek

func (cm *CPUMemory) Peek(address types.Address) byte

func (*CPUMemory) Read

func (cm *CPUMemory) Read(address types.Address) byte

func (*CPUMemory) ResetDMA

func (cm *CPUMemory) ResetDMA()

func (*CPUMemory) SetDMAReadBuffer

func (cm *CPUMemory) SetDMAReadBuffer(value byte)

func (*CPUMemory) Write

func (cm *CPUMemory) Write(address types.Address, value byte)

type ControllerState

type ControllerState struct {
	A      bool
	B      bool
	Select bool
	Start  bool
	Up     bool
	Down   bool
	Left   bool
	Right  bool
}

type Cpu6502

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

Cpu6502 Represents a CPU 6502

func CreateCPU

func CreateCPU(memory Memory, debugger *cpu.Debugger) *Cpu6502

func (*Cpu6502) Complete

func (cpu6502 *Cpu6502) Complete() bool

func (*Cpu6502) Disassemble

func (cpu6502 *Cpu6502) Disassemble(start types.Address, end types.Address) (map[types.Address]string, []utils.ASM)

func (*Cpu6502) GetOperation

func (cpu6502 *Cpu6502) GetOperation(operation byte) cpu.Instruction

func (*Cpu6502) Init

func (cpu6502 *Cpu6502) Init()

func (*Cpu6502) ProgramCounter

func (cpu6502 *Cpu6502) ProgramCounter() types.Address

func (*Cpu6502) Registers

func (cpu6502 *Cpu6502) Registers() *cpu.Registers

func (*Cpu6502) Reset

func (cpu6502 *Cpu6502) Reset()

func (*Cpu6502) ResetToAddress

func (cpu6502 *Cpu6502) ResetToAddress(programCounter types.Address)

func (*Cpu6502) Stop

func (cpu6502 *Cpu6502) Stop()

func (*Cpu6502) Tick

func (cpu6502 *Cpu6502) Tick() (byte, cpu.CpuState)

type Debugger

type Debugger struct {
	DebugPPU bool
	// contains filtered or unexported fields
}

Debugger offers an api to interact externally with NES components

func CreateNesDebugger

func CreateNesDebugger(logPath string, debugCPU bool, debugPPU bool) *Debugger

func (*Debugger) ARegister

func (debugger *Debugger) ARegister() byte

func (*Debugger) AddBreakPoint

func (debugger *Debugger) AddBreakPoint(address types.Address)

func (*Debugger) B

func (debugger *Debugger) B() bool

func (*Debugger) C

func (debugger *Debugger) C() bool

func (*Debugger) D

func (debugger *Debugger) D() bool

func (*Debugger) Disassembled

func (debugger *Debugger) Disassembled() map[types.Address]string

func (*Debugger) GetPaletteColorFromPaletteRam

func (debugger *Debugger) GetPaletteColorFromPaletteRam(paletteIndex byte, colorIndex byte) byte

func (*Debugger) GetPaletteFromRam

func (debugger *Debugger) GetPaletteFromRam(paletteIndex uint8) [4]color.Color

func (*Debugger) I

func (debugger *Debugger) I() bool

func (*Debugger) N

func (debugger *Debugger) N() bool

func (*Debugger) O

func (debugger *Debugger) O() bool

func (*Debugger) OAM

func (debugger *Debugger) OAM(index byte) []byte

func (*Debugger) PatternTable

func (debugger *Debugger) PatternTable(patternTable byte, palette uint8) image.RGBA

PPU Related

func (*Debugger) ProgramCounter

func (debugger *Debugger) ProgramCounter() types.Address

func (*Debugger) RemoveBreakPoint

func (debugger *Debugger) RemoveBreakPoint(address types.Address)

func (*Debugger) RunOneCPUOperationAndPause

func (debugger *Debugger) RunOneCPUOperationAndPause()

RunOneCPUOperationAndPause executed when user wants to just run one single cycle after having emulation paused.

func (*Debugger) SortedDisassembled

func (debugger *Debugger) SortedDisassembled() []utils.ASM

func (*Debugger) XRegister

func (debugger *Debugger) XRegister() byte

func (*Debugger) YRegister

func (debugger *Debugger) YRegister() byte

func (*Debugger) Z

func (debugger *Debugger) Z() bool

type Memory

type Memory interface {
	// Peek Reads without side effects. Useful for debugging
	Peek(types.Address) byte
	Read(types.Address) byte
	Write(types.Address, byte)

	IsDMAWaiting() bool
	IsDMATransfer() bool
	DisableDMWaiting()
	GetDMAPage() byte
	GetDMAAddress() byte
	GetDMAReadBuffer() byte
	SetDMAReadBuffer(value byte)
	IncrementDMAAddress()
	ResetDMA()
}

type Nes

type Nes struct {
	Cpu *Cpu6502
	// contains filtered or unexported fields
}

func CreateNes

func CreateNes(gamePak *gamePak.GamePak, debugger *Debugger) *Nes

func (*Nes) Debugger

func (nes *Nes) Debugger() *Debugger

func (*Nes) Finished

func (nes *Nes) Finished() bool

func (*Nes) Frame

func (nes *Nes) Frame() *image.RGBA

func (*Nes) FramePattern

func (nes *Nes) FramePattern() []byte

func (*Nes) PPU

func (nes *Nes) PPU() *ppu.P2c02

func (*Nes) Pause

func (nes *Nes) Pause()

func (*Nes) Paused

func (nes *Nes) Paused() bool

func (*Nes) PausedTick

func (nes *Nes) PausedTick()

func (*Nes) Start

func (nes *Nes) Start()

Start todo Rename to PowerOn

func (*Nes) StartAt

func (nes *Nes) StartAt(address types.Address)

func (*Nes) Stop

func (nes *Nes) Stop()

func (*Nes) SystemClockCounter

func (nes *Nes) SystemClockCounter() uint64

func (*Nes) Tick

func (nes *Nes) Tick() (byte, bool)

func (*Nes) TickForTime

func (nes *Nes) TickForTime(seconds float64)

func (*Nes) TickTillFrameComplete

func (nes *Nes) TickTillFrameComplete()

func (*Nes) UpdateController

func (nes *Nes) UpdateController(controllerNumber int, state ControllerState)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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