instructions

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: 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       Operator
	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.

type Operator added in v0.19.0

type Operator int

Operator defines which operation is performed by the opcode. Many opcodes can perform the same operation.

const (
	Nop Operator = iota
	Adc
	AHX
	ANC
	And
	ARR
	Asl
	ASR
	AXS
	Bcc
	Bcs
	Beq
	Bit
	Bmi
	Bne
	Bpl
	Brk
	Bvc
	Bvs
	Clc
	Cld
	Cli
	Clv
	Cmp
	Cpx
	Cpy
	DCP
	Dec
	Dex
	Dey
	Eor
	Inc
	Inx
	Iny
	ISC
	Jmp
	Jsr
	KIL
	LAS
	LAX
	Lda
	Ldx
	Ldy
	Lsr
	NOP
	Ora
	Pha
	Php
	Pla
	Plp
	RLA
	Rol
	Ror
	RRA
	Rti
	Rts
	SAX
	Sbc
	SBC
	Sec
	Sed
	Sei
	SHX
	SHY
	SLO
	SRE
	Sta
	Stx
	Sty
	TAS
	Tax
	Tay
	Tsx
	Txa
	Txs
	Tya
	XAA
)

List of valid Operator values.

func (Operator) String added in v0.19.0

func (operator Operator) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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