summaryrefslogtreecommitdiff
path: root/xpp/cmd2inc
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/cmd2inc')
-rwxr-xr-xxpp/cmd2inc48
1 files changed, 0 insertions, 48 deletions
diff --git a/xpp/cmd2inc b/xpp/cmd2inc
deleted file mode 100755
index f1aa9c9..0000000
--- a/xpp/cmd2inc
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /usr/bin/perl -w
-
-use strict;
-
-my $input;
-my $header;
-my $comment;
-my $len;
-
-@ARGV == 1 or @ARGV == 2 or die "Usage: $0 <infile> <outfile>\n";
-$input = $ARGV[0];
-$header = $ARGV[1];
-open(IF, "$input") or die "Failed to open '$input': $!\n";
-
-if($header) {
- open(HF, ">$header") or die "Failed to write '$header': $!\n";
- select HF;
-}
-
-while(<IF>) {
- chomp;
- undef $comment;
- s/\r//; # CRLF -> LF
- if(s/\s*[;#]\s*(.*?)$//) { # Comments
- $comment = $1;
- }
- if(/^\s*$/) { # Empty lines
- next;
- }
- my ($slic0, $slic1, $slic2, $slic3, $op, @data) = split;
- my $slic = "$slic3$slic2$slic1$slic0";
- die "Bad slic address '$slic'" if length($slic) != 8;
- die "Bad op (op=%op)\n" if $op !~ /^[WR][DI]$/;
- if($op =~ /D$/) { # Direct
- die "Bad input at line $.: @data=(@data)\n" if @data != 2;
- # len reg data
- printf "S_(0x$slic,\t0x02,\t0x%02s, 0x%02s),\t", $data[0], $data[1];
- } else { # Indirect
- die "Bad input at line $.: @data=(@data)\n" if @data != 3;
- # len data1 data2 reg
- printf "S_(0x$slic,\t0x06,\t0x1C, 0x%02s, 0x1D, 0x%02s, 0x1E, 0x%2s),\t", $data[2], $data[1], $data[0];
- }
-} continue {
- if(defined($comment)) {
- print "// $comment";
- }
- print "\n";
-}