NAME
CPU::Z80::Assembler::Segment - Represents one segment of assembly opcodes
SYNOPSIS
use CPU::Z80::Assembler::Segment;
my $segment = CPU::Z80::Assembler::Segment->new(
name => $name,
address => 0,
child => [$opcode, ...]);
$segment->link;
my $size = $segment->size;
my $bytes = $segment->bytes(\%symbols);
DESCRIPTION
This module defines the class that represents one continuous segment of assembly instruction opcodes CPU::Z80::Assembler::Opcode.
This class extends the class CPU::Z80::Assembler::Node.
EXPORTS
Nothing.
FUNCTIONS
new
Creates a new object, see Class::Struct.
child
Each child is one CPU::Z80::Assembler::Opcode object.
name
Get/set of segment name.
address
Get/set of base address of the segment.
org
$self->org($address, $token);
Changes the start address of the segment. It is a fatal error to try to change the address after some opcodes have been compiled.
$token is the location of the ORG instruction used for error messages.
add
$self->add(@opcodes);
Adds the opcodes to the segment.
link
$segment->link;
Allocate addresses for all child opcodes, starting at the segment address
, if defined by a "org" instruction, or at 0.
size
my $size = $segment->size;
Returns the size of the segment. This value is filled by the link
method, the function dies if the size is not yet defined.
bytes
$segment->bytes(\%symbols, $list_output);
Computes the bytes of each opcode, and concatenates them together. Returns the complete object code.
$list_output is an optional CPU::Z80::Assembler::List object to dump the assembly listing to.
BUGS and FEEDBACK
See CPU::Z80::Assembler.
SEE ALSO
CPU::Z80::Assembler CPU::Z80::Assembler::Line CPU::Z80::Assembler::Opcode CPU::Z80::Assembler::Node Class::Struct
AUTHORS, COPYRIGHT and LICENCE
See CPU::Z80::Assembler.