3 # inslist.pl produce inslist.src
5 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
6 # Julian Hall. All rights reserved. The software is
7 # redistributable under the licence given in the file "Licence"
8 # distributed in the NASM archive.
10 # Opcode prefixes which need their own opcode tables
11 # LONGER PREFIXES FIRST!
12 @disasm_prefixes = qw(0F24 0F25 0F38 0F3A 0F7A 0FA6 0FA7 0F);
14 print STDERR
"Reading insns.dat...\n";
18 foreach $arg ( @ARGV ) {
19 if ( $arg =~ /^\-/ ) {
20 if ( $arg =~ /^\-([adins])$/ ) {
23 die "$0: Unknown option: ${arg}\n";
30 $fname = "../insns.dat" unless $fname = $args[0];
31 open (F
, $fname) || die "unable to open $fname";
32 print STDERR
"Writing inslist.src...\n";
33 open S
, ">inslist.src";
38 if ( /^\s*;/ ) # comments
40 if ( /^\s*;\#\s*(.+)/ ) # section subheader
42 print S
"\n\\S{} $1\n\n";
48 next if $#entry == -1; # blank lines
49 (warn "line $line does not contain four fields\n"), next if $#entry != 3;
51 @entry[1] =~ s/ignore//;
52 @entry[1] =~ s/void//;
53 @entry[3] =~ s/ignore//;
56 @entry[3] =~ s/,SM2//;
58 @entry[3] =~ s/,AR2//;
59 printf S
"\\c %-16s %-24s %s\n",@entry[0],@entry[1],@entry[3];
65 printf STDERR
"Done: %d instructions\n", $insns;