The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CPU::Z80::Disassembler::Labels - All labels used in the disassembled program

SYNOPSYS

  $labels = CPU::Z80::Disassembler::Labels->new();
  $labels->add($addr, $name, $from_addr);
  $found = $labels->search_addr($addr);
  $found = $labels->search_name($name);
  @labels = $labels->search_all;
  print $labels->max_length;
  $label = $labels->next_label($addr);

DESCRIPTION

Contains an indexed list of all CPU::Z80::Diassembler::Label labels in the disassembled program.

Each label is created by the add() method, that simultaneously prepares the indexes for a fast search. There are also methods to search for labels at a given address of with a given name.

This module assumes that the address of a label does not change after being defined, i.e. there is never the need to reindex all labels.

FUNCTIONS

new

Creates a new empty object.

add

Creates and adds a new label to the indexes. If the same name and address as an existing label is given then the $from_addr is updated.

If the name is not given, creates a temporary label of the form L_HHHH.

It is an error to add a label already added with a different address.

max_length

Length of the longest label name of all defined labels. This is updated when a label is added to the index, and can be used for formating label lists in columns.

search_addr

Return the label object defined at the given address, undef if none.

search_name

Return the label object with the given name, undef if none.

search_all

Return all the defined label objects.

next_label

Return the first label defined on the given address or after. If no address is given, returns the first defined label. Returns undef if there is no label on the address or after.

This can be used to find the next label after the current instruction.

BUGS, FEEDBACK, AUTHORS, COPYRIGHT and LICENCE

See CPU::Z80::Disassembler.