head	1.6;
access;
symbols;
locks
	yap:1.6; strict;
comment	@# @;


1.6
date	97.10.28.14.59.10;	author yap;	state Exp;
branches;
next	1.5;

1.5
date	97.10.06.17.46.53;	author yap;	state Exp;
branches;
next	1.4;

1.4
date	97.10.06.17.38.40;	author yap;	state Exp;
branches;
next	1.3;

1.3
date	97.10.01.17.56.32;	author yap;	state Exp;
branches;
next	1.2;

1.2
date	97.09.30.17.49.29;	author yap;	state Exp;
branches;
next	1.1;

1.1
date	97.09.26.21.23.58;	author yap;	state Exp;
branches;
next	;


desc
@@


1.6
log
@*** empty log message ***
@
text
@<html>
<title>
	DEBUGGER NOTES: V22.0201.002 (Fall 97)
</title>
<body bgcolor=ffffff>

<center>
        <h3><font color=aa0000>
        V22.0201.002, Machine Organization I, Fall 97
        </font> </h3>
        <h2><font color=aa00ff>
	HOW TO USE THE DEBUGGER
        </font>
        </h2>
</center>
<hr>


<a name=top>
CONTENTS
</a>
<ul>
<li>
	<a href=#intro>
	Introduction
	</a>
<li>
	<a href=#predb>
	Pre-Debugger: Syntax Errors
	</a>
<li>
	<a href=#db>
	The Debugger
	</a>
<li>
	<a href=#how>
	How to Debug
	</a>
<li>
	<a href=#mech>
	Mechanics of Using TD
	</a>
<li>
	<a href=#menus>
	Some Pulldown Menus
	</a>
<li>
	<a href=#bkpt>
	Breakpoints
	</a>
<li>
	<a href=#cpu>
	CPU Window
	</a>
<li>
	<a href=#clip>
	Clipboard Facilities
	</a>
<li>
	<a href=#bot>
	Bottom of page
	</a>
</ul>

<p>
<hr size=4>
<p>

<a name=intro>
<h3><font color=ff0000>Introduction</font></h3>
</a>

Here is basic information for using a debugger.
We will be using the Turbo Debugger.  Since
this is a fairly complex piece of software,
we will help you with some orientation
information below.
Actually, there are 3 versions of the Turbo Debugger:
<center>
	<b>TD, TDW</b> and <b>TD32</b>.
</center>
(You can find them under the TASM folder.)
TD is for 16-bit DOS applications while
TDW and TD32 are for 16-bit and 32-bit windows applications.
For this course, you only need to use TD.  This
is what we assume here.  But TD only
works from a DOS environment.  That means that you need to
invoke TD from within
an <b>MS-DOS PROMPT window</b> (see FAQs for this).
<p>
Note that MS-DOS provides an extremely simple debugger
called <b>DEBUG</b>.  You might find it useful to learn
this simple debugger as well (the information on this is in
chapter 5 and Appendix E of your text).

<a name=predb>
<h3><font color=ff0000>
Pre-Debugger: Syntax Errors
</font></h3>
</a>

Before we even approach the debugger, let us address
a class of errors for which it is an overkill
to use the debugger: that is when you do not
even succeed in assembling your program!  No object
file could be produced.  These
are basically <b>syntax errors</b>.
<p>
The fix here is basically trivial.
First note that if you invoke
``tasm hw1'', it will report the line numbers of
each instruction that has a syntax error.
All you need to do is to address
the problems, one offending line at a time!  
<b>HINT:</b>
To ask tasm to print out the actual offending instructions,
not just their line numbers, do this instead:
	<center>
	<table>
	<tr align=left>
	<th bgcolor=aaeeee align=left>
		<pre>

:&gt; tasm /z hw1 </pre></th></tr>
	</table>
	</center>

<a name=db>
<h3><font color=ff0000>
The Debugger
</font></h3>
</a>

Where does the debugger come in?  Well, to debug errors
that has to do with the <b>logic</b> of your program.
These are sometimes called <b>semantic errors</b>
as opposed to the ``syntax errors'' in the previous paragraph.
Of course, you can still avoid using a debugger for
small programs.  When your programs become complex
the debugger may be essential.
<p>
The first thing to realize is that in order to use
the debugger, your assembler and linker needs
to store certain additional information needed by
the debugger.  E.g., if you define the variable
        <center>
        <table>
        <tr align=left>
        <th bgcolor=aaeeee align=left>
                <pre>

Greeting db 'Hello, World!'
        </table> 
        </center>

then your .obj and .exe files
needs to retain the symbolic information
telling the debugger that data at offset ABCD0123h (or whatever)
is the same as "Greeting".  As the human
user, you prefer to see the symbolic name
"Greeting" rather than "ABCD0123h".  To do this, such
``symbolic information'' that are normally discarded by TASM needs
to be recorded in the object file it produces.
This can be done by calling TASM
and TLINK with the options /zi and /v (respectively).
Here is a slight revision of the ``First Steps'' instructions
used in the <a href="tasm.htm">TASM notes</a>:
        <center>
        <table>
        <tr align=left>
        <th bgcolor=aaeeee align=left>
                <pre>

:&gt; tasm /zi /z hw1
:&gt; tlink /v hw1
:&gt; td hw1
</pre></th></tr>
        </table> 
        </center>

Note that the resulting .obj and .exe
files with these options are bigger than they otherwise would be. 
To see other command options available with tasm or tlink,
you can invoke "tasm" or "tlink" without any arguments.
 
<a name=how>
<h3><font color=ff0000>
How to Debug
</font></h3>
</a>
There are 4 basic steps:
	<ol>
	<li> <b>Discovering the Bug.</b>  Is there one?
		It is not always obvious that you have a bug. (WHY?)
	<li> <b>Isolating the Bug.</b>  Where is it?
		Locate the part(s) of the
		code that is causing the bug.
	<li> <b>Finding the Bug.</b>  What exactly is wrong with
		the buggy code fragment?
	<li> <b>Fixing the Bug.</b>  How should the buggy fragment be
		rewritten?
	</ol>
The debugger gives you tools to help in all these steps.
E.g., you can run the code in a step-by-step fashion or until
some <b>breakpoint</b> you set in the code.  In between these
execution steps, you can examine memory and CPU state
(variables, registers, flags and stack).

<a name=mech>
<h3><font color=ff0000>
Mechanics of Using TD
</font></h3>
</a>

NOTE: It is best to print a copy of this and read it
while seated in front of the Turbo Debugger
(say, with your hw1 program loaded, using the
method suggested above).

<p><b>Overview</b>
The Main TD window shows a standard (pull-down) <b>menu bar</b> at the top.
The menu bar lists the following menus:
<b>File, Edit, View, Run, Breakpoints, Data, Options, Windows, Help</b>.
The <b>status bar</b> at the bottom of the
TD window contains helpful information about the
current context.  For instance, you often see
a list of all the functions
associated with the function keys <b>F1</b> to <b>F10</b>.
For instance, F9 is the ``Run'' command.
That means these functions are available in the current context.

<p><b>TD Windows</b>
Within the Main TD window we can
have a variety of (sub)windows.  At any moment,
several of these windows may be <b>active</b>.  Each
active windows is numbered (1,2,3, etc.) and this
number is displayed on the upper right hand corner of window.
Below, we will go into some of these windows and discuss how
to manage them.  Among the active windows, one of them is
the current <b>top window</b>.  The top window has a little green
rectangle at its upper left corner.  You can close this
window by clicking on this little green rectangle.

<p><b>Exercise 1</b>
The function key <b>F6</b>
(called ``Next'') steps through your
active windows, allowing each
of them to be ``top window'' in turn.
Try stepping through your windows: how
many windows do you have at this point?
What is the current number of active windows?
How is the ``top window'' indicated?

<p><b>Online Help</b>
We already mentioned the Help (pulldown) menu.  But
there are more ``immediate'' or context-sensitive
help available:
	<ol>
	<li><b>Status Bar</b>
	We noted that status bar usually shows the list of functions associated with
	the 10 function keys.  But if you hold down the
	ALT key, the status bar will show the functions associated
	with ALT+Function Keys.
<br><font color=fa00fa size=-1>
	[E.g., ALT+F5 is the ``User'' Function.
	Try this!  This just gets you back to the MS-DOS Prompt Window.
	This is useful if you need to see any output from your
	executed code.  To get back from the MS-DOS Prompt, type
	any key.
	]
<br></font>
	If you hold down the CTRL key, you will see the CTRL+key
	functions.
<br><font color=fa00fa size=-1>
	[E.g., CTRL+I allows you to inspect the variable that
	the cursor is currently pointed at.]
<br></font>
	<li><b>Function F1</b>
	This key opens a help window containing information
	about the current top window, with further subtopics 
	to choose from.
	<li><b>SpeedMenu</b>
	This can be invoked with the right mouse click at any time.
	In most windows, you will get a list of options
	suitable for that window.
	</ol>	

<a name=menus>
<h3><font color=ff0000>
Some Pulldown Menus
</font></h3>
</a>

Let us go over some of the pulldown menus:
 
<p><b>VIEW pulldown menu</b><br>
	The types of windows available are listed under the VIEW menu.
	We describe three of them here:
	<ol>
	<li> <b>Module Window</b> This is usually the first
		window you see, and is number 1.  It shows
		your source code, and so may appear the most
		familiar to you (after all, you wrote that code!).
	<li> <b>Watch Window</b> This is usually the second
		window you see, and thus is number 2.  You can
		set up variables and expressions in this window
		to ``watch'' (their values change as your program
		is executed).
		In fact, exercise 1, you probably saw the Module
		and Watch Windows (the watch window
		is quite narrow, and you may miss it). 

	<li> <a name=cpu-sum>
		<b>CPU Window</b>
		</a> This window is most useful for
		assembly language programming (i.e., for this course!)
		as it shows the state of your CPU.
		At the top bar of this
		window, it will tell you the CPU class
		(486, Pentium, etc) of the current machine.
		This window is partitioned
		into 5 smaller display regions called <b>panes</b>:
		<ul>
		<li> <b>Code pane</b>:
			this pane on the top left is the largest,
			showing the machine code and disassembled assembly
			instructions of your executable program.
			(Source code lines can also be displayed.)
		<li> <b>Registers pane</b>:
			this pane is to the right of the
			code pane.
		<li> <b>Flags pane</b>:
			this pane is to the right of the
			registers pane, showing the 8 CPU flag bits.
		<li> <b>Dump pane</b>:
			This is directly below the code pane,
			showing the hex dump of any memory
			area accessible by your program.
		<li> <b>Stack pane</b>:
			this is on the bottom right, showing the
			contents of the program stack (in hex)
		</ul>
		For more details, see <a href=#cpu>CPU Window</a>
		below.
	</ol>

<p><b>Exercise 2</b>
	Write a simple program with these instructions (in addition to
	the usual stuff): 
        <center>
        <table>
        <tr align=left>
        <th bgcolor=aaeeee align=left>
        <pre>

mov ax,0ffffh
mov bx,8000h
neg bx
add ax,bx </pre></th></tr>
        </table> 
        </center>

	Now load the program into TD, and call up the CPU Window
	(in addition to the default Module and Watches Windows).
	Now step through the execution of the program using F7.
	After each step, describe the contents of ax and bx,
	and the status flag variables.

<p><b>WINDOW pulldown menu</b><br>
	This menu helps you manage the various windows.
	This menu is divided into two halves (separated
	by a horizontal line): the top half contains
	commands such as
	<b>Zoom</b> (=F5),
	<b>Next</b> (=F6),
	<b>Next pane</b> (=tab),
	etc.
	The bottom half is
	a list of the currently active windows.
<p><b>RUN pulldown menu</b><br>
	Windows are for watching.  But for action, you need
	to execute your code.  For this, the
	RUN menu provides several modes of execution:
	<ol>
	<li> <b>Run (=F9)</b>,
		i.e., until program terminates
		(or until the next <a href=#bkpt>breakpoint</a>).
		This is the simplest mode.
	<li> <b>Trace into (=F7 or ALT+F7)</b>,
		i.e., single stepping, instruction by instruction.
		What constitutes a single step depends on
		which the current ``top window''.  If the top
		window is the Module window or if you
		use F7, then a single
		line of source code is executed.  If the top window
		is the CPU window or if you use ALT+F7,
		then a single machine instruction is
		executed.  If the current source line contains
		a function call, TD traces into the function
		(assuming it was compiled with debug information).
		Some machine instructions, however, cause multiple
		instructions to be executed include: CALL, INT,
		LOOP, etc.
	
	<li> <b>Step over (=F8)</b>
		This is like ``Trace into'' except that
		when the instruction pointer is at a function call,
		then the entire function is executed and
		you are next placed at the statement following the
		function call.  
	<li> <b>Animate</b>
		(similar to run until terminate, except it
		pauses between machine instructions to allow
		you to catch what is happening)
	<li> <b>Restart</b>
		(move the instruction pointer
		back to the first instruction)
	</ol>

<p><b>Exercise 3</b>
List the functions available as a CTRL+key functions.
List the functions in the SpeedMenu
under the Code Pane of the CPU window.
<br>
For each of these functions, briefly describe
what they do (you can either experiment and/or read
up the online help), and describe a debugging
situation in which you might find them useful.

<a name=bkpt>
<h3><font color=ff0000>Breakpoints</font></h3>
</a>

Breakpoints are a device to cause the computer
to take specific actions at specific
points in its execution.
The user can define a breakpoint by specifying
three pieces of information.
	<ol>
	<li>The <b>location</b>
		where the breakpoint is set.
	<li>The <b>condition</b>
		which allows the breakpoint to activate.
	<li>The <b>action</b>
		that takes place when the breakpoint is activated.
	</ol>
The simplest kind of breakpoint is one that
(a) is associated with a specific instruction in the program,
which (b) is always activated (condition is ``always true'')
and (c) pauses the program execution (action is ``break'').
These are called <b>simple breakpoints</b>.
It is the default assumed by TD, and it should suffice
for our purposes.  Using this, you run the program
at full speed until specific
instructions, at which points you can examine the
state of the memory and CPU.

<p><font size=-1>As an example of more complex breakpoints,
you could have a <b>global breakpoint</b> which 
(a)' is evaluated after each line of source code,
which (b)' is activated when a particular variable is modified 
and (c)' logs the value of an expression. 
</font>
<p>
How do you set simple breakpoints?
Well, you only need to specify an instruction in the
program.   The simplest is to do this from within
the Module Window, or from the Code Pane in the CPU Window:
	<ul>
	<li> First place the cursor at an executable line of code
		where a breakpoint is desired.
		(How do you tell if a line is executable?)
		You then left-click the 2 leftmost columns of line.
		Instead of left-click, you can also use
		function F2 (see the status line).
		NOTE: if the line already has a breakpoint,
		then this action removes that breakpoint.
		Hence this is also called the <b>toggle</b> action.
	<li> If you use the Breakpoint->At menu option,
		you can also place a simple breakpoint at the
		current cursor position.  However, since this
		has a pop-up <b>Breakpoint option dialog box</b>,
		you could
		also specify more complex types of breakpoint.
	</ul>
Breakpoint <b>addresses</b> must be entered when you
use the keyboard to enter breakpoints.  (You can see this
in the <b>Breakpoint option dialog box</b> above.)
Here are the kinds of addresses you can specify:
	<ul>
	<li> #&lt;number&gt; -- for instance, #68 specifies
		a breakpoint in line 68 of your source code.
		<br>
		NOTE: If you have several program modules, you need
		to preface the line number with the module
		name.  E.g. #hw1#68 refers to line 68 in
		hw1.asm module.
	<li> Symbolic names -- for instance, labels can be
		specified.  If you have have a label called
		``repeat'', you can use this as an address.
	</ul>
How do you see all the current breakpoints?
In the <b>Breakpoints Window</b>, which
can be activated using the View->Breakpoints menu option.
This window has two panes: the left pane lists all the
current breakpoints, the right pane gives details about
the breakpoint that is currently highlighted. 
The SpeedMenu from the left pane has options to add or
delete breakpoints, etc.

<p><b>Exercise 4</b>
Write a simple program using the LOOPE command
to read 20 input characters and to store them
in a variable called INPUTS.  Note that LOOPE is discussed in
the exercises of Chapter 6.  However, you may break out of
the loop early, when a carriage return (CR) is entered.
After the last input character, store a '$' character
(this is the 21st character if all twenty characters
are read, otherwise, the '$' is stored instead of the CR.
Use TD to examine the status flags in this loop.
 
<a name=cpu>
<h3><font color=ff0000>CPU Window</font></h3>
</a>

<a href=#cpu-sum>Above</a> we briefly introduced
the CPU window.  You can activate any pane of the CPU window
by left-clicking the pane.  The SpeedMenu the activated
pane is then available. We now describe
two of the panes in more detail.

<p>
<b>(1) CODE PANE:</b>
There are three display modes in the code pane.
In the SpeedMenu for the Code Pane, the command ``Mixed''
accepts three options: ``No'', ``Yes'' and ``Both''.
The verbose mode is ``Yes'', and shows for each
source code line:
	<ul>
	<li>the source code line,
	<li>the machine instruction(s),
	<li>and the disassembled code in the same line
	</ul>
Note that a source code can generate several machine instructions.
For instance, the usual preliminary lines
        <center>
        <table>
        <tr align=left>
        <th bgcolor=aaeeee align=left>
                <pre>

mov ax,@@data
mov ds,ax </pre></th></tr>
        </table> 
        </center>

in the procedure <b>main</b>
of a program called <b>hw1.asm</b> produces the following
information in the code pane:
        <center>
        <table>
        <tr align=left>
        <th bgcolor=aaeeee align=left>
                <pre>
...
#hw1#main: mov ax,@@data
  cs:0000 B8B20A	 mov   ax,0AB2
#hw1#31: mov ds,ax
  cs:0003 8ED8		 mov   ds,ax
...  </pre></th></tr>
        </table> 
        </center>

Note that the first mov instruction produces
3 bytes of machine instructions (B8B20A), the second
mov instruction produces only two bytes (8ED8).
The offsets of these two instruction in the code
segment (cs register) are 0000 and 0003, respectively.

<p><b>Navigating the code pane</b>.
The SpeedMenu in Code Pane has some useful tools
for navigating your code:
<ul>
<li> <b>Origin</b>: positions you at the location
	of the instruction pointer.
<li> <b>Follow</b>: goes to the destination address
		of current highlighted instruction.
		Useful only if the current instruction
		is a CALL, INT, JMP, JZ, etc.
<li> <b>Previous</b>: restores the code pane to the
		previous position.
</ul>

Another useful SpeedMenu command is called <b>Assemble</b>.
It allows you to replace the current line of instruction
with any other (single) instruction that you specify. 
	
<p>
<b>(2) DUMP PANE:</b>
This is a hex display of an area in memory.
The leftmost path of each line shows the
starting address of the line (e.g., ds:0000).
In the default display format (byte format),
you see 8 bytes per line, and to the right of
these 8 bytes are their representation in the
IBM extended character set (which is
an extension of the ASCII set).

You can use the GOTO command in the SpeedMenu
to examine variables (e.g., GOTO Input, assuming you
have defined the variable "Input").

NOTE: There is also a <b>Dump Window</b> which
can be invoked from the View Menu.  This gives
the same information as the Dump Pane, except that
it now can be resized.  TRY THIS!


<a name=clip>
<h3><font color=ff0000>
Clipboard Facilities
</font></h3>

In debugging, we often have to copy hex addresses
or transfer chunks of hex information.
Humans tend to make mistakes with such data.
TD has extensive copy and paste facilities to and
from the Clipboard to help in this process.
Hence it is worth your while to learn some tricks for
using the Clipboard.

<p>
E.g., if a dialog box pops up and asks
you for some information (e.g., the address of
a breakpoint), it is sometimes possible to paste
this information from the clipboard.  
<p>
The first thing to realize is that information
on the clipboard are ``objects'', not just inert
data.  For instance, if you copy a chunk of
the memory to the clipboard, the address of
that chunk is remembered.  When the contents of
these memory locations change, your clipboard contents
changes!  Hence, each item in the clipboard
has an associated type, such as:
	<ul>
	<li>
	<b>address</b>: an address, with no associated data
	<li>
	<b>CPU code</b>: address and byte list of data in memory
		from the DUMP window
	<li>
	<b>Expression</b>: from the Watches Window
	<li>
	<b>String</b>: a text string
	</ul>
Furthermore, when we paste an item from the clipboard, there
are three options: to paste it as a
<b>string</b> (if the item is a string),
as a <b>location</b> (if item has an address)
or as <b>contents</b> (for an address item).
Here is how you perform basic clipboard operations:
	<ul>
<li>
Copying to Clipboard: position the cursor on the item
	(or highlight it with the INSERT and arrow keys),
	then press SHIFT+F3.
<li>
Pasting from Clipboard: press SHIFT+F4 (or use the Clip button
	in some dialog box) to bring up the Clipboard's Pick
	dialog box. 
<li>
Viewing the Clipboard contents: choose View->Clipboard menu option.
	</ul>
<a name=bot>
<h3><font color=ff0000>
Bottom of Page
</font></h3>
</a>
<a href=#top> Go to Top of Page</a>

<!--
<h3><font color=ff0000>Watching and Setting </font></h3>
-->
<p>
<hr>
<address>
Comments? <a href=mailto:yap@@nyu.edu>yap@@nyu.edu</a>
</address>

</body>
</html>

@


1.5
log
@*** empty log message ***
@
text
@d94 1
a94 1
chapter 5 of your text).
@


1.4
log
@*** empty log message ***
@
text
@d3 1
a3 1
	V22.0201.002 (Fall 97)
d73 6
a78 3
Here is basic information for debugging your 
assembler programs.
There are 3 versions of the Turbo Debugger:
d82 1
d90 5
d102 1
a102 1
Before we address the debugger, let us address
d107 1
a107 1
are basically <b>syntax errors</b>. 
@


1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
	DEBUGGING INFORMATION
d44 4
d109 5
a113 3
	<pre>
	:&gt; tasm /z hw1
	</pre>
d115 4
d137 10
a146 3
	<pre>
	Greeting db 'Hello, World!'
	</pre>
d159 13
a171 5
        <pre>
    	:&gt; tasm /zi hw1
	:&gt; tlink /v hw1
	:&gt; td hw1
        </pre>
d259 3
a261 1
	executed code.]
d279 7
a285 1
First, let us go over some of the pulldown menus:
d341 13
a353 6
	<pre>
	mov ax,ffffh
	mov bx,8000h
	neg bx
	add ax,bx
	</pre>
d415 5
d505 6
a510 3
in a variable.  Note that LOOPE is discussed in
the exercises of Chapter 6.  However, you break out of
the loop early, when a carriage return is entered.
d526 1
a526 1
In the SpeedMenu for the Code Pane, the cammand ``Mixed''
d537 11
a547 4
	<pre>
	mov ax,@@data
	mov ds,ax
	</pre>
d551 14
a564 8
	<pre>
	...
	#hw1#main: mov ax,@@data
	  cs:0000 B8B20A	mov	ax,0AB2
	#hw1#31: mov ds,ax
	  cs:0003 8ED8		mov 	ds,ax
	...
	</pre>
d571 1
a571 1
<b>Navigating the code pane</b>.
d585 3
d601 2
a602 2
to examine variables (e.g., GOTO Input, if you
have define the variable "Input").
d627 1
a627 1
this informaton from the clipboard.  
@


1.2
log
@*** empty log message ***
@
text
@d78 1
a78 1
is what we assume below.  But TD only
d96 6
a101 4
The fix here is basically trivial (but it has to
be said): tasm will report all the lines that
has a syntax error, and all you do is to address
the problems one line at a time!  
d103 2
a104 5
If you invoke "tasm hw1" as above,
any errors will be reported in a line-by-line fashion.
However, only the line numbers will be shown. 
To ask tasm to print out the offending instructions as well,
do this instead:
d135 3
a137 2
"Greeting" rather than "ABCD0123h".
<p>
d139 1
a139 1
and TLINK with certain options (/zi and /v, respectively).
d141 1
a141 1
above:
d160 1
a160 1
		It is not always obvious that you have a bug.
d187 1
a187 1
The TD window shows a standard (pull-down) <b>menu bar</b> at the top.
d195 1
d199 1
a199 1
Within the TD window we can
d201 2
a202 2
several of these windows may be <b>active</b>.  The
active windows are numbered (1,2,3, etc.) and this
d206 3
a208 1
the current <b>top window</b>.
d226 1
a226 1
	We noted that status bar shows the list of functions associated with
d230 6
d238 4
d304 16
d371 1
a371 1
<p><b>Exercise 2</b>
d457 1
a457 1
<p><b>Exercise 3</b>
d460 2
a461 1
in a variable.  However, you break out of
@


1.1
log
@Initial revision
@
text
@d19 47
d67 1
d83 1
d87 1
d110 1
d114 1
d152 5
a156 1
<h3><font color=ff0000> How to Debug </font></h3>
d175 5
a179 1
<h3><font color=ff0000> Using TD </font></h3>
d181 4
a184 6
Within TD are a variety of windows.  At any moment,
you can have several of these windows <b>active</b>.  The
active windows are numbered (1,2,3, etc.) and the
number is shown on the upper right hand corner of the window.
It is essential you be familiar with some of these windows,
and how to manage them.
d186 56
a241 1
<p><b>VIEW menu</b><br>
d243 1
a243 1
	We describe some of them.
d254 10
a263 3
	<li> <b>CPU Window</b> This window is most useful for
		assembly language programming as it really shows
		the state of your CPU.  At the top bar of this
d266 24
a289 3
		There are 6 subwindows (called <b>panes</b>)
		under the CPU window.  There is a pane for
		the registers, the flags register, stack.
d291 12
a302 7
<p><b>WINDOW menu</b><br>
	To manage the various windows, you need the WINDOW menu.
	If you pull down this menu, you will see instructions
	to step through your active windows, to zoom into
	a particular window, etc.  At the bottom of the menu
	is a list of all the currently active windows.
<p><b>RUN menu</b><br>
d304 2
a305 3
	to execute your code.  For this, you need to pull down
	the RUN menu.  Basically, you can run in a variety
	of modes:
d307 27
a333 9
	<li> Run until program terminate
		(the simplest mode)
	<li> Tracing
		(i.e., machine instruction by machine instruction)
	<li> Stepping
		(i.e., assembly instruction by assembly instruction)
	<li> Run until the next break point
		(which you can set)
	<li> Animate
d337 1
a337 1
	<li> Restart
d341 247
@
