#!/usr/bin/perl @ARGV==2 or die; ($wiring,$_) = @ARGV; m/^\d+$/ or die; $_<32 or die; $picno= $_; # @a is the ID locations, one byte per array entry, # with $a[0] being the first ID location (ie 0x200000). # Values must be in hex (or otherwise suitable for the assembler). $a[0]= $picno; $a[1]= 0; $a[1] |= 0x80 if !$picno; open W, "< $wiring" or die "$wiring: $!"; while () { next if m/^\s*\#/; next unless m/^boards\s+$/...(!m/\S/ || m/^\S/); next if !m/\S/ || m/^\S/; die unless m/^\s+(\d+)\s+(\w+)\s*$/; next unless $1 == $picno; $board= $2; } close W; die $picno unless defined $board; die $board unless $board =~ m/^(?:reversers|detectors)$/; $a[1] |= 0x40 if $board eq 'detectors'; @a= map { sprintf "0x%02x", $_; } @a; printf "; automatically generated - do not edit\n" or die $!; for ($i= 0x200000; @a; $i++) { $_= shift @a; printf "\t __idlocs \t 0x%06x, %s\n", $i, $_ or die $!; } print "\t end\n" or die $!;