instructions

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: GPL-3.0, GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package instructions defines the table of instruction for the 6507. The Definition type is used to summarise the requirements and effects of each entry in the table.

The table is generated programatically by the generator sub-package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressingMode

type AddressingMode int

AddressingMode describes the method data for the instruction should be received.

const (
	Implied AddressingMode = iota
	Immediate
	Relative // relative addressing is used for branch instructions

	Absolute // abs
	ZeroPage // zpg
	Indirect // ind

	IndexedIndirect // (ind,X)
	IndirectIndexed // (ind), Y

	AbsoluteIndexedX // abs,X
	AbsoluteIndexedY // abs,Y

	ZeroPageIndexedX // zpg,X
	ZeroPageIndexedY // zpg,Y
)

List of supported addressing modes.

func (AddressingMode) String added in v0.10.1

func (m AddressingMode) String() string

type Cycles added in v0.16.0

type Cycles struct {
	Value     int
	Formatted string
}

Cycles is the number of cycles for the instruction. The Formatted value is the Value field formatted as a string with the condition that branch instructions are formatted as:

Value/Value+1

We do not format any potential PageSensitive cycle.

type Definition

type Definition struct {
	OpCode         uint8
	Operator       string
	Bytes          int
	Cycles         Cycles
	AddressingMode AddressingMode
	PageSensitive  bool
	Effect         EffectCategory

	// Whether instruction is "undocumented".
	Undocumented bool
}

Definition defines each instruction in the instruction set; one per instruction.

func GetDefinitions

func GetDefinitions() []*Definition

GetDefinitions returns the table of instruction definitions for the 6507

func (Definition) IsBranch

func (defn Definition) IsBranch() bool

IsBranch returns true if instruction is a branch instruction.

func (Definition) String

func (defn Definition) String() string

String returns a single instruction definition as a string.

type EffectCategory

type EffectCategory int

EffectCategory categorises an instruction by the effect it has.

const (
	Read EffectCategory = iota
	Write
	RMW

	// flow consists of the Branch and JMP instructions. Branch instructions
	// specifically can be distinguished by the AddressingMode.
	Flow

	Subroutine
	Interrupt
)

List of effect categories.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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