% Last Update $Date: 1997/09/15 15:59:18 $
% Chee's homework assignment 1 for V22.0201, Fall 96

\documentstyle[12pt]{article}

\setlength{\textwidth}{6.in}
\setlength{\oddsidemargin}{.2in}
\setlength{\textheight}{9.5in}
\setlength{\headheight}{0in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.2in}
\setlength{\topmargin}{-.5in}

\newenvironment{tightlist}[1]{
\begin{list}{#1}{
\setlength{\topsep}{0in}
\setlength{\partopsep}{0in}
\setlength{\parsep}{0in}
\setlength{\parskip}{0in}
\setlength{\itemsep}{0in}
}
}{\end{list}}


\begin{document}
\pagestyle{empty}

\begin{center}
Fall 1997 Professor Yap\\
{\bf V22.0201.002 Machine Organization I}\\
{\bf Assignment 1}\\
{\bf Due:} Wednesday, September 24, 1997\\
\end{center}

\vspace{.1in}

\paragraph{INTRODUCTION}
Your assignment is to write an assembly language program that reads
a sequence of input characters and then echos the sequence in
the next line, and also prints the sequence in reverse in the
following line.  This assignment will familiarize you
with the turbo assembler and its computing environment.

\paragraph{DETAILS}
The overall assignment is worth 30 points.
Note that some instructions carry specific points.
E.g., You get 2 points just for giving your program
the suggested title.

\begin{itemize}
\item
	Make the title of your program ``MY\_ECHO, HW 1'' [2 points].
\item
	Your MY\_ECHO program is to first print any reasonable
	introduction message followed by the prompt ``{\tt >>}" [2 points].
	Note: prompts always begin on a new line.
\item
	Subsequently, MY\_ECHO reads a sequence of 16
	printable ASCII characters from the keyboard.
	You are not responsible if the user types more than
	16 characters.
\item
	Then MY\_ECHO echos the input (i.e., prints in the next
	line the string of 16 characters),
	and in the following line,
	MY\_ECHO prints the same string but in reverse order.
\end{itemize}

E.g. Here is a sample run:
	\begin{quotation}\tt
	\noindent
	:> myecho\\
	Welcome to the Echo Program\\
	>> \underline{0123456789ABCDEF}\\
	Here is your input: 0123456789ABCDEF\\
	Here is it's reverse: FEDCBA9876543210\\
	:>\\
	\end{quotation}
Here, {\tt :>} marks the DOS prompt, and {\tt >>} marks
your prompt.  The user input is shown underlined.

\paragraph{TO BE HANDED IN:}

\begin{tightlist}{$\bullet$}
\item   A printed copy of a well-commented program, which should
	include your identification (NAME AND NYU ID) at the top.
	[2 points]
\item    Two sample runs of your program [2 points].
%  done through the Turbo Debugger
%	(you can use the printscreen key for this)
\item    A 3.5'' disk containing the source file and
	an executable file.
	Put your name and class identification on the diskette.
	The source and executable files should be called (respectively)
	hw1.asm and myecho.exe. [2 points]
\item	Hand in everything in an envelop
	with your name on it [2 points].  As always,
	you are responsible to keep an extra copy of your work.
\end{tightlist}

\paragraph{NOTES AND HINTS}

\begin{tightlist}{$\bullet$}
\item
	You must read chapter 4 for this assignment.
\item
	The pseudo-operators {\tt EQU} and {\tt DUP} are
	useful.  [4 points if you use both of them]
\item
	Interrupt 21h, function 9 (p.~73) for printing
	a string is useful. 
\item
	The {\bf based addressing mode} as discussed in class
	is necessary.  E.g.,
	\begin{center}
		{\tt MOV [Input+BX],AL}
	\end{center}
	where {\tt Input} is a variable name.
	(If you really must, you may refer to p.181 for more details.)
\end{tightlist}

Before doing this exercise, we suggest that you
first try out the assembler.
Feel free to send me emails me know if you run into snags.
Use your favorite editor (e.g., Microsoft {\tt edit})
to input a small program from
our lectures or the book (e.g., PGM4\_2.ASM on page 74).
Then assemble, link and run it.  Details for assembling your program
and linking it are found chapter 4.9.  We recommend
that you do this under DOS rather than under Windows.
E.g., Say you are using the
Turbo Assembler and your program is in the file {\tt hw1.asm}:
\begin{tightlist}{}
\item {\tt :> tasm hw1} $\qquad\qquad$; this produces
	the object file {\tt hw1.obj}.
\item {\tt :> tlink hw1} $\qquad\qquad$; this converts {\tt hw1.obj}
	to {\tt hw1.exe}.  
\item {\tt :> mov hw1.exe myecho.exe}
\item {\tt :> myecho} $\qquad\qquad\qquad$;
		this executes the file {\tt myecho.exe}.
\item $\ldots$
\end{tightlist}

% {\bf EXTRA CREDIT}: Have your program do error checking for
% more than 20 characters.
% E.g., making the 20th input character to be {\tt CR}
% regardless of what the user types.  Note that there are
% no explicit points for extra credit work.  We
% will make a note of such work, to be used in case you are at the
% borderline between two grades.

\end{document}

