CPU::Z80::Assembler::Opcode - Represents one assembly expression to be computed at link time


CPU-Z80-Assembler documentation  | view source Contained in the CPU-Z80-Assembler distribution.

Index


NAME

Top

CPU::Z80::Assembler::Opcode - Represents one assembly expression to be computed at link time

SYNOPSIS

Top

  use CPU::Z80::Assembler::Opcode;
  $opcode = CPU::Z80::Assembler::Opcode->new(
					address => 0,
					line => $line,
					child => [byte, byte, ["type", $expr]]);
  $value = $opcode->evaluate;
  $bytes = $opcode->bytes($address, \%symbol_table);
  $size = $opcode->size;

DESCRIPTION

Top

This module defines the class that represents one assembly instruction to be added to the object code. The instruction can contain references to CPU::Z80::Assembler::Expr expressions that are computed at link time.

EXPORTS

Top

Nothing.

FUNCTIONS

Top

new

Creates a new object.

address

Address where this opcode is loaded, computed at link time.

child

The number of children is the number of bytes stored in the object code for this instruction.

Each child is either a scalar containing the byte value to be added to the object code, or a CPU::Z80::Assembler::Expr expression to be evaluated at link time. In case of a word expression, then a special undef value is used as a placeholder to keep the child list the correct size.

line

Get/set the line - text, file name and line number where the token was read.

evaluate

Called when opcode is referred to by a label, returns the opcode address.

bytes

  $bytes = $opcode->bytes($address, \%symbol_table);

Computes all the expressions in child and returns the bytes string with the result object code.

size

  $size = $opcode->size;

Return the number of bytes that this opcode will generate.

BUGS and FEEDBACK

Top

See CPU::Z80::Assembler.

SEE ALSO

Top

CPU::Z80::Assembler Asm::Preproc::Line

AUTHORS, COPYRIGHT and LICENCE

Top


CPU-Z80-Assembler documentation  | view source Contained in the CPU-Z80-Assembler distribution.