symbols

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: GPL-3.0, GPL-3.0 Imports: 11 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 Table

type Table struct {
	// the master table is made up of three sub-tables
	Locations *symTable
	Read      *symTable
	Write     *symTable

	// use max width values to help with formatting
	MaxLocationWidth int
	MaxSymbolWidth   int
}

Table is the master symbols table for the loaded programme

func NewTable

func NewTable() *Table

NewTable is the preferred method of initialisation for the Table type. In many instances however, ReadSymbolsFile() might be more appropriate. Naked initalisation of the Table type (ie. &Table{}) will rarely be useful.

func ReadSymbolsFile

func ReadSymbolsFile(cartridgeFilename string) (*Table, error)

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

Table 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 (*Table) ListLocations

func (tbl *Table) ListLocations(output io.Writer)

ListLocations outputs every location symbol used in the current ROM

func (*Table) ListReadSymbols

func (tbl *Table) ListReadSymbols(output io.Writer)

ListReadSymbols outputs every read symbol used in the current ROM

func (*Table) ListSymbols

func (tbl *Table) ListSymbols(output io.Writer)

ListSymbols outputs every symbol used in the current ROM

func (*Table) ListWriteSymbols

func (tbl *Table) ListWriteSymbols(output io.Writer)

ListWriteSymbols outputs every write symbol used in the current ROM

func (*Table) SearchSymbol

func (tbl *Table) SearchSymbol(symbol string, target TableType) (TableType, string, uint16, error)

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

type TableType

type TableType int

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

const (
	UnspecifiedSymTable TableType = iota
	LocationSymTable
	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