NAME
SIRTX::VM::Opcode - module for single SIRTX VM opcodes
VERSION
version v0.04
SYNOPSIS
use SIRTX::VM::Opcode;
my SIRTX::VM::Opcode $opcode = SIRTX::VM::Opcode->new(...);
$opcode->write($out);
This package inherits from Data::Identifier::Interface::Userdata.
METHODS
new
my SIRTX::VM::Opcode $opcode = SIRTX::VM::Opcode->new(%opts);
Creates a new opcode object.
The following options are supported. Which values are required depend on the other values.
first
-
The first byte of the opcode.
second
-
The second byte of the opcode.
code
-
The
code
value of the opcode. codeX
-
The
codeX
value of the opcode. ST
-
The combined
S
andT
values of the opcode. P
-
The
P
value of the opcode. S
-
The
S
value of the opcode. T
-
The
T
value of the opcode. extra
-
The extra data to be added to the opcode. This might be an array of 16 bit values or a (even sized) bytestring.
size
-
The space (in bytes) for the opcode to fill. This may be used in multi-pass translation.
from_template
my SIRTX::VM::Opcode $opcode = SIRTX::VM::Opcode->from_template(...);
(experimental)
Try to create an opcode from a template
write
$opcode->write($fh);
Writes the opcode to $fh
. The handle must be correctly aligned.
See also: "required_alignment".
required_alignment
my $alignment = $opcode->required_alignment;
Returns the required alignment (in bytes) for the opcode.
new_alignment
my $alignment = $opcode->new_alignment;
Returns the new alignment after the opcode has been written (considering "required_alignment" was adhered).
required_size
my $size = $opcode->required_size;
Returns the size of the opcode (in bytes).
is_return
my $is_return = $opcode->is_return;
Returns a true value for opcodes that are some kind of return (e.g. return, die, or exit).
is_autodie
my $is_autodie = $opcode->is_autodie;
Returns a true value for opcodes that are some kind of autodie (autodie, those that implement it).
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2024-2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)