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

NAME

CPU::Z80::Assembler::List - Assembly listing output class

SYNOPSIS

  use CPU::Z80::Assembler::List;
  my $lst = CPU::Z80::Assembler::List->new(input => $asm_input, output => \*STDOUT);
  $lst->add($line, $address, $bytes);
  $lst->flush();

DESCRIPTION

This module handles the output of the assembly listing file. It is fead with each assembled opcode and generates the full assembly list file on the given output handle.

If output is undef, does not generate any output.

EXPORTS

Nothing.

FUNCTIONS

new

  my $lst = CPU::Z80::Assembler::List->new(input => $asm_input, output => \*STDOUT);

Creates a new object, see Class::Struct.

input

input is the input as passed to z80asm, i.e. list of text lines to parse or iterators that return text lines to parse.

output

output is the output file handle to receive the listing file. It can be an open file for writing, or one of the standard output file handles.

If output is undefined, no output is generated.

add

  $self->add($line, $address, $bytes);

Adds a new opcode to the output listing. Receives the opcode Asm::Preproc::Line, address and bytes. Generates the output lines including this new opcode.

The output is held in an internal buffer until an opcode for the next line is passed to a subsequent add() call.

The last output line is only output on flush() or DESTROY()

flush

  $self->flush();

Dumps the current line to the output. Called on DESTROY().