 \input notecomm		% common scientific-paper utilities
 \input manual.sty		% manual format

 \input sorspath
 \makeatletter
 \proofbox{\tsl{STEP \@title}\par\ttt{\sourcepath/\inputfilename}\par
%	Copyright \copyright~\number\year\ T. Toffoli\par
	\tbf{DRAFT}, \today
 }
 \makeatother

 \newcommand{\AR}{\tsl{Architecture Reference}}
 \newcommand{\HR}{\tsl{Hardware Reference}}
 \newcommand{\SR}{\tsl{Software Reference}}
 \newcommand{\CT}{\tsl{The \STEP\ Controller}}
 \newcommand{\CH}{\tsl{The \CHIP}}
 \newcommand{\FR}{\tsl{Fabrication Reference}}
 \newcommand{\DS}{\tsl{Data Sheets}}
 \newcommand{\UG}{\tsl{User's Guide}}

\newcommand{\SF}{StepForth}

\newcommand{\cam}{\tsc{step}}
\newcommand{\Cam}{\tsc{Step}}
\newcommand{\CAM}{STEP}			% for headings where \sc is bad
\newcommand{\STEP}{STEP}		% for headings where \sc is bad
\newcommand{\step}{\tsc{step}}
\newcommand{\Step}{\tsc{Step}}
\newcommand{\chip}{\tsc{step}chip}
\newcommand{\CHIP}{STEPchip}		% for headings where \sc is bad
%\newcommand{\cam}{\tsc{cam}8}
%\newcommand{\Cam}{\tsc{Cam}8}
%\newcommand{\STEP}{CAM8}		% for headings where \sc is bad
%\newcommand{\CAM}{CAM8}		% for headings where \sc is bad
%\newcommand{\step}{\tsc{cam}8}
%\newcommand{\Step}{\tsc{Cam}8}
%\newcommand{\chip}{\tsc{cam}8chip}
%\newcommand{\CHIP}{CAM8chip}		% for headings where \sc is bad

\newcommand{\die}{\tsc{cam} die}
\newcommand{\DIE}{CAM die}

\newcommand{\team}{team}
\newcommand{\ctrler}{controller}	% to be phased out !

\newcommand{\steplist}{steplist}
\newcommand{\dram}{{\sc dram}}
\newcommand{\Dram}{{\sc Dram}}
\newcommand{\sram}{{\sc sram}}
\newcommand{\Sram}{{\sc Sram}}
\newcommand{\io}{{\sc i/o}}
\newcommand{\vlsi}{{\sc vlsi}}
\newcommand{\lut}{{\sc lut}}
\newcommand{\crt}{{\sc crt}}

\newcommand{\vtab}{VTab}
\newcommand{\htab}{HTab}
\newcommand{\vsync}{VSync}
\newcommand{\hsync}{HSync}

\newcommand{\bus}{CBus}
\newcommand{\sbus}{SBus}
\newcommand{\sparcstation}{{\sc sparc}station}
\newcommand{\sun}{{\sc sun}}
\newcommand{\vga}{{\sc vga}}
\newcommand{\unix}{{\sc unix}}
\newcommand{\cpu}{{\sc cpu}}
\newcommand{\forth}{{\sc forth}}
\newcommand{\ioctl}{{\tt ioctl}}

\newcommand{\ntsc}{\tsc{ntsc}}
\newcommand{\pal}{\tsc{pal}}
\newcommand{\rgb}{\tsc{rgb}}

% ======================== COVER ===============================

\def\stepcover#1#2{%	#1=title #2=figure
 \thispagestyle{empty}
 \onecolumn
 \begin{flushright}
 	{\Large\sf Norman Margolus\\ Tommaso Toffoli\par}
	\vfill
	{\LARGE \sf STEP: a SpaceTime Event Processor\par}
	\vfill
	{\Huge \sf #1\par}
	\medskip
	{\count0=\year\advance\count0-1993\xdef\version{\number\count0}}
	{\Large \tt (version \version.\number\month.\number\day)\par}
	\vfill
	$\null$%
	\def\@tempa{#2}\ifx\@tempa\@empty\framebox[5in]{\vrule height 5in}\else
					 \psfig{file=#2,width=5in}\fi
	 \vfill
	{\Large MIT Laboratory for Computer Science \\Cambridge, MA 02139\par}
	\vfill
	{\small Copyright \copyright\ 1993, 1994, 1995
		 by Norman Margolus and Tommaso Toffoli\par}
 \end{flushright}
 \twocolumn
 \newpage	% redundant, since forced by \twocolumn
}



% ========================= DATA SHEETS ================

% A table of sheets (tosx) is a table of contents of a bunch of data sheets or
% similar material collected in an appendix, and appears in the appendix right 
% before the data sheets themeselves.
% Each data sheet is distingushed by a caption, which appears in the
% table of contents (where it may be accompanied by a comment).
% Page numbering is expected to start afresh with each data sheet (which
% may consist of several pages).
% Typically, the data sheets are arranged in alphabetical order by caption;
% the latter (together with the sheet page number in brackets) will replace the
% traditional page number.

 % ================ NEWER MACROS ================
 \newcounter{sheetbasepage}
 \newcounter{sheetpage}
 \newif\ifmultipage
 \newdimen\ttcharwidth{\setbox0=\hbox{\small\tt M}\global\ttcharwidth=\wd0}

 \def\thesheetpage{%
	\setcounter{sheetpage}{\value{page}}%
	\addtocounter{sheetpage}{-\value{sheetbasepage}}%
	\addtocounter{sheetpage}{1}%
	\ifmultipage[\arabic{sheetpage}]\fi
 }
 \makeatletter
 \newcommand{\ps@sheet}{
	\renewcommand{\@oddhead}{%
		\hfill{\sl\majcapt}\hfill{\tt\mincapt}\quad\thesheetpage}
	\renewcommand{\@evenhead}{%
		\thesheetpage\quad{\tt\mincapt}\hfill{\sl\majcapt}\hfill}
	\renewcommand{\@oddfoot}{}\renewcommand{\@evenfoot}{}
 }
 \def\tableofsheets#1{%		name of data sheet tocs
	\def\newsheet##1{%		#1=sheet caption
		\onecolumn
		\setcounter{sheetbasepage}{\value{page}}
		\multipagefalse
		\pagestyle{sheet}
		\def\mincapt{##1}
		\addtocontents{#1}{\vskip\z@\noindent\quad\ttt{##1}}
	}
	\def\sheetcomment##1{%		#1=sheet comment
		\addtocontents{#1}{\if @##1@\else\quad(##1)\fi}
	}
	\def\sheetgroup##1{%		#1=sheet-group caption
		\addtocontents{#1}{\vskip.5ex\noindent\tbf{##1}}
		\def\majcapt{##1}
	}
        \@starttoc{#1}
 }
 \makeatother

 \def\flushpage{{\clearpage\pagestyle{empty}\cleardoublepage}}

 \newcommand{\single}[2]{%	#1=caption #2=contents
	\newsheet{#1}
	\vbox to\textheight{\vfill\hbox to\textwidth{\hfill#2\hfill}\vfill}
	\eject
 }
 \def\PSsingle#1#2{%	#1=caption #2=file
	\single{#1}{\epsfig{file=#2}}
 }
 \def\TeXsingle#1#2{%	#1=caption #2=file
	\single{#1}{\input{#2.tex}}}
 \def\verbsingle#1#2#3{%	#1=caption #2=file #3=linelength(in chars)
	\single{#1}{\begin{minipage}{#3\ttcharwidth}\small
		\verbatimtabinput{#2}\end{minipage}}%
 }

 % verbatim text roll to be cut into pages and numbered page-by-page
 \def\verbcutroll#1#2{%		#1=caption #2=file
	\newsheet{#1}
	\multipagetrue
	{\small\verbatimtabinput{#2}}
	\ifnum\value{page}=\value{sheetbasepage}\multipagefalse\fi
	\newpage
 }

 \makeatletter

 % print a (possibly multipage) device datasheet
 \def\device#1#2#3#4{%	#1=caption, #2=file name, #3=comment, #4=#of pages
	\newsheet{#1}\sheetcomment{#3}
	\ifnum#4>1\relax\multipagetrue\else\multipagefalse\fi
	\def\filebasename{#2}
	\setcounter{sheetpage}{0}
	\def\sheetpagecount{#4}
}

\def\path#1{\def\p@th{#1}}
\def\dodevice{\message{[\mincapt]}
	\loop\ifnum\value{sheetpage}<\sheetpagecount
	\addtocounter{sheetpage}{1}
	\vbox to\textheight{\vfill\hbox to\textwidth{\hfill
        \epsfig{file=\p@th/\filebasename.\arabic{sheetpage}.ps,width=6.5in}%
	\hfill}\vfill}
	\eject\repeat
}

 \def\inlinedevice#1#2#3#4{\device{#1}{#2}{#3}{#4}\dodevice}
 \def\includedevice#1#2#3#4{\device{#1}{#2}{#3}{#4}\include{+\filebasename}}
 % typically, the included file will contain just \dodevice

 \makeatother

%----------------------------------------------------------------
\endinput

\def\frame{\hbox to\textwidth{\vrule height 647.73pt}}	% max available


 \def\dataheader#1#2#3{%	#1=major caption #2=minor caption #3=thesheetpage
	\renewcommand{\@oddhead}{\hfill{\sl#1}\hfill{\tt#2}\quad#3}
	\renewcommand{\@evenhead}{#3\quad{\tt#2}\hfill{\sl#1}\hfill}
	\setcounter{sheetpage}{0}
}



