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 ¶
- type Symbols
- func (sym *Symbols) LabelWidth() int
- func (sym *Symbols) ListLabels(output io.Writer)
- func (sym *Symbols) ListReadSymbols(output io.Writer)
- func (sym *Symbols) ListSymbols(output io.Writer)
- func (sym *Symbols) ListWriteSymbols(output io.Writer)
- func (sym *Symbols) Search(symbol string, target TableType) (bool, TableType, string, uint16)
- func (sym *Symbols) SymbolWidth() int
- type Table
- type TableType
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 ¶
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 (*Symbols) ListLabels ¶ added in v0.7.1
ListLabels outputs every label used in the current ROM.
func (*Symbols) ListReadSymbols ¶ added in v0.7.1
ListReadSymbols outputs every read symbol used in the current ROM.
func (*Symbols) ListSymbols ¶ added in v0.7.1
ListSymbols outputs every symbol used in the current ROM.
func (*Symbols) ListWriteSymbols ¶ added in v0.7.1
ListWriteSymbols outputs every write symbol used in the current ROM.
func (*Symbols) Search ¶ added in v0.7.1
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
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.