symbols

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: GPL-3.0, GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package symbols helps keep track of address symbols. The primary structure for this is the Table type. There are two recommended ways of instantiating this type. NewTable() will create a table instance with the default or canonical Atari 2600 symbol names. For example, AUDC0 refers to the $15 write address.

The second and more flexible way of instantiating the symbols Table is with the ReadSymbolsFile() function. This function will try to read a symbols file for the named cartridge and parse its contents. It will fail silently if it cannot.

ReadSymbolFile() will always give addresses the default or canonised symbol. In this way it is a superset of the NewTable() function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Symbols added in v0.7.1

type Symbols struct {
	// the master table is made up of three sub-tables
	Label *Table
	Read  *Table
	Write *Table
}

Table is the master symbols table for the loaded programme.

func NewSymbols added in v0.7.1

func NewSymbols() *Symbols

NewSymbols is the preferred method of initialisation for the Symbols type. In many instances however, ReadSymbolsFile() might be more appropriate.

func ReadSymbolsFile

func ReadSymbolsFile(cart *cartridge.Cartridge) (*Symbols, error)

ReadSymbolsFile initialises a symbols table from the symbols file for the specified cartridge

Symbols instance will always be valid even if error is returned. for example, if the symbols file cannot be opened the symbols file will still contain the canonical vcs symbols file

Currently, only symbols files generated by DASM are supported.

func (*Symbols) LabelWidth added in v0.7.1

func (sym *Symbols) LabelWidth() int

func (*Symbols) ListLabels added in v0.7.1

func (sym *Symbols) ListLabels(output io.Writer)

ListLabels outputs every label used in the current ROM.

func (*Symbols) ListReadSymbols added in v0.7.1

func (sym *Symbols) ListReadSymbols(output io.Writer)

ListReadSymbols outputs every read symbol used in the current ROM.

func (*Symbols) ListSymbols added in v0.7.1

func (sym *Symbols) ListSymbols(output io.Writer)

ListSymbols outputs every symbol used in the current ROM.

func (*Symbols) ListWriteSymbols added in v0.7.1

func (sym *Symbols) ListWriteSymbols(output io.Writer)

ListWriteSymbols outputs every write symbol used in the current ROM.

func (*Symbols) Search added in v0.7.1

func (sym *Symbols) Search(symbol string, target TableType) (bool, TableType, string, uint16)

SearchSymbol return the address of the supplied symbol. Search is case-insensitive and is conducted on the subtables in order: locations > read > write.

func (*Symbols) SymbolWidth added in v0.7.1

func (sym *Symbols) SymbolWidth() int

type Table

type Table struct {
	// indexed by address. addresses should be mapped before indexing takes place
	Entries map[uint16]string
	// contains filtered or unexported fields
}

Table maps a symbol to an address. it also keeps track of the widest symbol in the Table.

func (Table) Len added in v0.7.1

func (t Table) Len() int

Len implements the sort.Interface.

func (Table) Less added in v0.7.1

func (t Table) Less(i, j int) bool

Less implements the sort.Interface.

func (Table) String added in v0.7.1

func (t Table) String() string

func (Table) Swap added in v0.7.1

func (t Table) Swap(i, j int)

Swap implements the sort.Interface.

type TableType

type TableType int

TableType is used to select and identify a symbol table when searching.

const (
	UnspecifiedSymTable TableType = iota
	LabelTable
	ReadSymTable
	WriteSymTable
)

List of valid symbol table identifiers.

func (TableType) String

func (t TableType) String() string

Jump to

Keyboard shortcuts

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