|
NAMECPU::Z80::Assembler::Program - Represents one assembly programSYNOPSISuse CPU::Z80::Assembler::Program; my $program = CPU::Z80::Assembler::Program->new( symbols => {}, macros => {}); $program->parse($input); $segment = $program->segment; $segment = $program->segment("CODE"); $segment = $program->split_segment; $program->add_opcodes(@opcodes); $program->add_label($name, $line); $program->org($address); $bytes = $program->bytes; $list_output = CPU::Z80::Assembler::List->new(input => \@input, output => \*STDOUT); $bytes = $program->bytes($list_output); DESCRIPTIONThis module defines the class that represents one assembly program composed of CPU::Z80::Assembler::Segment.EXPORTSNothing.FUNCTIONSnewCreates a new object, see Class::Struct.childEach child is one CPU::Z80::Assembler::Segment object, in the order found in the program.symbolsHash of all symbols defined in the program. The key is the symbol name, and the value is either a scalar for a constant, a CPU::Z80::Assembler::Expr for an expression, or a CPU::Z80::Assembler::Opcode for a label.macrosHash of macro names to CPU::Z80::Assembler::Macro objects for all defined macros.parse$program->parse($input); Parse the assembly program and collect the opcodes into the object. $input is a stream of tokens as retrieved by CPU::Z80::Assembler "z80lexer". segmentGet/Set the current segment. The current segment is the one where new opcodes are added.When called without arguments returns a CPU::Z80::Assembler::Segment object of the current segment. When called with a $name, it sets the segment with the given name as current. If no such segment exists, a new segment with that name is appended to the list and set current. split_segmentSplits the current segment at the current position, creating a new segment, inserting it just after the current one and setting it as current.Returns the new current segment. As a special case, if the current is empty, then nothing is done. This is used to split one segment in two after a second ORG statement. add_opcodesAdds the opcodes to the current segment.add_labelAdd a new label at the current position with given name and line. The line is used for error messages and assembly listing.It is an error to add a label twice with the same name. orgSplits the current segment with split_segment() and sets the start address of the new current segment.bytesAllocate addresses for all child segments, starting at the first segment's "address" (defined by a "org" instruction), or at 0.Computes the bytes of each segment, and concatenates them together. Returns the complete object code. Gaps between segments are filled with $CPU::Z80::Assembler::fill_byte. $list_output is an optional CPU::Z80::Assembler::List object to dump the assembly listing to. BUGS and FEEDBACKSee CPU::Z80::Assembler.SEE ALSOCPU::Z80::Assembler CPU::Z80::Assembler::Segment CPU::Z80::Assembler::Parser Class::StructAUTHORS, COPYRIGHT and LICENCESee CPU::Z80::Assembler.
Visit the GSP FreeBSD Man Page Interface. |