11 require Nasm
::Regs
::Register
;
12 require Nasm
::Regs
::Format
;
15 my($class,$filename) = @_;
16 my $self = bless {}, $class;
18 if( @_ > 1 and $filename ){
19 $self->ProcessFile($filename);
29 my($self,$filename) = @_;
32 if( $filename eq '-'){
35 open $file, '<', $filename or die;
37 $self->{filename
} = $filename;
39 my %current =( line_number
=> -1 );
41 while( my $line = <$file> ){
42 $current{line_number
}++;
44 $line =~ s/\s*(?:\#.*)?$//;
45 next unless length $line;
47 $current{line
} = $line;
48 $self->ProcessLine(\
%current);
59 my($self,$current) = @_;
61 unless( $current->{line
} =~ /^\s*(\S+)\s*(\S+)\s*(\S+)\s*([0-9]+)$/ ){
65 my ($register,$a_class,$d_classes,$x86regno) = ($1,$2,$3,$4);
71 (.*?
) (\d
+) - (\d
+) (.*)
75 push @reg_list, $1. $i . $4
79 @reg_list = $register;
82 # force numeric conversion
85 my @d_classes = split ',', $d_classes;
88 for my $register(@reg_list){
89 my $reg_obj = Nasm
::Regs
::Register
->new($register,$a_class,[@d_classes],$x86regno);
90 $self->{register
}{$register} = $reg_obj;
92 for my $class (@d_classes){
93 $self->{disassembler
}{$class}[$x86regno] = $reg_obj
106 return $self->RegisterNames;
110 my @keys = sort grep { length $_ } keys %{$self->{register
}};
112 return @keys if wantarray;
120 return $self->{register
}{$key};
122 sub DisassemblerClasses
{
124 my @return = sort keys %{$self->{disassembler
}};
125 return @return if wantarray;
128 sub DisassemblerClass
{
129 my($self,$class) = @_;
130 my $return = $self->{disassembler
}{$class};
131 return @
$return if wantarray;
138 Nasm
::Regs
::Format
::format
($self,$fmt);
144 return $self->{filename
};