[comp.sources.misc] v04i080: HP 41c assembler and barcode generator

markb@sm.unisys.com (Mark Biggar) (09/19/88)

Posting-number: Volume 4, Issue 80
Submitted-by: "Mark Biggar" <markb@sm.unisys.com>
Archive-name: hp41c-asm

There is a nice example of fancy perl programming

------------------ cut here --------------------
#!/bin/sh
sed -e 's/^X//' >README <<'EEE_OOO_FFF'
X
X                  HP 41c Assembler and Barcode Generator
X
X                      Copyright 1988 Mark A. Biggar
X          This code may be freely redistributed and used as long
X        as you don't claim you wrote it or make any money off it.
X
X
XThis system consists of two perl scripts with supporting files and
Xdocumentation.  The perl scripts require Perl 2.0 patchlevel 11 or later.
X
XINSTALLATION INSTRUCTIONS
X
X1) unshar the distribution file
X
X2) chose a directory for the rom library (suggested default
X	is /usr/local/lib/hp41c).  If you chose a different directory
X	you will need to change the assignment to $romlib at the top of
X	the script asm41c.
X
X3) make the files asm41c, bar41c and rom/trans executable
X
X4) install stuff by copying it to the proper directories:
X	asm41c & bar41c         /usr/local/bin (or equiv)
X	rom/*                   the selected rom library directory
X	doc/*.l                 the manl directory
X	tmac/tmac.*bar          /usr/lib/tmac
X
X5)  run the files in test to see if everything works
X
XI am loosing my network connect for a while so I can't handle bug reports
Xsorry.
EEE_OOO_FFF
echo x - README
sed -e 's/^X//' >MANIFEST <<'EEE_OOO_FFF'
XMANIFEST                list of files in distribution
XREADME                  READ THIS FIRST
Xasm41c                  assembler perl script
Xbar41c                  barcode generator perl script
Xdoc/asm41c.l            man page for asm41c
Xdoc/bar41c.l            man page for bar41c
Xrom/README              How to build rom files
Xrom/builtins            Assembler builtin operator tables
Xrom/trans               perl script to translate rom files
Xrom/CXextfcn.rom        HP 41CX entended functions
Xrom/CXtime.rom          HP 41CX time functions
Xrom/ILcntl.rom          HP IL loop control functions
Xrom/ILmass.rom          HP IL loop mass storage functions
Xrom/ILprinter.rom       HP IL loop printer functions
Xrom/advantage.rom       advantage module
Xrom/cardr.rom           card reader internal module
Xrom/extfcn.rom          extended functions module
Xrom/games.rom           games I module
Xrom/math.rom            math module
Xrom/ppc.rom             PPC club rom module
Xrom/printer.rom         normal printer functions
Xrom/time.rom            time module
Xrom/wand.rom            wand internal module
Xtest/README             test case files for assembler
Xtest/numbers.test
Xtest/rom.test
Xtest/single.test
Xtest/string.test
Xtest/symbol.test
Xtest/test.41c
Xtest/three.test
Xtest/twobyte.test
Xtmac/README             discriptions of the macros (for brave people)
Xtmac/tmac.lwbar
Xtmac/tmac.vbar
EEE_OOO_FFF
echo x - MANIFEST
sed -e 's/^X//' >asm41c <<'EEE_OOO_FFF'
X#! /bin/perl
X
X$romlib = "/usr/local/lib/hp41c";       # default rom library
X$outfile = 'bar.out';                   # default output file
X$title = "HP 41-C Assembler";           # default title
Xunshift(INC,$romlib);
X$DATE = `date`;
X
Xwhile ($_ = $ARGV[0], /^-/) {
X	shift;
X    last if /^--$/;
X	/^-n/ && do {              # want null bytes
X		++$nulls;
X		next; };
X	/^-l/ && do {              # want listing
X		++$listing;
X		next; };
X	/^-o/ && do {              # specify output file
X		die "asm41c: no file arg for -o"
X			unless ($ARGV[0]);
X		$outfile = shift;
X		next; };
X	/^-u/ && do {              # specfiy dir for user rom lib
X		die "asm41c: no arg for -u"
X			unless ($ARGV[0]);
X		unshift(INC,shift);
X		next; };
X	/^-t/ && do {              # specify title
X		die "asm41c: no title arg for -t"
X			unless ($ARGV[0]);
X		$title = shift;
X		next; };
X	/^-r/ && do {              # load rom
X		die "asm41c: no rom name for -r"
X			unless ($ARGV[0]);
X		die "asm41c: can't find rom ".$ARGV[0]
X			unless (do readrom($ARGV[0]));
X		shift;
X		next; };
X	/^-X/ && do {              # load roms of 41-CX
X		die "asm41c: can't load HP-41CX roms"
X			unless (do readrom("CXextfcn") &&
X				do readrom("CXtime"));
X		next; };
X	/^-I/ && do {              # load roms for IL support
X		die "asm41c: can't load IL roms"
X			unless (do readrom("ILcntl") &&
X				do readrom("ILmass") &&
X				do readrom("ILprinter"));
X		next; };
X	#default
X	die "asm41c: unknown flag $_";
X}
X
Xdie "asm41c: can't find builtin ops file"
X	unless (do "builtins");
X
X$~ = 'line';
X$^ = 'top';
Xopen(OUTFILE,">$outfile");
Xif ($title) {print OUTFILE "title $title\n";}
Xdo defsym();
X			   # special \ intreps for strings
X$specord{'-'} = 127;            # append char
X$specord{'='} =  29;            # not equal char
X$specord{'S'} = 126;            # sigma (can use '~' instead)
X$specord{'M'} =  12;            # mu
X$specord{'L'} =  13;            # angle char
X$specord{'P'} = 123;            # pi    (can use '{' instead)
X$specord{'A'} = 125;            # arrow char (can use '}' instead)
X
Xwhile (<>) {
X	chop;
X	$line = $_;
X	$error = '';
X	unless (/^[ \t]*$\|^\.\|^[ \t]*#/) {
X		do display('',$_,"Non-directive",'');
X		next;
X	}
X	/^\.rom\s+([^\s#]+)\s*(#.*)?$/ && do {
X		$error = "Can't find rom '$rom'."
X			unless (do readrom($1));
X		do display('',$line,$error,'');
X		next; };
X	/^\.xrom\s+([^\s#]+)\s+(\d\d)\s+(\d\d)\s*(#.*)?$/ && do {
X		$xrom{$1} = sprintf("%03d %03d",160+($2/4),64*($2%4)+$3);
X		do display('',$line,'','');
X		next; };
X	/^\.title\s+([^#]*)(#.*)?$/ && do {
X		$title = $1;
X		do display('',$line,'','');
X		print outfile "title $1\n";
X		next; };
X	/^\.page\s*(#.*)?$/ && do {
X		$- = 0;         #force new page
X		do display('',$line,'','');
X		next; };
X	/^\.prog(\s+private)?(\s+([^#]+))?(#.*)?$/ && do {
X		$program = ($3) || "unnamed";
X		$errcnt = 0;
X		print OUTFILE "program$1 $program\n";
X		do display('',$line,'','');
X		$lineno = 0;
X		$lastnum = $nulls;
X		while (<>) {
X			last if (/^\./);
X			chop;
X			/^\s*(#.*)?$/ && do { #blank or comment
X				do display('',$_,'','');
X				next; };
X			do asm($_);
X			$bytes = join(' ',@byt);
X			do display(++$lineno,$_,$error,$bytes);
X			print OUTFILE "$bytes\n";
X		}
X		$error = $errcnt ?
X			"program: $program, errors: $errcnt.":'';
X		do display('','',$error,'');
X		print OUTFILE "end $program\n";
X		$program = '';
X		last unless (/^\./);
X		redo; };
X	/^\.define\s+([A-Za-z]\w+)\s+(\d+|[A-Za-z]\w+)\s*(#.*)?$/ && do {
X		$name = $1;
X		$val = do validarg($2);
X		do display('',$_,$error,'');
X		$defsymbol{$name} = do pad($val);
X		next; };
X	/^\.exec(\s+([^#]*))?(#.*)?$/ && do {
X		print OUTFILE "exec $2\n";
X		do display('',$line,'','');
X		chop($line = <>);
X		do asm($line);
X		$bytes = join(' ',@byt);
X		do display('',$line,$error,$bytes);
X		print OUTFILE "$bytes\n";
X		next; };
X      /^\.string(\s+append)?\s+"(([^"]*\\")*.*)"(\s+([^#]*))?(#.*)?$/ && do {
X		$str = $2;
X		print OUTFILE "string$1 \"$str\" $5\n";
X		do strbytes($str);
X		if ($#byt > 14) {
X			$error = "String too long -- truncated.";
X			$#byt = 13;
X		}
X		$bytes = join(' ',@byt);
X		print OUTFILE "$bytes\n";
X		do display('',$line,$error,$bytes);
X		next; };
X    /^\.data\s+'([-+]?\d*\.?\d*([eE][-+]?\d*)?)'(\s+([^#]*))?(#.*)?$/ && do {
X		$num = $1;
X		$text = $4;
X		print OUTFILE "data '$num' $text\n";
X		do display('',$line,'','');
X		next; };
X	/^.bytes(\s+checksum)?\s+(\d+(\s+\d+)*)(\s+([^#]*))?(#.*)?/ && do {
X		@byt = split(//,$2);
X		print OUTFILE "bytes$1 $5\n";
X		$checksum = $1;
X		for $num (@byt) {
X			$num = do pad($num % 256);
X		}
X		if ($#byt > ($checksum?14:15)) {
X			$error = "Too many bytes -- Truncated";
X			$#byt = ($checksum?14:15);
X		}
X		$bytes = join(' ',@byt);
X		do display('',$line,$error,$bytes);
X		print OUTFILE "$bytes\n";
X		next; };
X	/^\.clear\s+roms\s*(#.*)?$/ && do {
X		reset 'x';
X		do display('',$line,'','');
X		next; };
X	/^\.clear\s+names\s*(#.*)?$/ && do {
X		reset 'd';
X		do defsym();
X		do display('',$line,'','');
X		next; };
X	/^\./ && do {
X		# if we get to here we don't recognize it
X		do display('',$_,"Unknown directive",'');
X		next; };
X	# default for blank line and/or comments
X	do display('',$_,'','');
X}
Xprint "\f" if ($listing);
Xexit 0;
X
X#
X# end of main routine
X#
X
Xformat line =
X# optional error message
X~         @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X	  $error;
X#first six bytes, line number & start of line image
X ^<<<<<<<<<<<<<<<<<<<<<<<  @>>> ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X $bytes                  $lno $limage
X#optional second six bytes & rest of line image
X~^<<<<<<<<<<<<<<<<<<<<<<<           ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X $bytes                                 $limage
X#optional last six bytes
X~^<<<<<<<<<<<<<<<<<<<<<<<
X $bytes
X.
X
Xformat top =
X
X
X @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>>>>>
X $title                                       $DATE
X @<<<<<<<<<<<<<<<<<<<<<<<<<<                                      Page @>>
X $program                                                              $%
X
X
X.
X
Xsub readrom {
X	local($romname) = @_;
X	$romname .= ".rom" unless ($romname =~ /\.rom$/);
X	do $romname;
X}
X
Xsub pad {
X	sprintf("%03d",pop(@_));
X}
X
Xsub display {
X	local($lno,$limage,$error,$bytes) = @_;
X	++$errcnt if $error;
X	if ($listing) {
X		$lno = sprintf("%04d",$lno) if $lno;
X		$error = "ERROR:     $error" if $error;
X		write;
X	} else {
X		if ($error) {
X			print stderr "ERROR: $error\n";
X			print stderr "\t$limage\n";
X		}
X	}
X}
X
Xsub strbytes {
X	local($_) = @_;
X	@byt = ();
X	while (length($_)) {
X		s/^\\(\d\d\d)(.*)$/$2/ && do {
X			push(byt,do pad($1 % 256));
X			next; };
X		s/^\\x([\da-fA-F][\da-fA-F])(.*)$/$2/ && do {
X			push(byt,do pad(hex($1)));
X			next; };
X		s/^\\(.)(.*)$/$2/ && do {
X			push(byt, do pad($specord{$1} || ord($1)));
X			next; };
X		s/^(.)(.*)$/$2/ && do {
X			push(byt,do pad(ord($1)));
X			next; };
X	}
X}
X
Xsub numbytes {
X	local($_) = @_;
X	@byt = ();
X	foreach (split(//)) {
X		/[0-9]/ && (push(byt,do pad(16+$_)),next);
X		/[Ee]/  && (push(byt,do pad(27))   ,next);
X		/-/     && (push(byt,do pad(28))   ,next);
X		/\./    && (push(byt,do pad(26))   ,next);
X		# note '+' are ignored
X	}
X}
X
Xsub defsym {
X# Predefined user defined symbols
X$defsymbol{'A'} = 102; $defsymbol{'B'} = 103;
X$defsymbol{'C'} = 104; $defsymbol{'D'} = 105;
X$defsymbol{'E'} = 106; $defsymbol{'F'} = 107;
X$defsymbol{'G'} = 108; $defsymbol{'H'} = 109;
X$defsymbol{'I'} = 110; $defsymbol{'J'} = 111;
X$defsymbol{'T'} = 112; $defsymbol{'Z'} = 113;
X$defsymbol{'Y'} = 114; $defsymbol{'X'} = 115;
X$defsymbol{'L'} = 116; $defsymbol{'M'} = 117;
X$defsymbol{'N'} = 118; $defsymbol{'O'} = 119;
X$defsymbol{'P'} = 120; $defsymbol{'Q'} = 121;
X$defsymbol{'R'} = 122; $defsymbol{'a'} = 123;
X$defsymbol{'b'} = 124; $defsymbol{'c'} = 125;
X$defsymbol{'d'} = 126; $defsymbol{'e'} = 127;
X}
X
Xsub validarg {
X	local($val) = @_;
X	$val = $defsymbol{$val} if ($val =~ /^[A-Za-z]/);
X	if ($val eq '') {
X		$error = "Undefined symbol -- 000 assumed.";
X		$val = "000";
X	} elsif ($val < 0 || $val > 127) {
X		$error = "Arg out of range -- taken mod 128.";
X		$val %= 128;
X	};
X	$val;
X}
X
Xsub asm {
X	local($_) = @_;
X	@byt = ();
X	$error = '';
X	/^\s*'([-+]?\d*\.?\d*([eE][-+]?\d*)?)'\s*(#.*)?$/ && do {
X		do numbytes($1);
X		unshift(byt,"000") if ++$lastnum;
X		return; };
X	$lastnum = $nulls;
X	/^\s*"(([^"]*\\")*.*)"\s*(#.*)?$/ && do {
X		do strbytes($1);
X		if ($#byt > 14) {
X			$error = "String too long -- truncated.";
X			$#byt = 14;
X		}
X		unshift(byt,do pad(241+$#byt));
X		return; };
X	/^\s*END\s*(#.*)?$/ && do {
X		@byt = ("192","000","009");
X		return; };
X	/^\s*XROM\s+(\d\d)\s+(\d\d)\s*(#.*)?$/ && do {
X		@byt = (do pad(160+($1/4)), do pad(64*($1%4)+$2));
X		return; };
X	/^\s*(STO|RCL|LBL)\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		($op,$val) = ($1,do validarg($2));
X		if (($op eq "LBL" && $val > 14) || $val > 15) {
X			@byt = ($twobyte{$op},do pad($val));
X		} elsif ($op eq "STO") {
X			@byt = (do pad(48+$val));
X		} elsif ($op eq "RCL") {
X			@byt = (do pad(32+$val));
X		} else { # $op = "LBL"
X			@byt = (do pad(1+$val));
X		};
X		return; };
X	/^\s*LBL\s+"(([^"]*\\")*.*)"\s*(#.*)?$/ && do {
X		do strbytes($1);
X		unshift(byt,"192","000",do pad(242+$#byt),"000");
X		return; };
X	/^\s*GTO\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		$val = do validarg($1);
X		if ($val > 14) {
X			@byt = ("208","000",do pad($val));
X		} else {
X			@byt = (do pad(177+$val),"000");
X		};
X		return; };
X	/^\s*GTO3\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		$val = do validarg($1);
X		@byt = ("208","000",do pad($val));
X		return; };
X	/^\s*XEQ\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		$val = do validarg($1);
X		@byt = ("224","000",do pad($val));
X		return; };
X	/^\s*(GTO|XEQ|W)\s+"(([^"]*\\")*.*)"\s*(#.*)?$/ && do {
X		$op = (($1 eq "GTO") ? "029" : ($1 eq "W") ? "031" : "030");
X		do strbytes($2);
X		unshift(byt,$op,do pad(241+$#byt));
X		return; };
X	/^\s*(GTO|XEQ)\s+IND\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		($op,$val) = ($1,do validarg($2));
X		@byt = ("174",do pad((($op eq "GTO")?0:128)+$val));
X		return; };
X	/^\s*BYTE\s+(\d+)\s*(#.*)?$/ && do {
X		@byt = (do pad($1 % 256));
X		return; };
X	/^\s*([^'"#\s]+)\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		$op = $twobyte{$1};
X		$val = do validarg($2);
X		unless ($op) {
X			$error .= "Undefined OP code -- RCL assumed.";
X			$op = "144";
X		};
X		@byt = ($twobyte{$1},do pad($val));
X		return; };
X	/^\s*([^'"#\s]+)\s+IND\s+([A-Za-z]\w*|\d+)\s*(#.*)?$/ && do {
X		$op = $twobyte{$1};
X		$val = do validarg($2);
X		unless ($op) {
X			$error .= "Undefined OP code -- RCL assumed.";
X			$op = "144";
X		};
X		@byt = ($op,do pad(128+$val));
X		return; };
X	/^\s*([^'"#\s]+)\s*(#.*)?$/ && do {
X		$op = $single{$1};
X		unless ($op) {
X		    $op = $xrom{$1};
X		    unless ($op) {
X			$error = "Undefined OP code -- NULL assumed.";
X			$op = "000";
X		    };
X		};
X		@byt = ($op);
X		return; };
X	$error = "Syntax error.";
X	$bytes = ''; # work around for join bug
X	@byt = ();
X}
EEE_OOO_FFF
echo x - asm41c
sed -e 's/^X//' >bar41c <<'EEE_OOO_FFF'
X#!/usr/local/bin/perl
X
X$width = 312;                   # 6.5i with 18pt bars (versitec)
X$script_name = ARGV[0];         # save script name
X
Xwhile ($_ = $ARGV[0], /^-/) {
X	shift;
X    last if /^--$/;
X	/^-w/ && do {           # specify output file
X		die "$script_name: no arg for -w"
X			unless ($ARGV[0]);
X		die "$script_name: -w arg not numeric"
X			unless ($ARGV[0] =~ /\d+/);
X		$width = shift;
X		next; };
X	/^-t/ && do {           # specify bytes tabs on barcode lines
X		++$tags;
X		next; };
X	#default
X	die "$script_name: unknown flag $_";
X}
X
X@bpn = (0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4); # bits in a nibble
X
Xwhile (<>) {
X	chop;
X	$line = $_;
X	/^title\s*(.*)$/ && do {        # title line
X		print '.Tl "'.$1.'"\n';
X		next; };
X	/^program(\s+private)?\s+(.*)$/ && do { # process program
X		do program($1,$2);
X		next; };
X	/^data\s+'([^']*)'\s*(.*)$/ && do { # numeric data
X		do data($1,$2);
X		next; };
X	/^string(\s+append)?\s*(.*)$/ && do { # string data
X		($append,$text) = ($1,$2);
X		$_ = <>;
X		die "$script_name: illformed data line at line $.\n"
X			unless (/^\d+(\s+\d+)*$/);
X		@byt = split;
X		unshift(@byt,($append?128:112)+$#byt+1);
X		do checksum(0);
X		do dumpbar($text,@byt);
X		next; };
X	/^bytes(\schecksum)?\s*(.*)$/ && do { # generic barcode data
X		($checksum,$text) = ($1,$2);
X		$_ = <>;
X		die "$script_name: illformed data line at line $.\n"
X			unless (/^\d+(\s+\d+)*$/);
X		@byt = split;
X		do checksum(0) if $checksum;
X		do dumpbar($text,@byt);
X		next; };
X	#default
X	die "$script_name: no directive at line $.\n";
X}
Xexit 0;
X
X#
X# end of main routine
X#
X
Xsub pad {
X	sprintf("%03d",pop(@_));        # pad number to 3 digits with zeros
X}
X
Xsub checksum {                          # compute checksum with arg
X	local($run) = @_;               # being running value and @byt
X	local($i);                      # being the array of bytes then
X	for $i (@byt) {                 # stuff check sum on front of byt
X		$run = $run + $i;
X		$run -= 255 if $run > 255;
X	}                               # checksum is sum mod 265 with end
X					# around carry
X	unshift(@byt,do pad($run));
X}
X
Xsub dumpbar {
X	local($i);
X	print '.Sb "'.shift(@_)."\"\n"; # start bar code line
X	for $i (@_) {
X		print ".By ".do pad($i)."\n"; # dump each byte
X	}
X	print ".Eb",(($tags)?" 1\n":"\n"); # end barcode line
X}
X
Xsub bytw {                              # width of byt array in bars
X	local($width,$i) = (9,0);       # start and stop bar overhead
X	for $i (@byt) {
X		$width += (16 + $bpn[int($byte/16)] + $bpn[$byte%16]);
X	}                               # narrow bar = 2, wide bar = 3
X	return $width;
X}
X
Xsub program {
X	local($private,$text) = @_;
X	print '.Pg "'.$text."\"\n";     # dump prog name
X	@values = ();                   # bytes of code
X	@inst_num = ();                 # 41c instruction numbers
X	@f_orphs = ();                  # leading orphan bytes
X	@b_orphs = ();                  # trailing orphan bytes
X	$inst_cnt = 0;
X	until ($_=<>,/^end/) {          # read in all of the program
X		++$inst_cnt;            # labeling each byte with
X		@byt = split;           # instruction number,
X		$b_orph = 0;            # leading and trailing
X		$f_orph = $#byt+2;      # orphan counts
X		for $_ (@byt) {
X			push(@value,$_);
X			push(@inst_num,$inst_cnt);
X			push(@b_orphs,((++$b_orph>$#byt)?0:$b_orph));
X			push(@f_orphs,(($f_orph-->$#byt+1)?0:$f_orph));
X		}
X	}
X	$seq_num = 0;                   # sequence numbers
X	$running = 0;                   # initial running checksum
X	$line_num = 1;                  # number of barcode lines
X	while($#value+1) {
X		$trial_length = ($#value < 12 ? $#value : 12);
X					# assume full line 13 bytes
X		$i = $#value;           # save length
X		$#value = $trial_length; # pretend that value is that long
X		@byt = @value;          # copy the front off
X		$#value = $1;           # set length back
X	    loop: {
X		    unshift(@byt, $seq_num+16*($private?2:1),
X					# add seq number and prog type ...
X			$f_orphs[0]*16+$b_orphs[$trial_length]);
X					# ... and orphan counts
X		    do checksum($running);
X					# compute checksum
X		    if (do bytw() > $width) {   # line to wide shorten by 1
X			shift(@byt),shift(@byt),shift(@byt);
X					# remove front stuff
X			pop(@byt);      # drop last byte
X			--$trial_length;
X			redo loop;      # and go put on new front stuff
X		    }
X		}
X		$text = sprintf("Line %d (%d - %d)",$line_num++,
X		    $inst_num[0],$inst_num[$trial_length]);
X					# barcode line label
X		do dumpbar($text,@byt); # generate *roff output
X		$running = shift(@byt); # save running checksum
X		for ($i=0; $i<$trial_length; ++$i) {
X		    shift(@value);      # remove this barcode lines
X		    shift(@inst_num);   # bytes and labels
X		    shift(@f_orphs);    # fron arrays
X		    shift(@b_orphs);
X		}
X		$seq_num = ($seq_num==15?0:++$seqnum);
X	}                               # inc seq num mod 16
X}
X
Xsub data {
X	local($_,$text) = @_;
X	@digits = split(/.*/);          # split into single chars
X	@nibbles = ();
X	for $_ (@digits) {              # build nibble array
X		/\d/ && (push(@nibbles,$_),next);
X		/\./ && (push(@nibbles,11),next);
X		/\+/ && (push(@nibbles,12),next);
X		/-/  && (push(@nibbles,13),next);
X		/[eE]/ && (push(@nibbles,14),next);
X		/./  &&
X		     die "$script_name: illformed numeric data at line $.\n";
X	}
X	push(@nibbles,10)    if ($#nibbles % 2);  # make number nibbles even
X	push(@nibbles,10,10) if ($#nibbles == 1); # must have at least 2 bytes
X	@byt = (96+shift(@nibbles));              # generate header
X	while ($#nibbles > 0) {
X		$_ = shift(@nibbles);             # combine nibbles into bytes
X		push(@byt,16*$_+shift(@nibbles));
X	}
X	do checksum(0);
X	do dumpbar($text,@byt);         # dump barcode line
X}
EEE_OOO_FFF
echo x - bar41c
test -d doc || mkdir doc
sed -e 's/^X//' >asm41c.l <<'EEE_OOO_FFF'{
X.TH ASM41C 1 "Sep  7,1988"
X.UC 4
X.SH NAME
Xasm41c \- HP 41c assembler
X.SH SYNOPSIS
X.B asm41c
X[
X.I options
X] [ name ]
X.SH DESCRIPTION
X.I Asm41c
Xassembles the named file, or the standard input if no file name is specified.
XA file suitable for processing by
X.B bar41c(1)
Xis produced.
XThe available flags are:
X.TP
X.B \-n
XSpecifies that all numbers in programs are to be proceded by a zero
Xbyte just as if the program had been entered via the 41c keyboard.
XThe default action of the assembler is to not include zero bytes before
Xnumbers unless they are necessary to separate two consecutive numbers.
X.TP
X.B \-r
XSpecifies that the routine names and XROM codes for the named rom are
Xloaded into the operator symbol table.
X.TP
X.B \-X
XSpecifies that the XROM codes for the 41CX should be loaded.
XThis is the same as specifing "\-r\ CXextfcn\ \-r\ CXtime"
X.TP
X.B \-I
XSpecifies that the XROM codes for the IL interface loop rom should be
Xloaded.
XThis is the same as specifing
X"\-r\ ILmass\ \-r\ ILprinter\ \-r\ ILcntl"
X.TP
X.B \-l
XSpecifies that a listing is to be produced on stdout.
XThe default is that error messages be produced on stderr.
X.TP
X.B \-t
XSpecifies the title to be used on listings and barcode output.
XThis may also be specified in the input using the ".title" directive.
X.TP
X.B -o
XSpecifies the output barcode file name.
XThe default is "bar.out".
X.bp
X.SH DIRECTIVES
XAn input file for the assembler consists of a sequence of directives
Xsome of which may be followed by a sequence of HP 41c assembler code.
XBlank lines and comments are ignored.
XComments are as in
X.B sh ,
Xthey start with a `#' character and continue to the end of the line.
X.PP
XThe directives are:
X.TP
X.B .rom \fR\fImodule
X.br
XThe entry points for the specifed rom are loaded into the operator
Xsymbol table.
XIf the file
X.I module.rom
Xis not found in the current directory, then a search is made of
Xthe default rom library directory "/usr/local/lib/hprom".
XThis directive has the same effect as the "-r" flag on the command
Xline.
XExample:
X.sp 1
X\&.rom wand
X.sp 1
XLoads the entry points for the barcode wand.
X.sp 1
XNote: if a rom module entry point has the same name as a builtin operator
Xthen the builtin operator will hide the rom entry point.
X.TP
X.B .xrom \fR\fIname romnum entry
X.br
X.I Name
Xis added to the operator symbol table as the rom module entry point
Xspecified by the two numeric arguments
X.I romnum
Xand
X.I entry .
XThe numeric argument are the same numbers displayed by the 41c
Xxrom operator when the rom module is not present in a 41c rom port.
XThis directive may be used to define single rom module entry points when
Xwhole rom is unneeded.
X.TP
X.B .title \fR\fItext
X.br
XAll of the text following on the line, but not including any comment,
Xis used on subsequent pages of the listing as the listing title.
XThis directive has the same effect as the "-t" flag on the command line.
X.TP
X.B .page
X.br
XCauses the start of a new page in the listing.
X.TP
X.B .define \fR\fIname value
X.br
XDefine a symbolic name for a register.
X.I Value
Xis either a number between 0 and 128 denoting a register or a previously
Xdefined symbol. (Values greater then 99 denote the internal registers
Xof the 41c and should only be used with care).
XThe simple alpha labels A-Ja-eTZYXL and the synthetic register labels
XMNOPQR (R being used instead of '|-') are predefined symbolic labels
Xand their definitions may be redefined using this directive.
X.TP
X.B .prog \fR\fI[private] name
X.br
XStart the assembly of a program named
X.I name .
Xthe optional keyword
X.I private
Xspecifices the barcode produced sould be for a private program
X(one that can not be listed by the 41c).
Xthe following lines in the input are take to be 41c assembly instructions
Xthat make up the program.
XThe program ends at the end of the input or at the first following directive.
XTHis means that and roms or defined symbols should be specified before the
Xstart of the program.
XSee the section below for a discription of the assembler instruction format.
X.TP
X.B .exec \fR\fItext
X.br
XThe following single line of 41c code is assembled and the barcode
Xoutput is set up for an executable barcode line.
XThe line of barcode is labeled with the text from the rest of the line.
X.TP
X.B .string \fR\fI[append] \"string\" text
X.br
XGenerate a string data barcode line labeled with the text.
XThe optional
X.I append
Xkeyword specifies that the string data is to be append on to the alpha
Xbuffer, otherwise the alpha buffer will be cleared when the barcode line
Xis read.
X.TP
X.B .data \fR\fI'number' text
X.br
XGenerate a numeric data barcode line labeled with the text.
X.TP
X.B .bytes \fR\fI[checksum] bytes... text
XGenerate a barcode line consisting of the specified decimal bytes
Xlabeled with the text.
XThe optional
X.I checksum
Xkeyword specifies that a checksum is to be computer and placed
Xat the front of the barcode line.
XThe directive can be used ot create arbitrary line of barcode such as the
Xone and two byte paper keyboard lines.
X.TP
X.B ".clear rom"
X.br
XDelete all the rom entry points from the symbol table.
X.TP
X.B ".clear names"
XDelete all the symbolic register names and restore the predefined
Xsymbolic names.
X.SH "ASSEMBLER CODES"
XAll the 41c assembler code are just as they are displayed on the 41c except
Xthat the greek sigma character has be replaced with the '~' character,
Xthe arrow character has been relaced with the '}' charecter,
Xthe not equal symbol has be replaced with the string '!=' and the
Xangle character has been replaced with the string 'ANG' in the one place
Xit was used so far (the advantage module).
X.PP
XStrings are enclosed in double quotes with the following escapes defined:
X.sp 1
X.nf
X\&      \e-      append character
X\&      \e=      not equals character
X\&      \eS      Sigma (also can use '~')
X\&      \eM      mu
X\&      \eL      angle
X\&      \eP      pi    (also can use '{')
X\&      \eA      arrow (also can use '}')
X\&      \eddd    decimal byte
X\&      \exhh    hex byte
X\&      \e"      double quote
X\&      \e\e      backslash
X.fi
X.ad l
X.PP
XNumber are enclosed in single quotes (this is a hack to make parsing
Xeasier).
XShort form numbers are allowed (e.g. 'E', '-E4' etc.)
X.PP
XThe indirect indicator IND must be in all caps
X.PP
XBecause some of the operators have both short and long forms
X(RCL STO GTO LBL),
Xthe operators RCL2, STO2, GTO3 and LBL2 have been defined to
Xforce the long form (RCL 0 assmebles to 032 while RCL2 0 assembles
Xto 144 000.)
XThe two spare two-byte operators are included as SPARE1 and SPARE2,
Xand the W string operator is defined (not that these actually do anything
Xusefull.)
XThere is the operator "XROM\ dd,dd" and a special operator "BYTE\ ddd" that
Xjust includes the value into the output.
X.SH FILES
X.ta 1.5i
X/usr/local/lib/hprom directory where rom library is kept
X\&.../builtins      file describing the builtin functions
X.br
X\&.../CXextfcn.rom  41CX builtin extended functions module
X.br
X\&.../CXtime.rom    41CX builtin time module
X.br
X\&.../ILcntl.rom    IL device control
X.br
X\&.../ILmass.rom    IL mass storage
X.br
X\&.../ILprinter.rom IL printer
X.br
X\&.../advantage.rom HP advantage module
X.br
X\&.../cardr.rom     card reader internal rom
X.br
X\&.../extfcn.rom    extended functions module
X.br
X\&.../games.rom     games rom
X.br
X\&.../math.rom      math rom
X.br
X\&.../ppc.rom       PPC club rom
X.br
X\&.../printer.rom   non-IL printer internal rom
X.br
X\&.../time.rom      time module
X.br
X\&.../wand.rom      barcode wand internal rom
X.br
Xbar.out           default barcode output file
X.SH SEE ALSO
Xbar41c(l)         barcode file to troff translator
X.br
XAuxiliary documentation:
X.in +.5i
X.br
X.I "HP-41c Owners Manual."
X.br
X.I "Creating Your Own HP-41 Bar Code Manual. 82153-90019"
X.br
X.I "HP-41 Synthetic Programming Made Easy"
Xby Keith Jarett.
X.in -.5i
X.SH AUTHORS
XMark A. Biggar
X.br
Xsdcrdcf!markb
X.br
Xmarkb@rdcf.sm.unisys.com
EEE_OOO_FFF
echo x - doc/asm41c.l
sed -e 's/^X//' >bar41c.l <<'EEE_OOO_FFF'
X.TH BAR41C 1 "Sep  7,1988"
X.UC 4
X.SH NAME
Xbar41c \- HP 41c barcode generator
X.SH SYNOPSIS
X.B bar41c
X[
X.I options
X]
X.SH DESCRIPTION
X.I Bar41c
Xis a filter that takes files like those produced by asm41c(1) and generates
X*roff macros to print the barcodes.
XThe available flags are:
X.TP
X.B \-w
XThe integer argument specifies the maximun width of a program barcode line
Xin narrow bar widths.
XValue is used to fill out the line of program barcode to a given width.
XThe default value of 312 is the equivlent to 6.5 inches using the versitec
Xmacro set.
XNarrow bars are half the width of wide bars and the spaces inbetween are
Xthe same width as the narrow bars.
XAs a line of barcode can not contain more then 16 bytes the maximum usefull
Xvalue for -w is 456 (16 bytes * 8 bits * 3 bars (width of wide bar + space)
X+ 9 (start and stop bars (3 narrow and 1 wide))).
X.TP
X.B \-t
XSpecifies that byte tags are to be generated.
XThe *roff macros will be called so that each byte in a line of barcode
Xis labeled with its value.
X.SH DIRECTIVES
XAn input file for bar41c consists of a sequence of directives
Xsome of which may be followed by a sequence of line of byte values.
X.PP
XThe directives are:
X.TP
X.B title /fR/fItext
XThe
X.I text
Xis used as the argument for the .Tl macro.
XThis directive has no other effect.
X.TP
X.B data \fR\fI'number' text
XA numeric data barcode line type 6 is produced with
X.I text
Xas the barcode line's label.
X.B string \fR\fI[append] text
XA string data barcode line is produced with
X.I text
Xas its label.
XIf the optional keyword
X.I append
Xis present then an append barcode line of type 8 is produced, otherwise
Xa normal string barcode line type 7 is produced.
XThe foolowing line in the input should be a single line of byte values
Xconsisting of the character values for the string data.
X.TP
X.B bytes \fR\fI[checksum] text
XA barcode line is produced using the following line of byte values
Xand using
X.I text
Xas the label.
XIf the optional keyword
X.I checksum
Xis present a checksum is first conputed and append on the front of the
Xlist of byte values.
XOnly the first 16 values (15 if a checksum is specified) are used,
Xothers are ignored.
X.TP
X.B program \fR\fI[private] name
XStart generating barcode line for the program
X.I name.
XThe following lines of byte values terminated by a line starting with
Xthe keyword "end" consist of the instructions for the program, one
Xinstruction per line (this is used to generate the instruction numbers
Xin the standard barcode line labels which look like "Line 1 (1 - 3)".)
XIf the optional keyword
X.I private
Xis used then program barcode line of type 2 (private) are produced,
Xotherwise type 1 is used.
X.SH FILES
X.ta 1.5i
Xtmac.vbar       macro file of Versitec raster printers
X.br
Xtmac.lwbar      macro file for Apple LaserWriter
X.SH SEE ALSO
Xasm41c(l)       Hp41c assembler
X.br
XAuxiliary documentation:
X.in +.5i
X.br
X.I "Creating Your Own HP-41 Bar Code Manual. 82153-90019"
X.in -.5i
X.SH BUGS
XThere is no provision made for the sequenced data barcode types
X(9, 10 & 11).
X.SH AUTHORS
XMark A. Biggar
X.br
Xsdcrdcf!markb
X.br
Xmarkb@rdcf.sm.unisys.com
EEE_OOO_FFF
echo x - doc/bar41c.l
test -d rom || mkdir rom
sed -e 's/^X//' >README <<'EEE_OOO_FFF'
XHow to build rom files:
X
Xrom file consist of line of perl script loading the $xrom associative
Xarray with the two bytes of assembled data coresponding to the
Xxrom call.  For example the file wand.rom looks like:
X
X$xrom{"WNDDTA"}  = "166 193";
X$xrom{"WNDDTX"}  = "166 194";
X$xrom{"WNDLNK"}  = "166 195";
X$xrom{"WNDSUB"}  = "166 196";
X$xrom{"WNDSCN"}  = "166 197";
X$xrom{"WNDTST"}  = "166 198";
X
XIn order to make generating these file easier a perl script is included
X(called trans) that will take files that look like:
X
XWNDDTA  27 1
XWNDDTX  27 2
XWNDLNK  27 3
XWNDSUB  27 4
XWNDSCN  27 5
XWNDTST  27 6
X
Xand generate a file like the above.  The numbers are the module number
Xand the routine number just as displayed by the HP 41c in the XROM op
Xwhen the module is not installed.
EEE_OOO_FFF
echo x - rom/README
sed -e 's/^X//' >builtins <<'EEE_OOO_FFF'
X$single{"NULL"}    = "000";
X$single{"+"}       = "064";
X$single{"-"}       = "065";
X$single{"*"}       = "066";
X$single{"/"}       = "067";
X$single{"X<Y?"}    = "068";
X$single{"X>Y?"}    = "069";
X$single{"X<=Y?"}   = "070";
X$single{"~+"}      = "071";
X$single{"~-"}      = "072";
X$single{"HMS+"}    = "073";
X$single{"HMS-"}    = "074";
X$single{"MOD"}     = "075";
X$single{"%"}       = "076";
X$single{"%CH"}     = "077";
X$single{"P}R"}     = "078";
X$single{"R}P"}     = "079";
X$single{"LN"}      = "080";
X$single{"X^2"}     = "081";
X$single{"SQRT"}    = "082";
X$single{"Y^X"}     = "083";
X$single{"CHS"}     = "084";
X$single{"E^X"}     = "085";
X$single{"LOG"}     = "086";
X$single{"10^X"}    = "087";
X$single{"E^X-1"}   = "088";
X$single{"SIN"}     = "089";
X$single{"COS"}     = "090";
X$single{"TAN"}     = "091";
X$single{"ASIN"}    = "092";
X$single{"ACOS"}    = "093";
X$single{"ATAN"}    = "094";
X$single{"}DEC"}    = "095";
X$single{"1/X"}     = "096";
X$single{"ABS"}     = "097";
X$single{"FACT"}    = "098";
X$single{"X!=0?"}   = "099";
X$single{"X>0?"}    = "100";
X$single{"LN1+X"}   = "101";
X$single{"X<0?"}    = "102";
X$single{"X=0?"}    = "103";
X$single{"INT"}     = "104";
X$single{"FRC"}     = "105";
X$single{"D}R"}     = "106";
X$single{"R}D"}     = "107";
X$single{"}HMS"}    = "108";
X$single{"}HR"}     = "109";
X$single{"RND"}     = "110";
X$single{"}OCT"}    = "111";
X$single{"CL+"}     = "112";
X$single{"X<>Y"}    = "113";
X$single{"PI"}      = "114";
X$single{"CLST"}    = "115";
X$single{"R^"}      = "116";
X$single{"RDN"}     = "117";
X$single{"LASTX"}   = "118";
X$single{"CLX"}     = "119";
X$single{"X=Y?"}    = "120";
X$single{"X!=Y?"}   = "121";
X$single{"SIGN"}    = "122";
X$single{"X<=0?"}   = "123";
X$single{"MEAN"}    = "124";
X$single{"SDEV"}    = "125";
X$single{"AVIEW"}   = "126";
X$single{"CLD"}     = "127";
X$single{"DEG"}     = "128";
X$single{"RAD"}     = "129";
X$single{"GRAD"}    = "130";
X$single{"ENTER^"}  = "131";
X$single{"STOP"}    = "132";
X$single{"RTN"}     = "133";
X$single{"BEEP"}    = "134";
X$single{"CLA"}     = "135";
X$single{"ASHF"}    = "136";
X$single{"PSE"}     = "137";
X$single{"CLRG"}    = "138";
X$single{"AOFF"}    = "139";
X$single{"AON"}     = "140";
X$single{"OFF"}     = "141";
X$single{"PROMPT"}  = "142";
X$single{"ADV"}     = "143";
X
X$twobyte{"RCL"}     = "144";
X$twobyte{"STO"}     = "145";
X$twobyte{"RCL2"}    = "144";
X$twobyte{"STO2"}    = "145";
X$twobyte{"ST+"}     = "146";
X$twobyte{"ST-"}     = "147";
X$twobyte{"ST*"}     = "148";
X$twobyte{"ST/"}     = "149";
X$twobyte{"ISG"}     = "150";
X$twobyte{"DSE"}     = "151";
X$twobyte{"VIEW"}    = "152";
X$twobyte{"~REG"}    = "153";
X$twobyte{"ASTO"}    = "154";
X$twobyte{"ARCL"}    = "155";
X$twobyte{"FIX"}     = "156";
X$twobyte{"SCI"}     = "157";
X$twobyte{"ENG"}     = "158";
X$twobyte{"TONE"}    = "159";
X$twobyte{"SF"}      = "168";
X$twobyte{"CF"}      = "169";
X$twobyte{"FS?C"}    = "170";
X$twobyte{"FC?C"}    = "171";
X$twobyte{"FS?"}     = "172";
X$twobyte{"FC?"}     = "173";
X$twobyte{"SPARE1"}  = "175";
X$twobyte{"SPARE2"}  = "176";
X$twobyte{"X<>"}     = "206";
X$twobyte{"LBL2"}    = "207";
EEE_OOO_FFF
echo x - rom/builtins
sed -e 's/^X//' >trans <<'EEE_OOO_FFF'
X#! /usr/local/bin/perl -i
X
Xwhile (<>) {
X	next if /^\s*#/;                # ignore comments
X	/([^ ]+) *([0-9]+) *([0-9]+)/;
X	print sprintf("%-16s = \"%03d %03d\";\n",
X			   "\$xrom{\"$1\"}", 160+($2/4), 64*($2%4)+$3);
X}
EEE_OOO_FFF
echo x - rom/trans
sed -e 's/^X//' >CXextfcn.rom <<'EEE_OOO_FFF'
X$xrom{"ALENG"}   = "166 065";
X$xrom{"ANUM"}    = "166 066";
X$xrom{"APPCHR"}  = "166 067";
X$xrom{"APPREC"}  = "166 068";
X$xrom{"ARCLREC"} = "166 069";
X$xrom{"AROT"}    = "166 070";
X$xrom{"ATOX"}    = "166 071";
X$xrom{"CLFL"}    = "166 072";
X$xrom{"CLKEYS"}  = "166 073";
X$xrom{"CRFLAS"}  = "166 074";
X$xrom{"CRFLD"}   = "166 075";
X$xrom{"DELCHR"}  = "166 076";
X$xrom{"DELREC"}  = "166 077";
X$xrom{"EMDIR"}   = "166 078";
X$xrom{"FLSIZE"}  = "166 079";
X$xrom{"GETAS"}   = "166 080";
X$xrom{"GETKEY"}  = "166 081";
X$xrom{"GETP"}    = "166 082";
X$xrom{"GETR"}    = "166 083";
X$xrom{"GETREC"}  = "166 084";
X$xrom{"GETRX"}   = "166 085";
X$xrom{"GETSUB"}  = "166 086";
X$xrom{"GETX"}    = "166 087";
X$xrom{"INSCHR"}  = "166 088";
X$xrom{"INSREC"}  = "166 089";
X$xrom{"PASN"}    = "166 090";
X$xrom{"PCLPS"}   = "166 091";
X$xrom{"POSA"}    = "166 092";
X$xrom{"POSFL"}   = "166 093";
X$xrom{"PSIZE"}   = "166 094";
X$xrom{"PURFL"}   = "166 095";
X$xrom{"RCLFLAG"} = "166 096";
X$xrom{"RCLPT"}   = "166 097";
X$xrom{"RCLPTA"}  = "166 098";
X$xrom{"REGMOVE"} = "166 099";
X$xrom{"REGSWAP"} = "166 100";
X$xrom{"SAVEAS"}  = "166 101";
X$xrom{"SAVEP"}   = "166 102";
X$xrom{"SAVER"}   = "166 103";
X$xrom{"SAVERX"}  = "166 104";
X$xrom{"SAVEX"}   = "166 105";
X$xrom{"SEEKPT"}  = "166 106";
X$xrom{"SEEKPTA"} = "166 107";
X$xrom{"SIZE?"}   = "166 108";
X$xrom{"STOFLAG"} = "166 109";
X$xrom{"X<>F"}    = "166 110";
X$xrom{"XTOA"}    = "166 111";
X$xrom{"ASROOM"}  = "166 113";
X$xrom{"CLRGX"}   = "166 114";
X$xrom{"ED"}      = "166 115";
X$xrom{"EMDIRX"}  = "166 116";
X$xrom{"EMROOM"}  = "166 117";
X$xrom{"GETKEYX"} = "166 118";
X$xrom{"RESZFL"}  = "166 119";
X$xrom{"~REG?"} = "166 120";
X$xrom{"X=NN?"}   = "166 121";
X$xrom{"X!=NN?"}  = "166 122";
X$xrom{"X<NN?"}   = "166 123";
X$xrom{"X<=NN?"}  = "166 124";
X$xrom{"X>NN?"}   = "166 125";
X$xrom{"X>=NN?"}  = "166 126";
EEE_OOO_FFF
echo x - rom/CXextfcn.rom
sed -e 's/^X//' >CXtime.rom <<'EEE_OOO_FFF'
X$xrom{"ADATE"}   = "166 129";
X$xrom{"ALMCAT"}  = "166 130";
X$xrom{"ALMNOW"}  = "166 131";
X$xrom{"ATIME"}   = "166 132";
X$xrom{"ATIME24"} = "166 133";
X$xrom{"CLK12"}   = "166 134";
X$xrom{"CLK24"}   = "166 135";
X$xrom{"CLKT"}    = "166 136";
X$xrom{"CLKTD"}   = "166 137";
X$xrom{"CLOCK"}   = "166 138";
X$xrom{"CORRECT"} = "166 139";
X$xrom{"DATE"}    = "166 140";
X$xrom{"DATE+"}   = "166 141";
X$xrom{"DDAYS"}   = "166 142";
X$xrom{"DMY"}     = "166 143";
X$xrom{"DOW"}     = "166 144";
X$xrom{"MDY"}     = "166 145";
X$xrom{"RCLAF"}   = "166 146";
X$xrom{"RCLSW"}   = "166 147";
X$xrom{"RUNSW"}   = "166 148";
X$xrom{"SETAF"}   = "166 149";
X$xrom{"SETDATE"} = "166 150";
X$xrom{"SETSW"}   = "166 151";
X$xrom{"STOPSW"}  = "166 152";
X$xrom{"SW"}      = "166 153";
X$xrom{"T+X"}     = "166 154";
X$xrom{"TIME"}    = "166 155";
X$xrom{"XYZALM"}  = "166 156";
X$xrom{"CLALMA"}  = "166 159";
X$xrom{"CLALMX"}  = "166 160";
X$xrom{"CLRALMS"} = "166 161";
X$xrom{"RCLALM"}  = "166 162";
X$xrom{"SWPT"}    = "166 163";
EEE_OOO_FFF
echo x - rom/CXtime.rom
sed -e 's/^X//' >ILcntl.rom <<'EEE_OOO_FFF'
X$xrom{"AUTOIO"}  = "167 027";
X$xrom{"FINDID"}  = "167 028";
X$xrom{"INA"}     = "167 029";
X$xrom{"IND"}     = "167 030";
X$xrom{"INSTAT"}  = "167 031";
X$xrom{"LISTEN"}  = "167 032";
X$xrom{"LOCAL"}   = "167 033";
X$xrom{"MANIO"}   = "167 034";
X$xrom{"OUTA"}    = "167 035";
X$xrom{"PWRDN"}   = "167 036";
X$xrom{"PWRUP"}   = "167 037";
X$xrom{"REMOTE"}  = "167 038";
X$xrom{"SELECT"}  = "167 039";
X$xrom{"STOPIO"}  = "167 040";
X$xrom{"TRIGGER"} = "167 041";
EEE_OOO_FFF
echo x - rom/ILcntl.rom
sed -e 's/^X//' >ILmass.rom <<'EEE_OOO_FFF'
X$xrom{"CREATE"}  = "167 001";
X$xrom{"DIR"}     = "167 002";
X$xrom{"NEWM"}    = "167 003";
X$xrom{"PURGE"}   = "167 004";
X$xrom{"READA"}   = "167 005";
X$xrom{"READK"}   = "167 006";
X$xrom{"READP"}   = "167 007";
X$xrom{"READR"}   = "167 008";
X$xrom{"READRX"}  = "167 009";
X$xrom{"READS"}   = "167 010";
X$xrom{"READSUB"} = "167 011";
X$xrom{"RENAME"}  = "167 012";
X$xrom{"SEC"}     = "167 013";
X$xrom{"SEEKR"}   = "167 014";
X$xrom{"UNSEC"}   = "167 015";
X$xrom{"VERIFY"}  = "167 016";
X$xrom{"WRTA"}    = "167 017";
X$xrom{"WRTK"}    = "167 018";
X$xrom{"WRTP"}    = "167 019";
X$xrom{"WRTPV"}   = "167 020";
X$xrom{"WRTR"}    = "167 021";
X$xrom{"WRTRX"}   = "167 022";
X$xrom{"WRTS"}    = "167 023";
X$xrom{"ZERO"}    = "167 024";
EEE_OOO_FFF
echo x - rom/ILmass.rom
sed -e 's/^X//' >ILprinter.rom <<'EEE_OOO_FFF'
X$xrom{"ACA"}     = "167 065";
X$xrom{"ACCHR"}   = "167 066";
X$xrom{"ACCOL"}   = "167 067";
X$xrom{"ACSPEC"}  = "167 068";
X$xrom{"ACX"}     = "167 069";
X$xrom{"BLDSPEC"} = "167 070";
X$xrom{"LIST"}    = "167 071";
X$xrom{"PRA"}     = "167 072";
X$xrom{"PRAXIS"}  = "167 073";
X$xrom{"PRBUF"}   = "167 074";
X$xrom{"PRFLAGS"} = "167 075";
X$xrom{"PRKEYS"}  = "167 076";
X$xrom{"PRP"}     = "167 077";
X$xrom{"PRPLOT"}  = "167 078";
X$xrom{"PRPLOTP"} = "167 079";
X$xrom{"PRREG"}   = "167 080";
X$xrom{"PRREGX"}  = "167 081";
X$xrom{"PR~"}     = "167 082";
X$xrom{"PRSTK"}   = "167 083";
X$xrom{"PRX"}     = "167 084";
X$xrom{"REGPLOT"} = "167 085";
X$xrom{"SKPCHR"}  = "167 086";
X$xrom{"SKPCOL"}  = "167 087";
X$xrom{"STKPLOT"} = "167 088";
X$xrom{"FMT"}     = "167 089";
EEE_OOO_FFF
echo x - rom/ILprinter.rom
sed -e 's/^X//' >advantage.rom <<'EEE_OOO_FFF'
X$xrom{"BININ"}   = "165 129";
X$xrom{"BINVIEW"} = "165 130";
X$xrom{"OCTIN"}   = "165 131";
X$xrom{"CVTVIEW"} = "165 132";
X$xrom{"HEXIN"}   = "165 133";
X$xrom{"HEXVIEW"} = "165 134";
X$xrom{"NOT"}     = "165 135";
X$xrom{"AND"}     = "165 136";
X$xrom{"OR"}      = "165 137";
X$xrom{"XOR"}     = "165 138";
X$xrom{"ROTXY"}   = "165 139";
X$xrom{"BIT?"}    = "165 140";
X$xrom{"C<>C"}    = "165 142";
X$xrom{"CMAXAB"}  = "165 143";
X$xrom{"CNRM"}    = "165 144";
X$xrom{"CSUM"}    = "165 145";
X$xrom{"DIM?"}    = "165 146";
X$xrom{"FNRM"}    = "165 147";
X$xrom{"I+"}      = "165 148";
X$xrom{"I-"}      = "165 149";
X$xrom{"J+"}      = "165 150";
X$xrom{"J-"}      = "165 151";
X$xrom{"M*M"}     = "165 152";
X$xrom{"MAT*"}    = "165 153";
X$xrom{"MAT+"}    = "165 154";
X$xrom{"MAT-"}    = "165 155";
X$xrom{"MAT/"}    = "165 156";
X$xrom{"MATDIM"}  = "165 157";
X$xrom{"MAX"}     = "165 158";
X$xrom{"MAXAB"}   = "165 159";
X$xrom{"MDET"}    = "165 160";
X$xrom{"MIN"}     = "165 161";
X$xrom{"MINV"}    = "165 162";
X$xrom{"MMOVE"}   = "165 163";
X$xrom{"MNAME?"}  = "165 164";
X$xrom{"MR"}      = "165 165";
X$xrom{"MRC+"}    = "165 166";
X$xrom{"MRC-"}    = "165 167";
X$xrom{"MRIJ"}    = "165 168";
X$xrom{"MRIJR"}   = "165 169";
X$xrom{"MRR+"}    = "165 170";
X$xrom{"MRR-"}    = "165 171";
X$xrom{"MS"}      = "165 172";
X$xrom{"MSC+"}    = "165 173";
X$xrom{"MSIJ"}    = "165 174";
X$xrom{"MSIJR"}   = "165 175";
X$xrom{"MSR+"}    = "165 176";
X$xrom{"MSWAP"}   = "165 177";
X$xrom{"MSVS"}    = "165 178";
X$xrom{"PIV"}     = "165 179";
X$xrom{"R<>R"}    = "165 180";
X$xrom{"R>R?"}    = "165 181";
X$xrom{"RMAXAB"}  = "165 182";
X$xrom{"RNRM"}    = "165 183";
X$xrom{"RSUM"}    = "165 184";
X$xrom{"SUM"}     = "165 185";
X$xrom{"SUMAB"}   = "165 186";
X$xrom{"TRNPS"}   = "165 187";
X$xrom{"YC+C"}    = "165 188";
X$xrom{"MEDIT"}   = "165 189";
X$xrom{"CMEDIT"}  = "165 190";
X$xrom{"MP"}      = "165 191";
X$xrom{"MATRX"}   = "165 192";
X$xrom{"MTR"}     = "166 001";
X$xrom{"SOLVE"}   = "166 003";
X$xrom{"INTEG"}   = "166 004";
X$xrom{"SILOOP"}  = "166 005";
X$xrom{"SIRIN"}   = "166 006";
X$xrom{"Z^N"}     = "166 007";
X$xrom{"MAGZ"}    = "166 008";
X$xrom{"e^Z"}     = "166 009";
X$xrom{"LNZ"}     = "166 010";
X$xrom{"Z^1/N"}   = "166 011";
X$xrom{"SINZ"}    = "166 012";
X$xrom{"COSZ"}    = "166 013";
X$xrom{"TANZ"}    = "166 014";
X$xrom{"a^Z"}     = "166 015";
X$xrom{"LOGZ"}    = "166 016";
X$xrom{"Z^1/W"}   = "166 017";
X$xrom{"Z^W"}     = "166 018";
X$xrom{"C+"}      = "166 019";
X$xrom{"C-"}      = "166 020";
X$xrom{"CINV"}    = "166 021";
X$xrom{"C*"}      = "166 022";
X$xrom{"C/"}      = "166 023";
X$xrom{"PLV"}     = "166 024";
X$xrom{"RIS"}     = "166 025";
X$xrom{"DIFEQ"}   = "166 026";
X$xrom{"CFIT"}    = "166 027";
X$xrom{"ASIG"}    = "166 028";
X$xrom{"DSIG"}    = "166 029";
X$xrom{"CFIT"}    = "166 030";
X$xrom{"FIT"}     = "166 031";
X$xrom{"Y?X"}     = "166 032";
X$xrom{"SZ?"}     = "166 033";
X$xrom{"VC"}      = "166 034";
X$xrom{"CROSS"}   = "166 035";
X$xrom{"VS"}      = "166 036";
X$xrom{"VR"}      = "166 037";
X$xrom{"DOT"}     = "166 038";
X$xrom{"VE"}      = "166 039";
X$xrom{"V-"}      = "166 040";
X$xrom{"V+"}      = "166 041";
X$xrom{"VXY"}     = "166 042";
X$xrom{"UV"}      = "166 043";
X$xrom{"VANG"}    = "166 044";
X$xrom{"VD"}      = "166 045";
X$xrom{"V*"}      = "166 046";
X$xrom{"TR"}      = "166 047";
X$xrom{"CT"}      = "166 048";
X$xrom{"AIP"}     = "166 049";
X$xrom{"TVM"}     = "166 051";
X$xrom{"N"}       = "166 052";
X$xrom{"PV"}      = "166 053";
X$xrom{"PMT"}     = "166 054";
X$xrom{"FV"}      = "166 055";
X$xrom{"*I"}      = "166 056";
EEE_OOO_FFF
echo x - rom/advantage.rom
sed -e 's/^X//' >cardr.rom <<'EEE_OOO_FFF'
X$xrom{"MRG"}     = "167 129";
X$xrom{"RDTA"}    = "167 130";
X$xrom{"RDTAX"}   = "167 131";
X$xrom{"RSUB"}    = "167 132";
X$xrom{"VER"}     = "167 133";
X$xrom{"WALL"}    = "167 134";
X$xrom{"WDTA"}    = "167 135";
X$xrom{"WDTAX"}   = "167 136";
X$xrom{"WPRV"}    = "167 137";
X$xrom{"WSTS"}    = "167 138";
EEE_OOO_FFF
echo x - rom/cardr.rom
sed -e 's/^X//' >extfcn.rom <<'EEE_OOO_FFF'
X$xrom{"ALENG"}   = "166 065";
X$xrom{"ANUM"}    = "166 066";
X$xrom{"APPCHR"}  = "166 067";
X$xrom{"APPREC"}  = "166 068";
X$xrom{"ARCLREC"} = "166 069";
X$xrom{"AROT"}    = "166 070";
X$xrom{"ATOX"}    = "166 071";
X$xrom{"CLFL"}    = "166 072";
X$xrom{"CLKEYS"}  = "166 073";
X$xrom{"CRFLAS"}  = "166 074";
X$xrom{"CRFLD"}   = "166 075";
X$xrom{"DELCHR"}  = "166 076";
X$xrom{"DELREC"}  = "166 077";
X$xrom{"EMDIR"}   = "166 078";
X$xrom{"FLSIZE"}  = "166 079";
X$xrom{"GETAS"}   = "166 080";
X$xrom{"GETKEY"}  = "166 081";
X$xrom{"GETP"}    = "166 082";
X$xrom{"GETR"}    = "166 083";
X$xrom{"GETREC"}  = "166 084";
X$xrom{"GETRX"}   = "166 085";
X$xrom{"GETSUB"}  = "166 086";
X$xrom{"GETX"}    = "166 087";
X$xrom{"INSCHR"}  = "166 088";
X$xrom{"INSREC"}  = "166 089";
X$xrom{"PASN"}    = "166 090";
X$xrom{"PCLPS"}   = "166 091";
X$xrom{"POSA"}    = "166 092";
X$xrom{"POSFL"}   = "166 093";
X$xrom{"PSIZE"}   = "166 094";
X$xrom{"PURFL"}   = "166 095";
X$xrom{"RCLFLAG"} = "166 096";
X$xrom{"RCLPT"}   = "166 097";
X$xrom{"RCLPTA"}  = "166 098";
X$xrom{"REGMOVE"} = "166 099";
X$xrom{"REGSWAP"} = "166 100";
X$xrom{"SAVEAS"}  = "166 101";
X$xrom{"SAVEP"}   = "166 102";
X$xrom{"SAVER"}   = "166 103";
X$xrom{"SAVERX"}  = "166 104";
X$xrom{"SAVEX"}   = "166 105";
X$xrom{"SEEKPT"}  = "166 106";
X$xrom{"SEEKPTA"} = "166 107";
X$xrom{"SIZE?"}   = "166 108";
X$xrom{"STOFLAG"} = "166 109";
X$xrom{"X<>F"}    = "166 110";
X$xrom{"XTOA"}    = "166 111";
EEE_OOO_FFF
echo x - rom/extfcn.rom
sed -e 's/^X//' >games.rom <<'EEE_OOO_FFF'
X$xrom{"BAGELS"}  = "162 129";
X$xrom{"BIOR"}    = "162 130";
X$xrom{"BIOF"}    = "162 131";
X$xrom{"CRAPS"}   = "162 132";
X$xrom{"HANG"}    = "162 133";
X$xrom{"PINBALL"} = "162 134";
X$xrom{"SWAR"}    = "162 135";
X$xrom{"SUBHUNT"} = "162 136";
X$xrom{"BOOM"}    = "162 137";
X$xrom{"INI"}     = "162 138";
X$xrom{"P"}       = "162 139";
X$xrom{"SIZE?"}   = "162 140";
X$xrom{"RNDM"}    = "162 141";
X$xrom{"RNDMW"}   = "162 142";
EEE_OOO_FFF
echo x - rom/games.rom
sed -e 's/^X//' >math.rom <<'EEE_OOO_FFF'
X$xrom{"MATRIX"}  = "160 065";
X$xrom{"SIMEQ"}   = "160 066";
X$xrom{"VCOL"}    = "160 067";
X$xrom{"VMAT"}    = "160 068";
X$xrom{"PVT"}     = "160 069";
X$xrom{"DET"}     = "160 070";
X$xrom{"INV"}     = "160 071";
X$xrom{"EDIT"}    = "160 072";
X$xrom{"SOLVE"}   = "160 073";
X$xrom{"SOL"}     = "160 074";
X$xrom{"POLY"}    = "160 075";
X$xrom{"ROOTS"}   = "160 076";
X$xrom{"INTG"}    = "160 077";
X$xrom{"DIFEQ"}   = "160 078";
X$xrom{"FOUR"}    = "160 079";
X$xrom{"C+"}      = "160 080";
X$xrom{"C-"}      = "160 081";
X$xrom{"C*"}      = "160 082";
X$xrom{"C/"}      = "160 083";
X$xrom{"MAGZ"}    = "160 084";
X$xrom{"CINV"}    = "160 085";
X$xrom{"Z^N"}     = "160 086";
X$xrom{"Z^1/N"}   = "160 087";
X$xrom{"E^Z"}     = "160 088";
X$xrom{"LNZ"}     = "160 089";
X$xrom{"A^Z"}     = "160 090";
X$xrom{"LOGZ"}    = "160 091";
X$xrom{"Z^W"}     = "160 092";
X$xrom{"Z^1/W"}   = "160 093";
X$xrom{"SINZ"}    = "160 094";
X$xrom{"COSZ"}    = "160 095";
X$xrom{"TANZ"}    = "160 096";
X$xrom{"SINH"}    = "160 097";
X$xrom{"COSH"}    = "160 098";
X$xrom{"TANH"}    = "160 099";
X$xrom{"ASINH"}   = "160 100";
X$xrom{"ACOSH"}   = "160 101";
X$xrom{"ATANH"}   = "160 102";
X$xrom{"SSS"}     = "160 103";
X$xrom{"ASA"}     = "160 104";
X$xrom{"SAA"}     = "160 105";
X$xrom{"SAS"}     = "160 106";
X$xrom{"SSA"}     = "160 107";
X$xrom{"TRANS"}   = "160 108";
X$xrom{"*FN"}     = "160 109";
EEE_OOO_FFF
echo x - rom/math.rom
sed -e 's/^X//' >ppc.rom <<'EEE_OOO_FFF'
X$xrom{"+K"}      = "162 131";
X$xrom{"-B"}      = "162 152";
X$xrom{"1K"}      = "162 130";
X$xrom{"2D"}      = "162 183";
X$xrom{"A?"}      = "162 138";
X$xrom{"AB"}      = "162 189";
X$xrom{"AD"}      = "162 146";
X$xrom{"AL"}      = "162 165";
X$xrom{"AM"}      = "165 053";
X$xrom{"BA"}      = "165 030";
X$xrom{"BC"}      = "165 043";
X$xrom{"BD"}      = "165 017";
X$xrom{"BE"}      = "165 034";
X$xrom{"BI"}      = "162 172";
X$xrom{"BL"}      = "162 170";
X$xrom{"BM"}      = "165 039";
X$xrom{"BR"}      = "165 040";
X$xrom{"B+"}      = "165 042";
X$xrom{"BV"}      = "165 007";
X$xrom{"BX"}      = "165 041";
X$xrom{"C?"}      = "162 144";
X$xrom{"CA"}      = "165 023";
X$xrom{"CB"}      = "162 178";
X$xrom{"CD"}      = "162 163";
X$xrom{"CJ"}      = "165 021";
X$xrom{"CK"}      = "162 134";
X$xrom{"CM"}      = "165 020";
X$xrom{"CP"}      = "165 027";
X$xrom{"CU"}      = "162 162";
X$xrom{"CV"}      = "165 008";
X$xrom{"CX"}      = "162 161";
X$xrom{"DC"}      = "162 139";
X$xrom{"DF"}      = "165 013";
X$xrom{"DP"}      = "162 181";
X$xrom{"DR"}      = "165 038";
X$xrom{"DS"}      = "162 157";
X$xrom{"DT"}      = "162 145";
X$xrom{"E?"}      = "162 190";
X$xrom{"EP"}      = "162 159";
X$xrom{"EX"}      = "162 155";
X$xrom{"F?"}      = "162 132";
X$xrom{"FD"}      = "165 011";
X$xrom{"FI"}      = "162 191";
X$xrom{"FL"}      = "162 171";
X$xrom{"FR"}      = "165 012";
X$xrom{"GE"}      = "162 188";
X$xrom{"GN"}      = "165 015";
X$xrom{"HA"}      = "165 025";
X$xrom{"HD"}      = "162 148";
X$xrom{"HN"}      = "162 169";
X$xrom{"HP"}      = "165 029";
X$xrom{"HS"}      = "165 026";
X$xrom{"IF"}      = "162 177";
X$xrom{"IG"}      = "165 009";
X$xrom{"IP"}      = "162 173";
X$xrom{"IR"}      = "165 037";
X$xrom{"JC"}      = "165 022";
X$xrom{"L-"}      = "162 151";
X$xrom{"LB"}      = "162 150";
X$xrom{"LF"}      = "162 133";
X$xrom{"LG"}      = "165 024";
X$xrom{"LR"}      = "165 002";
X$xrom{"M1"}      = "165 033";
X$xrom{"M2"}      = "165 031";
X$xrom{"M3"}      = "165 032";
X$xrom{"M4"}      = "165 035";
X$xrom{"M5"}      = "165 036";
X$xrom{"MA"}      = "165 054";
X$xrom{"MK"}      = "162 129";
X$xrom{"ML"}      = "162 140";
X$xrom{"MP"}      = "165 028";
X$xrom{"MS"}      = "162 176";
X$xrom{"MT"}      = "162 156";
X$xrom{"NC"}      = "162 166";
X$xrom{"NH"}      = "162 168";
X$xrom{"NP"}      = "165 014";
X$xrom{"NR"}      = "165 050";
X$xrom{"NS"}      = "165 049";
X$xrom{"OM"}      = "162 186";
X$xrom{"PA"}      = "162 187";
X$xrom{"PD"}      = "162 180";
X$xrom{"PK"}      = "162 137";
X$xrom{"PM"}      = "165 019";
X$xrom{"PO"}      = "165 051";
X$xrom{"PR"}      = "165 045";
X$xrom{"PS"}      = "162 174";
X$xrom{"QR"}      = "162 182";
X$xrom{"RB"}      = "165 052";
X$xrom{"RD"}      = "165 005";
X$xrom{"RF"}      = "162 141";
X$xrom{"RK"}      = "165 006";
X$xrom{"RN"}      = "165 016";
X$xrom{"RT"}      = "162 179";
X$xrom{"RX"}      = "162 185";
X$xrom{"S1"}      = "165 046";
X$xrom{"S2"}      = "165 048";
X$xrom{"S3"}      = "165 047";
X$xrom{"S?"}      = "162 143";
X$xrom{"SB"}      = "165 001";
X$xrom{"SD"}      = "165 003";
X$xrom{"SE"}      = "165 056";
X$xrom{"~?"}      = "162 142";
X$xrom{"~C"}      = "162 149";
X$xrom{"SK"}      = "165 004";
X$xrom{"SM"}      = "165 055";
X$xrom{"SR"}      = "165 000";
X$xrom{"SU"}      = "162 167";
X$xrom{"SV"}      = "165 010";
X$xrom{"SX"}      = "162 184";
X$xrom{"T1"}      = "162 175";
X$xrom{"TB"}      = "165 018";
X$xrom{"TN"}      = "162 160";
X$xrom{"UD"}      = "162 136";
X$xrom{"UG"}      = "165 044";
X$xrom{"VA"}      = "162 135";
X$xrom{"VF"}      = "165 058";
X$xrom{"VK"}      = "162 164";
X$xrom{"VM"}      = "162 154";
X$xrom{"VS"}      = "162 158";
X$xrom{"XD"}      = "162 153";
X$xrom{"XE"}      = "162 147";
X$xrom{"XL"}      = "165 057";
EEE_OOO_FFF
echo x - rom/ppc.rom
sed -e 's/^X//' >printer.rom <<'EEE_OOO_FFF'
X$xrom{"ACA"}     = "167 065";
X$xrom{"ACCHR"}   = "167 066";
X$xrom{"ACCOL"}   = "167 067";
X$xrom{"ACSPEC"}  = "167 068";
X$xrom{"ACX"}     = "167 069";
X$xrom{"BLDSPEC"} = "167 070";
X$xrom{"LIST"}    = "167 071";
X$xrom{"PRA"}     = "167 072";
X$xrom{"PRAXIS"}  = "167 073";
X$xrom{"PRBUF"}   = "167 074";
X$xrom{"PRFLAGS"} = "167 075";
X$xrom{"PRKEYS"}  = "167 076";
X$xrom{"PRP"}     = "167 077";
X$xrom{"PRPLOT"}  = "167 078";
X$xrom{"PRPLOTP"} = "167 079";
X$xrom{"PRREG"}   = "167 080";
X$xrom{"PRREGX"}  = "167 081";
X$xrom{"PR~"}     = "167 082";
X$xrom{"PRSTK"}   = "167 083";
X$xrom{"PRX"}     = "167 084";
X$xrom{"REGPLOT"} = "167 085";
X$xrom{"SKPCHR"}  = "167 086";
X$xrom{"SKPCOL"}  = "167 087";
X$xrom{"STKPLOT"} = "167 088";
EEE_OOO_FFF
echo x - rom/printer.rom
sed -e 's/^X//' >time.rom <<'EEE_OOO_FFF'
X$xrom{"ADATE"}   = "166 129";
X$xrom{"ALMCAT"}  = "166 130";
X$xrom{"ALMNOW"}  = "166 131";
X$xrom{"ATIME"}   = "166 132";
X$xrom{"ATIME24"} = "166 133";
X$xrom{"CLK12"}   = "166 134";
X$xrom{"CLK24"}   = "166 135";
X$xrom{"CLKT"}    = "166 136";
X$xrom{"CLKTD"}   = "166 137";
X$xrom{"CLOCK"}   = "166 138";
X$xrom{"CORRECT"} = "166 139";
X$xrom{"DATE"}    = "166 140";
X$xrom{"DATE+"}   = "166 141";
X$xrom{"DDAYS"}   = "166 142";
X$xrom{"DMY"}     = "166 143";
X$xrom{"DOW"}     = "166 144";
X$xrom{"MDY"}     = "166 145";
X$xrom{"RCLAF"}   = "166 146";
X$xrom{"RCLSW"}   = "166 147";
X$xrom{"RUNSW"}   = "166 148";
X$xrom{"SETAF"}   = "166 149";
X$xrom{"SETDATE"} = "166 150";
X$xrom{"SETSW"}   = "166 151";
X$xrom{"STOPSW"}  = "166 152";
X$xrom{"SW"}      = "166 153";
X$xrom{"T+X"}     = "166 154";
X$xrom{"TIME"}    = "166 155";
X$xrom{"XYZALM"}  = "166 156";
EEE_OOO_FFF
echo x - rom/time.rom
sed -e 's/^X//' >wand.rom <<'EEE_OOO_FFF'
X$xrom{"WNDDTA"}  = "166 193";
X$xrom{"WNDDTX"}  = "166 194";
X$xrom{"WNDLNK"}  = "166 195";
X$xrom{"WNDSUB"}  = "166 196";
X$xrom{"WNDSCN"}  = "166 197";
X$xrom{"WNDTST"}  = "166 198";
EEE_OOO_FFF
echo x - rom/wand.rom
test -d test || mkdir test
sed -e 's/^X//' >README <<'EEE_OOO_FFF'
XThese file were used to test the correct operation of the assembler.
XThey should be used to check out local changes you may make to the
Xperl scripts.  Every operator is checked.  See the comments at the
Xfront of each file of information on how to run each test.
EEE_OOO_FFF
echo x - test/README
sed -e 's/^X//' >numbers.test <<'EEE_OOO_FFF'
X# this test sould be run once with -n and once without
X# without -n the 000* should not be there
X.prog number-test
X'123456789'     # 000* 017 018 019 020 021
X		# 022 023 024 025
X'1.2'           # 000 017 026 018
X'1.2e2'         # 000 017 026 018 027 018
X'1.2E2'         # 000 017 026 018 027 018
X'-1.2e-2'       # 000 028 017 026 018 027
X		# 028 018
X+               # 064
X'E-10'          # 000* 027 028 017 016
X+               # 064
X'-E-1'          # 000* 028 027 028 017
X'E12'           # 000 028 027 018
X.data '1.234e-4' input value
EEE_OOO_FFF
echo x - test/numbers.test
sed -e 's/^X//' >rom.test <<'EEE_OOO_FFF'
X# note that this test needs to be invoked
X#   as "asm41c -X -r wand"
X.xrom foo 11 13
X.rom math
X.prog rom-test
XSWPT            # 166 163
XCLOCK           # 166 138
XWNDDTA          # 166 193
XC+              # 160 080
Xfoo             # 162 205
X.exec call foo
Xfoo
X.clear roms     # test of clear rom tables
X.exec call foo
Xfoo             # error & null = 000
EEE_OOO_FFF
echo x - test/rom.test
sed -e 's/^X//' >single.test <<'EEE_OOO_FFF'
X.prog single-test
XNULL    # 000
X+       # 064
X-       # 065
X*       # 066
X/       # 067
XX<Y?    # 068
XX>Y?    # 069
XX<=Y?   # 070
XSIG+    # 071
XSIG-    # 072
XHMS+    # 073
XHMS-    # 074
XMOD     # 075
X%       # 076
X%CH     # 077
XP->R    # 078
XR->P    # 079
XLN      # 080
X.title test new title
X.page   # sneak test of .page
X.prog private single-test2
XX^2     # 081
XSQRT    # 082
XY^X     # 083
XCHS     # 084
XE^X     # 085
XLOG     # 086
X10^X    # 087
XE^X-1   # 088
XSIN     # 089
XCOS     # 090
XTAN     # 091
XASIN    # 092
XACOS    # 093
XATAN    # 094
X->DEC   # 095
X1/X     # 096
XABS     # 097
XFACT    # 098
XX!=0?   # 099
XX>0?    # 100
XLN1+X   # 101
XX<0?    # 102
XX=0?    # 103
XINT     # 104
XFRC     # 105
XD->R    # 106
XR->D    # 107
X->HMS   # 108
X->HR    # 109
XRND     # 110
X->OCT   # 111
XCLSIG   # 112
XX<>Y    # 113
XPI      # 114
XCLST    # 115
XR^      # 116
XRDN     # 117
XLASTX   # 118
XCLX     # 119
XX=Y?    # 120
XX!=Y?   # 121
XSIGN    # 122
XX<=0?   # 123
XMEAN    # 124
XSDEV    # 125
XAVIEW   # 126
XCLD     # 127
XDEG     # 128
XRAD     # 129
XGRAD    # 130
XENTER^  # 131
XSTOP    # 132
XRTN     # 133
XBEEP    # 134
XCLA     # 135
XASHF    # 136
XPSE     # 137
XCLRG    # 138
XAOFF    # 139
XAON     # 140
XOFF     # 141
XPROMPT  # 142
XADV     # 143
XLBL 0   # 001
XLBL 7   # 008
XLBL 14  # 015
XSTO 0   # 048
XSTO 7   # 055
XSTO 15  # 063
XRCL 0   # 032
XRCL 7   # 039
XRCL 15  # 047
XBYTE 0  # 000
XBYTE 127 # 127
XBYTE 377 # 121
EEE_OOO_FFF
echo x - test/single.test
sed -e 's/^X//' >string.test <<'EEE_OOO_FFF'
X# test various thing with string args
X.prog string-test
X"abcdefg"               # 247 097 098 099 100 101
X			# 102 103
X"123456789012345"       # 255 049 050 051 052 053
X			# 054 055 056 057 048 049
X			# 050 051 052 053
X""                      # 240
X"12345678901234567890"  # trunc error
X			# 255 049 050 051 052 053
X			# 054 055 056 057 048 049
X			# 050 051 052 053
X"\000\001\127\255\128"  # 245 000 001 127 255 128
X"\x00\x01\x7f\xff\x80"  # 245 000 001 127 255 128
X"\-\=\S\M\L\P\A"        # 248 127 029 126 012 013
X			# 123 125
XLBL "abcde"             # 192 000 246 000 097 098
X			# 099 100 101
XGTO "abcde"             # 029 245 097 098 099 100
X			# 101
XXEQ "abcde"             # 030 245 097 098 099 100
X			# 101
XW "abcde"               # 031 245 097 098 099 100
X			# 101
X.string "abcdefg" test string
X			# 097 098 099 100 101 102
X			# 103
EEE_OOO_FFF
echo x - test/string.test
sed -e 's/^X//' >symbol.test <<'EEE_OOO_FFF'
X# test out predefined and user define symbols
X.prog symbol-test
XRCL A   # 144 102
XRCL B   # 144 103
XRCL C   # 144 104
XRCL D   # 144 105
XRCL E   # 144 106
XRCL F   # 144 107
XRCL G   # 144 108
XRCL H   # 144 109
XRCL I   # 144 110
XRCL J   # 144 111
XRCL T   # 144 112
XRCL Z   # 144 113
XRCL Y   # 144 114
XRCL X   # 144 115
XRCL L   # 144 116
XRCL M   # 144 117
XRCL N   # 144 118
XRCL O   # 144 119
XRCL P   # 144 120
XRCL Q   # 144 121
XRCL R   # 144 122
XRCL a   # 144 123
XRCL b   # 144 124
XRCL c   # 144 125
XRCL d   # 144 126
XRCL e   # 144 127
XRCL foo # error undefined symbol & 032
X.define foo 100
X.define bar 127
X.define gorf foo
X.prog symbol-test2
XRCL foo # 144 100
XRCL bar # 144 127
XRCL gorf # 144 100
X.clear names
X.prog symbol-test3
XRCL e   # 144 127
XRCL gorf # error undefined symbol & 032
X
EEE_OOO_FFF
echo x - test/symbol.test
sed -e 's/^X//' >three.test <<'EEE_OOO_FFF'
X# test out tree byte op codes
X.prog three-byte-test
XEND             # 192 000 009
XGTO 100         # 208 000 100
XGTO3 0          # 208 000 000
XXEQ 100         # 224 000 100
XXEQ 0           # 224 000 000
EEE_OOO_FFF
echo x - test/three.test
sed -e 's/^X//' >twobyte.test <<'EEE_OOO_FFF'
X# test out two byte op codes
X.prog   two-byte-test
XRCL     100     # 144 100
XSTO     100     # 145 100
XRCL2    0       # 144 000
XSTO2    0       # 145 000
XST+     0       # 146 000
XST-     0       # 147 000
XST*     0       # 148 000
XST/     0       # 149 000
XISG     0       # 150 000
XDSE     0       # 151 000
XVIEW    0       # 152 000
XSIGREG  0       # 153 000
XASTO    0       # 154 000
XARCL    0       # 155 000
XFIX     0       # 156 000
XSCI     0       # 157 000
XENG     0       # 158 000
XTONE    0       # 159 000
XSF      0       # 168 000
XCF      0       # 169 000
XFS?C    0       # 170 000
XFC?C    0       # 171 000
XFS?     0       # 172 000
XFC?     0       # 173 000
XSPARE1  0       # 175 000
XSPARE2  0       # 176 000
XX<>     0       # 206 000
XLBL2    0       # 207 000
XGTO     0       # 177 000
XGTO     7       # 184 000
XGTO     14      # 191 000
XGTO     IND 0   # 174 000
XXEQ     IND 0   # 174 128
XRCL     IND 0   # 144 128
XXROM    11 13   # 162 205
EEE_OOO_FFF
echo x - test/twobyte.test
sed -e 's/^X//' >test.41c <<'EEE_OOO_FFF'
X.prog test # comment
XLBL "A"
XENTER^
XLN
X+
XXEQ IND 000
XSTO M
XRTN
X"ABCDEFG"
X"\-\002hij"
X'-1.234e-8'
X
EEE_OOO_FFF
echo x - test/test.41c
test -d tmac || mkdir tmac
sed -e 's/^X//' >README <<'EEE_OOO_FFF'
XThe following macros are defined in the tmac.*bar files:
X
X.Sb "Label"
X
XStart a line of barcode labeled with Label (for programs this label usually
Xlooks something like "Line 1 (1 - 3)").  This macro automatically does a
X.ne directive to assure that the line of barcode, its label and tags if any
Xremain on the same page.
X
X.By Value
X
XEach byte of a line of barcode is specified by one of these macro calls.
XValue should be between 0 and 256 inclusive.
X
X.Eb [1]
X
XEnd a line of bar code. if the optional argument is non-zero then each
Xbyte of the line is taged with its value (in a tiny pointsize) just
Xbelow the bars
X
XThe following macro calls are generated but are not defined.
XSuitable definitions can be supplied by the user.
X
X.Tl "Title"
X
XEach asm41c .title directive (or -t flag) or bar41c title directive
Xgenerates this call.
X
X.Pg "Program Name"
X
XA call of this type is generated before the barcode for each
Xasm41c .prog or bar41c program directive.
X
XThe following macro, number or string register names are used in these
Xmacro definitions:
X
XAd B0 B1 B2 B3 B4 B5 B6 B7 Bb Bs Bt By Eb Fi Sb b0 b1
EEE_OOO_FFF
echo x - tmac/README
sed -e 's/^X//' >tmac.lwbar <<'EEE_OOO_FFF'
X.ds b0 \(bv\(bv   \"do not remove this comment
X.ds b1 \(bv\(bv\(bv\(bv   \"do not remove this comment
X.de Sb
X.ne 0.75i
X.nf
X.nr Bs \\n(.s
X.nr Ad \\n(.j
X.nr Fi \\n(.u
X.ps 8
X\\$1
X.sp 0.5v
X.ps 18
X.cs R 1
X\\*(b0\\*(b0\\c
X.cs R
X.rm Bt
X..
X.de By
X.ps 6
X.am Bt ..
X\\\\h'|\\n(.ku-\\\\n(.ku-1.1p'\(br \\$1\\\\c
X...
X.nr B7 (\\$1/128%2)
X.nr B6 (\\$1/64%2)
X.nr B5 (\\$1/32%2)
X.nr B4 (\\$1/16%2)
X.nr B3 (\\$1/8%2)
X.nr B2 (\\$1/4%2)
X.nr B1 (\\$1/2%2)
X.nr B0 (\\$1%2)
X.ps 18
X.cs R 1
X.di Bb
X\\\\*(b\\n(B7\\\\*(b\\n(B6\\\\*(b\\n(B5\\\\*(b\\n(B4\\\\c
X\\\\*(b\\n(B3\\\\*(b\\n(B2\\\\*(b\\n(B1\\\\*(b\\n(B0\\\\c
X.di
X.Bb
X.cs R
X..
X.de Eb
X.ps 18
X.cs R 1
X\*(b1\*(b0
X.cs R
X.ie '\\$1'1' \\{\\
X.ps 6
X.\".sp 0.05v
X.Bt
X.sp 0.1v
X'br \\}
X.el .sp 0.2v
X.ps \\n(Bs
X.if \\n(Fi .fi
X.ad \\n(Ad
X..
EEE_OOO_FFF
echo x - tmac/tmac.lwbar
sed -e 's/^X//' >tmac.vbar <<'EEE_OOO_FFF'
X.ds b0 \(bv \"do not remove this comment
X.ds b1 \(bv\(bv \"do not remove this comment
X.de Sb
X.ne 0.75i
X.nf
X.nr Bs \\n(.s
X.nr Ad \\n(.j
X.nr Fi \\n(.u
X.ps 8
X\\$1
X.sp 0.6v
X.ps 18
X.cs R 3
X\\*(b0\\*(b0\\c
X.cs R
X.rm Bt
X..
X.de By
X.ps 6
X.am Bt ..
X\\\\h'|\\n(.ku-\\\\n(.ku-1.5p'\(br \\$1\\\\c
X...
X.nr B7 (\\$1/128%2)
X.nr B6 (\\$1/64%2)
X.nr B5 (\\$1/32%2)
X.nr B4 (\\$1/16%2)
X.nr B3 (\\$1/8%2)
X.nr B2 (\\$1/4%2)
X.nr B1 (\\$1/2%2)
X.nr B0 (\\$1%2)
X.ps 18
X.cs R 3
X.di Bb
X\\\\*(b\\n(B7\\\\*(b\\n(B6\\\\*(b\\n(B5\\\\*(b\\n(B4\\\\c
X\\\\*(b\\n(B3\\\\*(b\\n(B2\\\\*(b\\n(B1\\\\*(b\\n(B0\\\\c
X.di
X.Bb
X.cs R
X..
X.de Eb
X.ps 18
X.cs R 3
X\*(b1\*(b0
X.cs R
X.ie '\\$1'1' \\{\\
X.ps 6
X.sp 0.05v
X.Bt
X.sp 0.1v
X'br \\}
X.el .sp 0.2v
X.ps \\n(Bs
X.if \\n(Fi .fi
X.ad \\n(Ad
X..
EEE_OOO_FFF
echo x - tmac/tmac.vbar
exit 0

--
Mark Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,akgua,sdcsvax}!sdcrdcf!markb
markb@rdcf.sm.unisys.com