class Metasm::Opcode

a cpu instruction 'formal' description

Attributes

args[RW]

formal description of arguments (array of cpu-specific symbols)

bin[RW]

binary encoding of the opcode (integer for risc, array of bytes for cisc)

bin_mask[RW]

binary mask for decoding

fields[RW]

list of bit fields in the binary encoding hash position => field position is bit shift for risc, [byte index, bit shift] for risc field is cpu-specific

name[RW]

the name of the instruction

props[RW]

hash of opcode generic properties/restrictions (mostly property => true/false)

Public Class Methods

new(name, bin=nil) click to toggle source
# File metasm/main.rb, line 123
def initialize(name, bin=nil)
        @name = name
        @bin = bin
        @args = []
        @fields = {}
        @props = {}
end

Public Instance Methods

basename() click to toggle source
# File metasm/main.rb, line 131
def basename
        @name.sub(/\..*/, '')
end
dup() click to toggle source
# File metasm/main.rb, line 135
def dup
        o = Opcode.new(@name.dup, @bin)
        o.bin    = @bin.dup if @bin.kind_of?(::Array)
        o.args   = @args.dup
        o.fields = @fields.dup
        o.props  = @props.dup
        o
end