symbols

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0, GPL-3.0 Imports: 15 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 SearchResults added in v0.10.1

type SearchResults struct {
	Table   SearchTable
	Symbol  string
	Address uint16
}

SearchResults contains the normalised symbol info found in the SearchTable.

type SearchTable added in v0.10.1

type SearchTable int

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

const (
	SearchAll SearchTable = iota
	SearchLabel
	SearchRead
	SearchWrite
)

List of valid symbol table identifiers.

func (SearchTable) String added in v0.10.1

func (t SearchTable) String() string

type Symbols added in v0.7.1

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

Table is the master symbols table for the loaded programme.

func ReadSymbolsFile

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

ReadSymbolsFile initialises a symbols table from the symbols file for the specified cartridge. Even in the event of an error the Symbols table will still be usable and will contain the standard 2600 symbols.

Currently, only symbols files generated by DASM are supported.

func (*Symbols) AddLabel added in v0.10.1

func (sym *Symbols) AddLabel(bank int, addr uint16, symbol string, prefer bool)

Add symbol to label table.

func (*Symbols) GetLabel added in v0.10.1

func (sym *Symbols) GetLabel(bank int, addr uint16) (string, bool)

Get symbol from label table.

func (*Symbols) GetReadSymbol added in v0.10.1

func (sym *Symbols) GetReadSymbol(addr uint16) (string, bool)

Get symbol from read table.

func (*Symbols) GetWriteSymbol added in v0.10.1

func (sym *Symbols) GetWriteSymbol(addr uint16) (string, bool)

Get symbol from read table.

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) ReverseSearch added in v0.10.1

func (sym *Symbols) ReverseSearch(addr uint16, target SearchTable) *SearchResults

ReverseSearch returns the symbol for specified address.

When TableType is SearchAll the search in order: locations > read > write.

func (*Symbols) Search added in v0.7.1

func (sym *Symbols) Search(symbol string, target SearchTable) *SearchResults

Search return the address of the supplied seartch string.

Matching is case-insensitive and when TableType is SearchAll the search in order: locations > read > write.

func (*Symbols) SymbolWidth added in v0.7.1

func (sym *Symbols) SymbolWidth() int

func (*Symbols) UpdateLabel added in v0.10.1

func (sym *Symbols) UpdateLabel(bank int, addr uint16, label string)

Update symbol in label table.

type Table

type Table struct {
	// 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.

Jump to

Keyboard shortcuts

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