cpu

package
v0.0.0-...-658d513 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package cpu provides general CPU related type support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressingInfo

type AddressingInfo struct {
	Opcode byte
	Size   byte
}

AddressingInfo contains the opcode and timing info for an instruction addressing mode.

type Instruction

type Instruction struct {
	Name       string
	Unofficial bool

	// instruction has no parameters
	NoParamFunc func()
	// instruction has parameters
	ParamFunc func(params ...any)

	// maps addressing mode to cpu cycles
	Addressing map[Mode]AddressingInfo
}

Instruction contains information about a NES CPU instruction.

func (Instruction) HasAddressing

func (ins Instruction) HasAddressing(flags ...Mode) bool

HasAddressing returns whether the instruction has any of the passed addressing modes.

type Opcode

type Opcode struct {
	Instruction    *Instruction
	Addressing     Mode
	Timing         byte
	PageCrossCycle bool
}

Opcode is a NES CPU opcode that contains the instruction info and used addressing mode.

func (Opcode) ReadWritesMemory

func (opcode Opcode) ReadWritesMemory(memoryReadWriteInstructions map[string]struct{}) bool

ReadWritesMemory returns whether the instruction accesses memory reading and writing.

func (Opcode) ReadsMemory

func (opcode Opcode) ReadsMemory(memoryReadInstructions map[string]struct{}) bool

ReadsMemory returns whether the instruction accesses memory reading.

func (Opcode) WritesMemory

func (opcode Opcode) WritesMemory(memoryWriteInstructions map[string]struct{}) bool

WritesMemory returns whether the instruction accesses memory writing.

Jump to

Keyboard shortcuts

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