[avida-cvs] avida(kaben) CVS commits: /current/doc analyze_mode.html analyze_samples.html code_c++_intro.html code_death_birth.html code_environment.html code_events.html code_genesis.html code_genome.html code_init_file.html code_instruction.html code_life_cycle.html code_task.html cpu_tour.html cvs.html devel.html environment.html events.html genesis.html index.html inst_set.html level_map.html print_data.html screen.html structure.html /current/source/cpu cpu_defs.hh cpu_stack.hh hardware_4stack.cc hardware_4stack.hh hardware_cpu.cc hardware_cpu.hh hardware_util.cc hardware_util.hh label.cc label.hh /current/source/main analyze.cc config.cc config.hh inst_set.cc mutations.cc mutations.hh /current/source/tools file.cc file.hh string_list.hh tList.hh

kaben avida-cvs at alife.org
Thu May 29 19:47:58 PDT 2003


kaben		Thu May 29 11:47:58 2003 EDT

  Modified files:              (Branch: kaben)
    /avida/current/doc	analyze_mode.html analyze_samples.html 
                      	code_c++_intro.html code_death_birth.html 
                      	code_environment.html code_events.html 
                      	code_genesis.html code_genome.html 
                      	code_init_file.html code_instruction.html 
                      	code_life_cycle.html code_task.html 
                      	cpu_tour.html cvs.html devel.html 
                      	environment.html events.html genesis.html 
                      	index.html inst_set.html level_map.html 
                      	print_data.html screen.html structure.html 
    /avida/current/source/cpu	cpu_defs.hh cpu_stack.hh 
                             	hardware_4stack.cc hardware_4stack.hh 
                             	hardware_cpu.cc hardware_cpu.hh 
                             	hardware_util.cc hardware_util.hh 
                             	label.cc label.hh 
    /avida/current/source/main	analyze.cc config.cc config.hh 
                              	inst_set.cc mutations.cc mutations.hh 
    /avida/current/source/tools	file.cc file.hh string_list.hh tList.hh 
  Log:
  
  Merge Charles' and Larry's recent changes to main branch into my branch.
  
  
  
-------------- next part --------------
Index: avida/current/doc/analyze_mode.html
diff -u avida/current/doc/analyze_mode.html:1.2 avida/current/doc/analyze_mode.html:1.2.2.1
--- avida/current/doc/analyze_mode.html:1.2	Wed Aug  7 20:47:03 2002
+++ avida/current/doc/analyze_mode.html	Thu May 29 11:47:48 2003
@@ -371,3 +371,8 @@
 Currently there are no conditionals or mathematical commands in this
 scripting language.  These are both planned for the future.
 
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/analyze_samples.html
diff -u avida/current/doc/analyze_samples.html:1.1 avida/current/doc/analyze_samples.html:1.1.2.1
--- avida/current/doc/analyze_samples.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/analyze_samples.html	Thu May 29 11:47:48 2003
@@ -317,3 +317,8 @@
   the section "Working with Batches" above such that you now only need to
   work within a single batch.
 
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_c++_intro.html
diff -u avida/current/doc/code_c++_intro.html:1.1 avida/current/doc/code_c++_intro.html:1.1.2.1
--- avida/current/doc/code_c++_intro.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_c++_intro.html	Thu May 29 11:47:48 2003
@@ -1,10 +1,5 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="GENERATOR" content="Mozilla/4.77 [en] (X11; U; Linux 2.4.3-20mdk i686) [Netscape]">
-   <title>An Introduction to C++</title>
-</head>
+<title>An Introduction to C++</title>
+
 <body text="#000000" bgcolor="#FFFFFF" link="#0000AA" vlink="#000044" alink="#0000FF">
 
 <center>
@@ -397,5 +392,7 @@
 Terms</a></li>
 </menu>
 
-</body>
-</html>
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_death_birth.html
diff -u avida/current/doc/code_death_birth.html:1.1 avida/current/doc/code_death_birth.html:1.1.2.1
--- avida/current/doc/code_death_birth.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_death_birth.html	Thu May 29 11:47:48 2003
@@ -394,3 +394,8 @@
 <p>
 If the found list ends with more than one candidate cell in it, the one used
 is selected randomly from the options available.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_environment.html
diff -u avida/current/doc/code_environment.html:1.1.2.1 avida/current/doc/code_environment.html:1.1.2.2
--- avida/current/doc/code_environment.html:1.1.2.1	Thu May 15 05:35:12 2003
+++ avida/current/doc/code_environment.html	Thu May 29 11:47:48 2003
@@ -297,3 +297,7 @@
 if the reactions requisites have been met.  And finally the
 <font color="#000088">resource_count</font> available to the organisms is
 needed to determine how much of each resource can be used in the reactions.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
Index: avida/current/doc/code_events.html
diff -u avida/current/doc/code_events.html:1.1 avida/current/doc/code_events.html:1.1.2.1
--- avida/current/doc/code_events.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_events.html	Thu May 29 11:47:48 2003
@@ -335,3 +335,8 @@
 you're goal is to kill the organism (if one exists) in the specified cell.
 For help with how to do this, take a look at the <tt>apocalypse</tt> event,
 which causes a larger scale extinction.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_genesis.html
diff -u avida/current/doc/code_genesis.html:1.1 avida/current/doc/code_genesis.html:1.1.2.1
--- avida/current/doc/code_genesis.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_genesis.html	Thu May 29 11:47:49 2003
@@ -177,3 +177,8 @@
 <p>
 <b>6. Use the variable wherever you need it!</b> :
 Your new variable is ready for you.  Use it wisely.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_genome.html
diff -u avida/current/doc/code_genome.html:1.1 avida/current/doc/code_genome.html:1.1.2.1
--- avida/current/doc/code_genome.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_genome.html	Thu May 29 11:47:49 2003
@@ -372,3 +372,8 @@
 <p>
 Finally, three static methods are included to provide access to the
 three pre-defined instructions.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_init_file.html
diff -u avida/current/doc/code_init_file.html:1.1 avida/current/doc/code_init_file.html:1.1.2.1
--- avida/current/doc/code_init_file.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_init_file.html	Thu May 29 11:47:49 2003
@@ -326,3 +326,8 @@
 So how do we use this cGenesis class to load in and make use of
 the initialization file by the same name?  For that, you'll need to read
 about the cConfig class in the next document.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_instruction.html
diff -u avida/current/doc/code_instruction.html:1.2 avida/current/doc/code_instruction.html:1.2.2.1
--- avida/current/doc/code_instruction.html:1.2	Sat Feb  8 11:17:50 2003
+++ avida/current/doc/code_instruction.html	Thu May 29 11:47:49 2003
@@ -272,10 +272,11 @@
 more "correct" code.
 </table>
 
-<h3>Homework</h3>
+<h3>Problem</h3>
 
 <p>
-For your homework, you will be writing two new instructions in avida.  The
+To test your understanding of adding instruction into avida, try writing two
+new instructions.  The
 first one is the mathematical instruction "<b><tt>cube</tt></b>" which will
 take the ?BX? register, and put its value to the third power.  If you look
 in the actual source files, you will see that there is already a
@@ -292,3 +293,8 @@
 For both of these instruction make sure to craft an organism to test that
 they are working properly!  Turn in this organism (or organisms) to me along
 with the source code when you finish the assignment.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_life_cycle.html
diff -u avida/current/doc/code_life_cycle.html:1.1 avida/current/doc/code_life_cycle.html:1.1.2.1
--- avida/current/doc/code_life_cycle.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/code_life_cycle.html	Thu May 29 11:47:49 2003
@@ -276,3 +276,8 @@
 each other and have more interactions with the environment.  In a
 multi-threaded model, organisms will be doing many activities at the same
 time.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/code_task.html
diff -u avida/current/doc/code_task.html:1.1 avida/current/doc/code_task.html:1.1.2.1
--- avida/current/doc/code_task.html:1.1	Sat Feb  8 11:17:50 2003
+++ avida/current/doc/code_task.html	Thu May 29 11:47:49 2003
@@ -104,4 +104,8 @@
 <h3>4. Some advanced features...</h3>
 
     [ This section to be written soon! ]
+    
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
     
Index: avida/current/doc/cpu_tour.html
diff -u avida/current/doc/cpu_tour.html:1.1 avida/current/doc/cpu_tour.html:1.1.2.1
--- avida/current/doc/cpu_tour.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/cpu_tour.html	Thu May 29 11:47:49 2003
@@ -356,4 +356,8 @@
     <td bgcolor="#FFBBBB">Y  <td bgcolor="#FFBBBB">Z      <td bgcolor="#FFBBBB">~X  
     <td bgcolor="#AAFFAA">? <td bgcolor="#FFFF88"> X or Y
 </table>
-</center>
\ No newline at end of file
+</center>
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/cvs.html
diff -u avida/current/doc/cvs.html:1.1 avida/current/doc/cvs.html:1.1.2.1
--- avida/current/doc/cvs.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/cvs.html	Thu May 29 11:47:49 2003
@@ -180,4 +180,8 @@
 
 <p>
 For more information on the CVS, see this
-<a href="http://wwwinfo.cern.ch/asd/cvs/tutorial/cvs_tutorial_toc.html">tutorial</a>
\ No newline at end of file
+<a href="http://wwwinfo.cern.ch/asd/cvs/tutorial/cvs_tutorial_toc.html">tutorial</a>
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/devel.html
diff -u avida/current/doc/devel.html:1.1 avida/current/doc/devel.html:1.1.2.1
--- avida/current/doc/devel.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/devel.html	Thu May 29 11:47:49 2003
@@ -116,3 +116,8 @@
 The viewer has problems showing up properly on some systems, if it doesn't
 work for you, you can always just run avida in "primitive" move by typing
 "<tt>primitive</tt>" instead of "<tt>viewer</tt>".
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/environment.html
diff -u avida/current/doc/environment.html:1.1.2.1 avida/current/doc/environment.html:1.1.2.2
--- avida/current/doc/environment.html:1.1.2.1	Thu May 15 05:35:12 2003
+++ avida/current/doc/environment.html	Thu May 29 11:47:49 2003
@@ -434,3 +434,7 @@
   REACTION  XOR  xor   process:resource=resXOR:value=8.0:frac=0.0025
   REACTION  EQU  equ   process:resource=resEQU:value=16.0:frac=0.0025
 </pre>
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
Index: avida/current/doc/events.html
diff -u avida/current/doc/events.html:1.2.2.1 avida/current/doc/events.html:1.2.2.2
--- avida/current/doc/events.html:1.2.2.1	Thu May 15 05:35:12 2003
+++ avida/current/doc/events.html	Thu May 29 11:47:49 2003
@@ -257,3 +257,8 @@
     Quit the current run.
 </menu>
 
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/genesis.html
diff -u avida/current/doc/genesis.html:1.1 avida/current/doc/genesis.html:1.1.2.1
--- avida/current/doc/genesis.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/genesis.html	Thu May 29 11:47:49 2003
@@ -421,3 +421,8 @@
         a new lineage will be created.  I'll let you read the genesis file
         itself to see the methods.
 </table>
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/index.html
diff -u avida/current/doc/index.html:1.2 avida/current/doc/index.html:1.2.2.1
--- avida/current/doc/index.html:1.2	Fri Feb  7 13:33:09 2003
+++ avida/current/doc/index.html	Thu May 29 11:47:49 2003
@@ -1,4 +1,3 @@
-<html>
 <title>Index of Avida Documentation</title>
 
 <h1 align=center>Index of Avida Documentation</h1>
@@ -43,4 +42,8 @@
 <p>
 <a href="cvs.html">CVS - Concurrent Versions System</a><br>
 <a href="screen.html">The "screen" Virtual Terminal</a><br>
-</html>
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/inst_set.html
diff -u avida/current/doc/inst_set.html:1.1 avida/current/doc/inst_set.html:1.1.2.1
--- avida/current/doc/inst_set.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/inst_set.html	Thu May 29 11:47:49 2003
@@ -234,3 +234,8 @@
 If a template is present, it will keep turning in that direction until either
 it has made a full 360 degree turn, or else it finds an organism that
 possesses the complement template.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/level_map.html
diff -u avida/current/doc/level_map.html:1.1 avida/current/doc/level_map.html:1.1.2.1
--- avida/current/doc/level_map.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/level_map.html	Thu May 29 11:47:49 2003
@@ -110,3 +110,8 @@
 </table>
 
 
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/print_data.html
diff -u avida/current/doc/print_data.html:1.1 avida/current/doc/print_data.html:1.1.2.1
--- avida/current/doc/print_data.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/print_data.html	Thu May 29 11:47:49 2003
@@ -58,4 +58,8 @@
 <tr><td><tt>ave_species_age</tt> <td>Average Species Age
 <tr><td><tt>max_fitness</tt> <td>Maximum Fitness in Population
 <tr><td><tt>max_merit</tt> <td>Maximum Merit in Population
-</table>
\ No newline at end of file
+</table>
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/screen.html
diff -u avida/current/doc/screen.html:1.1 avida/current/doc/screen.html:1.1.2.1
--- avida/current/doc/screen.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/screen.html	Thu May 29 11:47:49 2003
@@ -120,3 +120,8 @@
 <p>
 You can then use the arrow keys to move the cursor around on the screen, and
 press enter on a link to obtain more information on a topic.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/doc/structure.html
diff -u avida/current/doc/structure.html:1.1 avida/current/doc/structure.html:1.1.2.1
--- avida/current/doc/structure.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/structure.html	Thu May 29 11:47:49 2003
@@ -506,3 +506,8 @@
 a <tt><font color="#008844">config/</font></tt> sub-directory under here
 with additional, optional configuration files that you may want to look at
 to see other possible pre-configured settings.
+
+<br><hr>
+Project hosted by:<br>
+<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=46761&type=2" width="125" height="37" border="0" alt="SourceForge.net"/></a>
+    
\ No newline at end of file
Index: avida/current/source/cpu/cpu_defs.hh
diff -u avida/current/source/cpu/cpu_defs.hh:1.8.2.1 avida/current/source/cpu/cpu_defs.hh:1.8.2.2
--- avida/current/source/cpu/cpu_defs.hh:1.8.2.1	Tue May 20 05:12:19 2003
+++ avida/current/source/cpu/cpu_defs.hh	Thu May 29 11:47:50 2003
@@ -23,12 +23,15 @@
 // (especially the number of registers) could have effects in other parts
 // of the code!
 
-#define MAX_NOPS 3
+#define MAX_NOPS 4
 #define MAX_LABEL_SIZE 10 
 #define REG_AX 0
 #define REG_BX 1
 #define REG_CX 2
+#define REG_DX 3
 #define NUM_REGISTERS 3
+#define NUM_REG_4STACK 4
+
 
 #define HEAD_IP     0
 #define HEAD_READ   1
Index: avida/current/source/cpu/cpu_stack.hh
diff -u avida/current/source/cpu/cpu_stack.hh:1.2.2.1 avida/current/source/cpu/cpu_stack.hh:1.2.2.2
--- avida/current/source/cpu/cpu_stack.hh:1.2.2.1	Mon May 12 10:22:46 2003
+++ avida/current/source/cpu/cpu_stack.hh	Thu May 29 11:47:50 2003
@@ -35,6 +35,7 @@
   inline int Pop();
   inline int Get(int depth=0) const;
   inline void Clear();
+  inline int& Top();
   void Flip();
 
   bool OK();
@@ -73,6 +74,10 @@
   stack_pointer = 0;
 }
 
+inline int& cCPUStack::Top()
+{
+  return stack[stack_pointer];
+}
 
 
 #endif
Index: avida/current/source/cpu/hardware_4stack.cc
diff -u avida/current/source/cpu/hardware_4stack.cc:1.2.2.4 avida/current/source/cpu/hardware_4stack.cc:1.2.2.5
--- avida/current/source/cpu/hardware_4stack.cc:1.2.2.4	Fri May 23 03:17:40 2003
+++ avida/current/source/cpu/hardware_4stack.cc	Thu May 29 11:47:50 2003
@@ -1,3 +1,4 @@
+
 //////////////////////////////////////////////////////////////////////////////
 // Copyright (C) 1993 - 2003 California Institute of Technology             //
 //                                                                          //
@@ -42,7 +43,7 @@
 {
    id = _id;
    if (id == -1) id = in_thread.id;
-   for (int i = 0; i < NUM_REGISTERS; i++) {
+   for (int i = 0; i < NUM_REG_4STACK; i++) {
      reg[i] = in_thread.reg[i];
    }
    for (int i = 0; i < NUM_HEADS; i++) {
@@ -57,7 +58,7 @@
 void cHardware4Stack_Thread::operator=(const cHardware4Stack_Thread & in_thread)
 {
   id = in_thread.id;
-  for (int i = 0; i < NUM_REGISTERS; i++) {
+  for (int i = 0; i < NUM_REG_4STACK; i++) {
     reg[i] = in_thread.reg[i];
   }
   for (int i = 0; i < NUM_HEADS; i++) {
@@ -73,7 +74,7 @@
 {
   id = _id;
 
-  for (int i = 0; i < NUM_REGISTERS; i++) reg[i] = 0;
+  for (int i = 0; i < NUM_REG_4STACK; i++) reg[i] = 0;
   for (int i = 0; i < NUM_HEADS; i++) heads[i].Reset(in_hardware);
 
   stack.Clear();
@@ -94,7 +95,7 @@
   fp << "cHardware4Stack_Thread" << endl;
 
   // registers
-  for( int i=0; i<NUM_REGISTERS; ++i ){
+  for( int i=0; i<NUM_REG_4STACK; ++i ){
     fp<<reg[i]<<endl;
   }
 
@@ -129,7 +130,7 @@
   assert( foo == "cHardware4Stack_Thread");
 
   // registers
-  for( int i=0; i<NUM_REGISTERS; ++i ){
+  for( int i=0; i<NUM_REG_4STACK; ++i ){
     fp>>reg[i];
   }
 
@@ -243,9 +244,10 @@
     int nop_mod;
   };
   static const cNOPEntry4Stack s_n_array[] = {
-    cNOPEntry4Stack("nop-A", REG_AX),
-    cNOPEntry4Stack("nop-B", REG_BX),
-    cNOPEntry4Stack("nop-C", REG_CX)
+    cNOPEntry4Stack("Nop-A", REG_AX),
+    cNOPEntry4Stack("Nop-B", REG_BX),
+    cNOPEntry4Stack("Nop-C", REG_CX),
+    cNOPEntry4Stack("Nop-D", REG_DX),
   };
 
   struct cInstEntry4Stack {
@@ -254,17 +256,85 @@
     tHardware4StackMethod function;
   };
   static const cInstEntry4Stack s_f_array[] = {
+    //1 
+    cInstEntry4Stack("Nop-A",     &cHardware4Stack::Inst_Nop), 
+    //2
+    cInstEntry4Stack("Nop-B",     &cHardware4Stack::Inst_Nop), 
+    //3
+    cInstEntry4Stack("Nop-C",     &cHardware4Stack::Inst_Nop),   
+    //4 - not implemented yet...
+    cInstEntry4Stack("Nop-D",     &cHardware4Stack::Inst_Nop), 
+    //5
+    cInstEntry4Stack("Nop-X",     &cHardware4Stack::Inst_Nop),
+    //6 
+    cInstEntry4Stack("Val-Shift-R",   &cHardware4Stack::Inst_ShiftR),
+    //7
+    cInstEntry4Stack("Val-Shift-L",   &cHardware4Stack::Inst_ShiftL),
+    //8
+    cInstEntry4Stack("Val-Nand",      &cHardware4Stack::Inst_Nand),
+    //9
+    cInstEntry4Stack("Val-Add",       &cHardware4Stack::Inst_Add),
+    //10
+    cInstEntry4Stack("Val-Sub",       &cHardware4Stack::Inst_Sub),
+    //11
+    cInstEntry4Stack("Val-Mult",      &cHardware4Stack::Inst_Mult),
+    //12
+    cInstEntry4Stack("Val-Div",       &cHardware4Stack::Inst_Div),
+    //13
+    cInstEntry4Stack("SetMemory",   &cHardware4Stack::Inst_MaxAlloc),
+    //14
+    cInstEntry4Stack("Divide",  &cHardware4Stack::Inst_HeadDivide),
+    //15
+    cInstEntry4Stack("Inst-Read",    &cHardware4Stack::Inst_HeadRead),
+    //16
+    cInstEntry4Stack("Inst-Write",   &cHardware4Stack::Inst_HeadWrite),
+    //keeping this one for the transition period
+    cInstEntry4Stack("Inst-Copy",    &cHardware4Stack::Inst_HeadCopy),
+    //17
+    cInstEntry4Stack("If-Equal",    &cHardware4Stack::Inst_IfEqu),
+    //18
+    cInstEntry4Stack("If-Not-Equal",  &cHardware4Stack::Inst_IfNEqu),
+    //19
+    cInstEntry4Stack("If-Less",   &cHardware4Stack::Inst_IfLess),
+    //20
+    cInstEntry4Stack("If-Greater",    &cHardware4Stack::Inst_IfGr),
+    //21
+    cInstEntry4Stack("Head-Push",    &cHardware4Stack::Inst_HeadPush),
+    //22
+    cInstEntry4Stack("Head-Pop",     &cHardware4Stack::Inst_HeadPop),
+    //23
+    cInstEntry4Stack("Head-Move",  &cHardware4Stack::Inst_MoveHead),
+    //24
+    cInstEntry4Stack("Search",  &cHardware4Stack::Inst_HeadSearch),
+    //25
+    cInstEntry4Stack("Push-Next",    &cHardware4Stack::Inst_PushA),
+    //26
+    cInstEntry4Stack("Push-Prev",    &cHardware4Stack::Inst_PushB),
+    //27
+    cInstEntry4Stack("Push-Comp",    &cHardware4Stack::Inst_PushC),
+    //28 - Not implemented yet...
+    //cInstEntry4Stack("Val-Delete", &cHardware4Stack::Inst_ValDelete
+    //29
+    cInstEntry4Stack("Val-Copy",  &cHardware4Stack::Inst_CopyStack),
+    //30
+    cInstEntry4Stack("ThreadFork",   &cHardware4Stack::Inst_ForkThread),
+    //31
+    cInstEntry4Stack("if-label",  &cHardware4Stack::Inst_IfLabel),
+    //32
+    cInstEntry4Stack("Val-Inc",       &cHardware4Stack::Inst_Inc),
+    //33
+    cInstEntry4Stack("Val-Dec",       &cHardware4Stack::Inst_Dec),
+    //34
+    cInstEntry4Stack("Val-Mod",       &cHardware4Stack::Inst_Mod),
+    //35
+    cInstEntry4Stack("ThreadKill",   &cHardware4Stack::Inst_KillThread),
+    
     /*
-    Note: all entries of cNOPEntryCPU s_n_array must have corresponding
-    in the same order in cInstEntryCPU s_f_array, and these entries must
-    be the first elements of s_f_array.
-    */
     cInstEntry4Stack("nop-A",     &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("nop-B",     &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("nop-C",     &cHardware4Stack::Inst_Nop),
 
-    // Added "map-null" for use in analyze mode. -- kgn
-    cInstEntry4Stack("map-null",  &cHardware4Stack::Inst_Nop),
+    cInstEntry4Stack("NULL",  &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("nop-X",     &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("if-equ-0",  &cHardware4Stack::Inst_If0),
     cInstEntry4Stack("if-not-0",  &cHardware4Stack::Inst_IfNot0),
@@ -349,7 +419,7 @@
 
     // Placebo instructions
     // nop-x (included with nops)
-    cInstEntry4Stack("skip",      &cHardware4Stack::Inst_Skip)
+    cInstEntry4Stack("skip",      &cHardware4Stack::Inst_Skip)*/
   };
 
   const int n_size = sizeof(s_n_array)/sizeof(cNOPEntry4Stack);
@@ -623,6 +693,9 @@
      << "CX:" << Register(REG_CX) << " "
      << setbase(16) << "[0x" << Register(REG_CX) << "]" << setbase(10)
 
+     << "DX:" << Register(REG_DX) << " "
+     << setbase(16) << "[0x" << Register(REG_DX) << "]" << setbase(10)
+
      << endl;
 
   fp << "  R-Head:" << GetHead(HEAD_READ).GetPosition() << " "
@@ -1387,7 +1460,7 @@
 
 inline int cHardware4Stack::FindModifiedRegister(int default_register)
 {
-  assert(default_register < NUM_REGISTERS);  // Reg ID too high.
+  assert(default_register < NUM_REG_4STACK);  // Reg ID too high.
 
   if (GetInstSet().IsNop(IP().GetNextInst())) {
     IP().Advance();
@@ -1397,6 +1470,18 @@
   return default_register;
 }
 
+inline int cHardware4Stack::FindModifiedStack(int default_stack)
+{
+  assert(default_stack < NUM_STACKS);  // Stack ID too high.
+
+  if (GetInstSet().IsNop(IP().GetNextInst())) {
+    IP().Advance();
+    default_stack = GetInstSet().GetNopMod(IP().GetInst());
+    IP().FlagExecuted() = true;
+  }
+  return default_stack;
+}
+
 
 inline int cHardware4Stack::FindModifiedHead(int default_head)
 {
@@ -1413,10 +1498,15 @@
 
 inline int cHardware4Stack::FindComplementRegister(int base_reg)
 {
-  const int comp_reg = base_reg + 1;
-  return (comp_reg  == NUM_REGISTERS) ? 0 : comp_reg;
+  const int comp_reg = base_reg + 2;
+  return comp_reg%NUM_REG_4STACK;
 }
 
+inline int cHardware4Stack::FindComplementStack(int base_stack)
+{
+  const int comp_stack = base_stack + 2;
+  return comp_stack%NUM_STACKS;
+}
 
 inline void cHardware4Stack::Fault(int fault_loc, int fault_type, cString fault_desc)
 {
@@ -1801,171 +1891,464 @@
 // And the instructions...
 //////////////////////////
 
-bool cHardware4Stack::Inst_If0()          // Execute next if ?bx? ==0.
+//6
+bool cHardware4Stack::Inst_ShiftR()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) != 0)  IP().Advance();
-  return true; 
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() >>= 1;
+  return true;
 }
 
-bool cHardware4Stack::Inst_IfNot0()       // Execute next if ?bx? != 0.
-{ 
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) == 0)  IP().Advance();
+//7
+bool cHardware4Stack::Inst_ShiftL()
+{
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() <<= 1;
   return true;
 }
 
-bool cHardware4Stack::Inst_IfEqu()      // Execute next if bx == ?cx?
+//8
+bool cHardware4Stack::Inst_Nand()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) != Register(reg_used2))  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() = ~(Stack(STACK_BX).Top() & Stack(STACK_CX).Top());
   return true;
 }
 
-bool cHardware4Stack::Inst_IfNEqu()     // Execute next if bx != ?cx?
+//9
+bool cHardware4Stack::Inst_Add()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) == Register(reg_used2))  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() = Stack(STACK_BX).Top() + Stack(STACK_CX).Top();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfGr0()       // Execute next if ?bx? ! < 0.
+//10
+bool cHardware4Stack::Inst_Sub()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) <= 0)  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() = Stack(STACK_BX).Top() - Stack(STACK_CX).Top();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfGr()       // Execute next if bx > ?cx?
+//11
+bool cHardware4Stack::Inst_Mult()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) <= Register(reg_used2))  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() = Stack(STACK_BX).Top() * Stack(STACK_CX).Top();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfGrEqu0()       // Execute next if ?bx? != 0.
+//12
+bool cHardware4Stack::Inst_Div()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) < 0)  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  if (Stack(STACK_CX).Top() != 0) {
+    if (0-INT_MAX > Stack(STACK_BX).Top() && Stack(STACK_CX).Top() == -1)
+      Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: Float exception");
+    else
+      Stack(stack_used).Top() = Stack(STACK_BX).Top() / Stack(STACK_CX).Top();
+  } else {
+    Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: dividing by 0");
+    return false;
+  }
   return true;
 }
 
-bool cHardware4Stack::Inst_IfGrEqu()       // Execute next if bx > ?cx?
+//13 
+bool cHardware4Stack::Inst_MaxAlloc()   // Allocate maximal more
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) < Register(reg_used2)) IP().Advance();
+  const int cur_size = GetMemory().GetSize();
+  const int alloc_size = Min((int) (cConfig::GetChildSizeRange() * cur_size),
+			     MAX_CREATURE_SIZE - cur_size);
+  if( Allocate_Main(alloc_size) ) {
+    Stack(STACK_AX).Top() = cur_size;
+    return true;
+  } else return false;
+}
+
+//14
+bool cHardware4Stack::Inst_HeadDivide()
+{
+  return Inst_HeadDivideMut(1);
+}
+
+bool cHardware4Stack::Inst_HeadDivideMut(double mut_multiplier)
+{
+  AdjustHeads();
+  const int divide_pos = GetHead(HEAD_READ).GetPosition();
+  int child_end =  GetHead(HEAD_WRITE).GetPosition();
+  if (child_end == 0) child_end = GetMemory().GetSize();
+  const int extra_lines = GetMemory().GetSize() - child_end;
+  bool ret_val = Divide_Main(divide_pos, extra_lines, mut_multiplier);
+  // Re-adjust heads.
+  AdjustHeads();
+  return ret_val; 
+}
+
+//15
+bool cHardware4Stack::Inst_HeadRead()
+{
+  const int head_id = FindModifiedHead(HEAD_READ);
+  GetHead(head_id).Adjust();
+  sCPUStats & cpu_stats = organism->CPUStats();
+
+  // Mutations only occur on the read, for the moment.
+  int read_inst = 0;
+  if (organism->TestCopyMut()) {
+    read_inst = GetRandomInst().GetOp();
+    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+  } else {
+    read_inst = GetHead(head_id).GetInst().GetOp();
+  }
+  Stack(STACK_BX).Top() = read_inst;
+  ReadInst(read_inst);
+
+  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+  GetHead(head_id).Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfLess0()       // Execute next if ?bx? != 0.
+//16
+bool cHardware4Stack::Inst_HeadWrite()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) >= 0)  IP().Advance();
+  const int head_id = FindModifiedHead(HEAD_WRITE);
+  cCPUHead & active_head = GetHead(head_id);
+
+  active_head.Adjust();
+
+  int value = Stack(STACK_BX).Top();
+  if (value < 0 || value >= GetNumInst()) value = 0;
+
+  active_head.SetInst(cInstruction(value));
+  active_head.FlagCopied() = true;
+
+  // Advance the head after write...
+  active_head++;
   return true;
 }
 
-bool cHardware4Stack::Inst_IfLess()       // Execute next if ?bx? < ?cx?
+//??
+bool cHardware4Stack::Inst_HeadCopy()
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) >=  Register(reg_used2))  IP().Advance();
+  // For the moment, this cannot be nop-modified.
+  cCPUHead & read_head = GetHead(HEAD_READ);
+  cCPUHead & write_head = GetHead(HEAD_WRITE);
+  sCPUStats & cpu_stats = organism->CPUStats();
+
+  read_head.Adjust();
+  write_head.Adjust();
+
+  // TriggerMutations(MUTATION_TRIGGER_READ, read_head);
+  
+  // Do mutations.
+  cInstruction read_inst = read_head.GetInst();
+  if (organism->TestCopyMut()) {
+    read_inst = GetRandomInst();
+    cpu_stats.mut_stats.copy_mut_count++; 
+    write_head.FlagMutated() = true;
+    write_head.FlagCopyMut() = true;
+    //organism->GetPhenotype().IsMutated() = true;
+  }
+  ReadInst(read_inst.GetOp());
+
+  cpu_stats.mut_stats.copies_exec++;
+
+  write_head.SetInst(read_inst);
+  write_head.FlagCopied() = true;  // Set the copied flag...
+
+  // TriggerMutations(MUTATION_TRIGGER_WRITE, write_head);
+
+  read_head.Advance();
+  write_head.Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfLsEqu0()       // Execute next if ?bx? != 0.
+//17
+bool cHardware4Stack::Inst_IfEqu()      // Execute next if bx == ?cx?
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(reg_used) > 0) IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  const int stack_used2 = FindComplementStack(stack_used);
+  if (Stack(stack_used).Top() != Stack(stack_used2).Top())  IP().Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfLsEqu()       // Execute next if bx > ?cx?
+//18
+bool cHardware4Stack::Inst_IfNEqu()     // Execute next if bx != ?cx?
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int reg_used2 = FindComplementRegister(reg_used);
-  if (Register(reg_used) >  Register(reg_used2))  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  const int stack_used2 = FindComplementStack(stack_used);
+  if (Stack(stack_used).Top() == Stack(stack_used2).Top())  IP().Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfBit1()
+//19
+bool cHardware4Stack::Inst_IfLess()       // Execute next if ?bx? < ?cx?
 {
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if ((Register(reg_used) & 1) == 0)  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  const int stack_used2 = FindComplementStack(stack_used);
+  if (Stack(stack_used).Top() >=  Stack(stack_used2).Top())  IP().Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfANotEqB()     // Execute next if AX != BX
+//20
+bool cHardware4Stack::Inst_IfGr()       // Execute next if bx > ?cx?
 {
-  if (Register(REG_AX) == Register(REG_BX) )  IP().Advance();
+  const int stack_used = FindModifiedStack(STACK_BX);
+  const int stack_used2 = FindComplementStack(stack_used);
+  if (Stack(stack_used).Top() <= Stack(stack_used2).Top())  IP().Advance();
   return true;
 }
 
-bool cHardware4Stack::Inst_IfBNotEqC()     // Execute next if BX != CX
+//21
+bool cHardware4Stack::Inst_HeadPush()
 {
-  if (Register(REG_BX) == Register(REG_CX) )  IP().Advance();
+  const int head_used = FindModifiedHead(HEAD_IP);
+  StackPush(GetHead(head_used).GetPosition());
+  if (head_used == HEAD_IP) {
+    GetHead(head_used).Set(GetHead(HEAD_FLOW));
+    advance_ip = false;
+  }
   return true;
 }
 
-bool cHardware4Stack::Inst_IfANotEqC()     // Execute next if AX != BX
+//22
+bool cHardware4Stack::Inst_HeadPop()
 {
-  if (Register(REG_AX) == Register(REG_CX) )  IP().Advance();
+  const int head_used = FindModifiedHead(HEAD_IP);
+  GetHead(head_used).Set(StackPop(), this);
   return true;
 }
 
-bool cHardware4Stack::Inst_JumpF()
+//23 
+bool cHardware4Stack::Inst_MoveHead()
+{
+  const int head_used = FindModifiedHead(HEAD_IP);
+  GetHead(head_used).Set(GetHead(HEAD_FLOW));
+  if (head_used == HEAD_IP) advance_ip = false;
+  return true;
+}
+
+//24
+bool cHardware4Stack::Inst_HeadSearch()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
+  cCPUHead found_pos = FindLabel(0);
+  const int search_size = found_pos.GetPosition() - IP().GetPosition();
+  Stack(STACK_BX).Top() = search_size;
+  Stack(STACK_CX).Top() = GetLabel().GetSize();
+  GetHead(HEAD_FLOW).Set(found_pos);
+  GetHead(HEAD_FLOW).Advance();
+  return true; 
+}
 
-  // If there is no label, jump BX steps.
-  if (GetLabel().GetSize() == 0) {
-    GetActiveHead().Jump(Register(REG_BX));
-    return true;
-  }
+//25
+bool cHardware4Stack::Inst_PushA() { StackPush(Stack(STACK_AX).Top()); return true;}
 
-  // Otherwise, try to jump to the complement label.
-  const cCPUHead jump_location(FindLabel(1));
-  if ( jump_location.GetPosition() != -1 ) {
-    GetActiveHead().Set(jump_location);
-    return true;
-  }
+//26
+bool cHardware4Stack::Inst_PushB() { StackPush(Stack(STACK_AX).Top()); return true;}
 
-  // If complement label was not found; record an error.
-  organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR,
-		  "jump-f: No complement label");
-  return false;
+//27
+bool cHardware4Stack::Inst_PushC() { StackPush(Stack(STACK_AX).Top()); return true;}
+
+//INSTRUCTION 28 - "ValDelete" GOES HERE - law
+
+//29
+bool cHardware4Stack::Inst_CopyStack()
+{
+  const int stack_used = FindModifiedStack(STACK_BX);
+  const int other_stack = FindComplementStack(stack_used);
+  Stack(other_stack).Top() = Stack(stack_used).Top();
+  return true;
 }
 
+//30
+bool cHardware4Stack::Inst_ForkThread()
+{
+  IP().Advance();
+  if (!ForkThread()) Fault(FAULT_LOC_THREAD_FORK, FAULT_TYPE_FORK_TH);
+  return true;
+}
 
-bool cHardware4Stack::Inst_JumpB()
+//31
+bool cHardware4Stack::Inst_IfLabel()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
+  if (GetLabel() != GetReadLabel())  IP().Advance();
+  return true;
+}
 
-  // If there is no label, jump BX steps.
-  if (GetLabel().GetSize() == 0) {
-    GetActiveHead().Jump(-Register(REG_BX));
-    return true;
-  }
+//32
+bool cHardware4Stack::Inst_Inc()
+{
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() += 1;
+  return true;
+}
 
-  // otherwise jump to the complement label.
-  const cCPUHead jump_location(FindLabel(-1));
-  if ( jump_location.GetPosition() != -1 ) {
-    GetActiveHead().Set(jump_location);
-    return true;
-  }
+//33
+bool cHardware4Stack::Inst_Dec()
+{
+  const int stack_used = FindModifiedStack(STACK_BX);
+  Stack(stack_used).Top() -= 1;
+  return true;
+}
 
-  // If complement label was not found; record an error.
-  organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR,
-		  "jump-b: No complement label");
+//34
+bool cHardware4Stack::Inst_Mod()
+{
+  const int stack_used = FindModifiedStack(STACK_BX);
+  if (Stack(STACK_CX).Top() != 0) {
+    Stack(stack_used).Top() = Stack(STACK_BX).Top() % Stack(STACK_CX).Top();
+  } else {
+    Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "mod: modding by 0");
   return false;
+  }
+  return true;
 }
 
-bool cHardware4Stack::Inst_JumpP()
+//35
+bool cHardware4Stack::Inst_KillThread()
+{
+  if (!KillThread()) Fault(FAULT_LOC_THREAD_KILL, FAULT_TYPE_KILL_TH);
+  else advance_ip = false;
+  return true;
+}
+
+/*bool cHardware4Stack::Inst_If0()          // Execute next if ?bx? ==0.
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) != 0)  IP().Advance();
+  return true; 
+}
+
+bool cHardware4Stack::Inst_IfNot0()       // Execute next if ?bx? != 0.
+{ 
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) == 0)  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfGr0()       // Execute next if ?bx? ! < 0.
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) <= 0)  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfGrEqu0()       // Execute next if ?bx? != 0.
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) < 0)  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfGrEqu()       // Execute next if bx > ?cx?
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  const int reg_used2 = FindComplementRegister(reg_used);
+  if (Register(reg_used) < Register(reg_used2)) IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfLess0()       // Execute next if ?bx? != 0.
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) >= 0)  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfLsEqu0()       // Execute next if ?bx? != 0.
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if (Register(reg_used) > 0) IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfLsEqu()       // Execute next if bx > ?cx?
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  const int reg_used2 = FindComplementRegister(reg_used);
+  if (Register(reg_used) >  Register(reg_used2))  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfBit1()
+{
+  const int reg_used = FindModifiedRegister(REG_BX);
+  if ((Register(reg_used) & 1) == 0)  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfANotEqB()     // Execute next if AX != BX
+{
+  if (Register(REG_AX) == Register(REG_BX) )  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfBNotEqC()     // Execute next if BX != CX
+{
+  if (Register(REG_BX) == Register(REG_CX) )  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_IfANotEqC()     // Execute next if AX != BX
+{
+  if (Register(REG_AX) == Register(REG_CX) )  IP().Advance();
+  return true;
+}
+
+bool cHardware4Stack::Inst_JumpF()
+{
+  ReadLabel();
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
+
+  // If there is no label, jump BX steps.
+  if (GetLabel().GetSize() == 0) {
+    GetActiveHead().Jump(Register(REG_BX));
+    return true;
+  }
+
+  // Otherwise, try to jump to the complement label.
+  const cCPUHead jump_location(FindLabel(1));
+  if ( jump_location.GetPosition() != -1 ) {
+    GetActiveHead().Set(jump_location);
+    return true;
+  }
+
+  // If complement label was not found; record an error.
+  organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR,
+		  "jump-f: No complement label");
+  return false;
+}
+
+bool cHardware4Stack::Inst_JumpB()
+{
+  ReadLabel();
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
+
+  // If there is no label, jump BX steps.
+  if (GetLabel().GetSize() == 0) {
+    GetActiveHead().Jump(-Register(REG_BX));
+    return true;
+  }
+
+  // otherwise jump to the complement label.
+  const cCPUHead jump_location(FindLabel(-1));
+  if ( jump_location.GetPosition() != -1 ) {
+    GetActiveHead().Set(jump_location);
+    return true;
+  }
+
+  // If complement label was not found; record an error.
+  organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR,
+		  "jump-b: No complement label");
+  return false;
+}
+
+bool cHardware4Stack::Inst_JumpP()
 {
   cOrganism * other_organism = organism->GetNeighbor();
 
@@ -1984,7 +2367,7 @@
   cHardware4Stack & other_hardware = (cHardware4Stack &) other_organism->GetHardware();
 
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
 
   // If there is no label, jump to line BX in creature.
   if (GetLabel().GetSize() == 0) {
@@ -2013,7 +2396,7 @@
 bool cHardware4Stack::Inst_JumpSelf()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
 
   // If there is no label, jump to line BX in creature.
   if (GetLabel().GetSize() == 0) {
@@ -2042,7 +2425,7 @@
 
   // Jump to the compliment label (or by the ammount in the bx register)
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
 
   if (GetLabel().GetSize() == 0) {
     IP().Jump(Register(REG_BX));
@@ -2081,33 +2464,10 @@
   return true;
 }
 
-bool cHardware4Stack::Inst_HeadPop()
-{
-  const int head_used = FindModifiedHead(HEAD_IP);
-  GetHead(head_used).Set(StackPop(), this);
-  return true;
-}
-
-bool cHardware4Stack::Inst_HeadPush()
-{
-  const int head_used = FindModifiedHead(HEAD_IP);
-  StackPush(GetHead(head_used).GetPosition());
-  if (head_used == HEAD_IP) {
-    GetHead(head_used).Set(GetHead(HEAD_FLOW));
-    advance_ip = false;
-  }
-  return true;
-}
-
-
 bool cHardware4Stack::Inst_PopA() { Register(REG_AX) = StackPop(); return true;}
 bool cHardware4Stack::Inst_PopB() { Register(REG_BX) = StackPop(); return true;}
 bool cHardware4Stack::Inst_PopC() { Register(REG_CX) = StackPop(); return true;}
 
-bool cHardware4Stack::Inst_PushA() { StackPush(Register(REG_AX)); return true;}
-bool cHardware4Stack::Inst_PushB() { StackPush(Register(REG_AX)); return true;}
-bool cHardware4Stack::Inst_PushC() { StackPush(Register(REG_AX)); return true;}
-
 bool cHardware4Stack::Inst_SwitchStack() { SwitchStack(); return true;}
 bool cHardware4Stack::Inst_FlipStack()   { StackFlip(); return true;}
 
@@ -2123,14 +2483,6 @@
 bool cHardware4Stack::Inst_SwapBC() { Swap(Register(REG_BX), Register(REG_CX)); return true; }
 bool cHardware4Stack::Inst_SwapAC() { Swap(Register(REG_AX), Register(REG_CX)); return true; }
 
-bool cHardware4Stack::Inst_CopyReg()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  const int other_reg = FindComplementRegister(reg_used);
-  Register(other_reg) = Register(reg_used);
-  return true;
-}
-
 bool cHardware4Stack::Inst_CopyRegAB() { Register(REG_AX) = Register(REG_BX);   return true;
 }
 bool cHardware4Stack::Inst_CopyRegAC() { Register(REG_AX) = Register(REG_CX);   return true;
@@ -2153,20 +2505,6 @@
   return true;
 }
 
-bool cHardware4Stack::Inst_ShiftR()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) >>= 1;
-  return true;
-}
-
-bool cHardware4Stack::Inst_ShiftL()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) <<= 1;
-  return true;
-}
-
 bool cHardware4Stack::Inst_Bit1()
 {
   const int reg_used = FindModifiedRegister(REG_BX);
@@ -2181,20 +2519,6 @@
   return true;
 }
 
-bool cHardware4Stack::Inst_Inc()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) += 1;
-  return true;
-}
-
-bool cHardware4Stack::Inst_Dec()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) -= 1;
-  return true;
-}
-
 bool cHardware4Stack::Inst_Zero()
 {
   const int reg_used = FindModifiedRegister(REG_BX);
@@ -2259,62 +2583,6 @@
   return true;
 }
 
-bool cHardware4Stack::Inst_Add()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) = Register(REG_BX) + Register(REG_CX);
-  return true;
-}
-
-bool cHardware4Stack::Inst_Sub()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) = Register(REG_BX) - Register(REG_CX);
-  return true;
-}
-
-bool cHardware4Stack::Inst_Mult()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) = Register(REG_BX) * Register(REG_CX);
-  return true;
-}
-
-bool cHardware4Stack::Inst_Div()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(REG_CX) != 0) {
-    if (0-INT_MAX > Register(REG_BX) && Register(REG_CX) == -1)
-      Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: Float exception");
-    else
-      Register(reg_used) = Register(REG_BX) / Register(REG_CX);
-  } else {
-    Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "div: dividing by 0");
-    return false;
-  }
-  return true;
-}
-
-bool cHardware4Stack::Inst_Mod()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  if (Register(REG_CX) != 0) {
-    Register(reg_used) = Register(REG_BX) % Register(REG_CX);
-  } else {
-    Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "mod: modding by 0");
-  return false;
-  }
-  return true;
-}
-
-
-bool cHardware4Stack::Inst_Nand()
-{
-  const int reg_used = FindModifiedRegister(REG_BX);
-  Register(reg_used) = ~(Register(REG_BX) & Register(REG_CX));
-  return true;
-}
-
 bool cHardware4Stack::Inst_Nor()
 {
   const int reg_used = FindModifiedRegister(REG_BX);
@@ -2500,18 +2768,6 @@
   return Allocate_Main(GetMemory().GetSize());   
 }
 
-bool cHardware4Stack::Inst_MaxAlloc()   // Allocate maximal more
-{
-  const int cur_size = GetMemory().GetSize();
-  const int alloc_size = Min((int) (cConfig::GetChildSizeRange() * cur_size),
-			     MAX_CREATURE_SIZE - cur_size);
-  if( Allocate_Main(alloc_size) ) {
-    Register(REG_AX) = cur_size;
-    return true;
-  } else return false;
-}
-
-
 bool cHardware4Stack::Inst_Repro()
 {
   // Setup child
@@ -2598,7 +2854,7 @@
   }
 
   // Search for the label in the host...
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
 
   const int inject_signal =
     host_organism->GetHardware().Inject(GetLabel(), inject_code);
@@ -2617,7 +2873,6 @@
   return true;
 }
 
-
 bool cHardware4Stack::Inst_InjectRand()
 {
   // Rotate to a random facing and then run the normal inject instruction
@@ -2670,7 +2925,7 @@
   }
 
   // Search for the label in the host...
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
 
   const int inject_signal =
     host_organism->GetHardware().InjectThread(GetLabel(), inject_code);
@@ -2739,7 +2994,7 @@
 bool cHardware4Stack::Inst_SearchF()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
   const int search_size = FindLabel(1).GetPosition() - IP().GetPosition();
   Register(REG_BX) = search_size;
   Register(REG_CX) = GetLabel().GetSize();
@@ -2749,7 +3004,7 @@
 bool cHardware4Stack::Inst_SearchB()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
   const int search_size = IP().GetPosition() - FindLabel(-1).GetPosition();
   Register(REG_BX) = search_size;
   Register(REG_CX) = GetLabel().GetSize();
@@ -2779,7 +3034,7 @@
   if (!GetLabel().GetSize()) return true;
 
   // Rotate until a complement label is found (or all have been checked).
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK);
   for (int i = 1; i < num_neighbors; i++) {
     cOrganism * neighbor = organism->GetNeighbor();
 
@@ -2815,7 +3070,7 @@
   if (!GetLabel().GetSize()) return true;
 
   // Rotate until a complement label is found (or all have been checked).
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(2, NUM_NOPS_4STACK)S;
   for (int i = 1; i < num_neighbors; i++) {
     cOrganism * neighbor = organism->GetNeighbor();
 
@@ -2851,24 +3106,8 @@
   if (new_mut_rate > 0.0) organism->SetCopyMutProb(new_mut_rate);
   return true;
 }
-
-
 // Multi-threading.
 
-bool cHardware4Stack::Inst_ForkThread()
-{
-  IP().Advance();
-  if (!ForkThread()) Fault(FAULT_LOC_THREAD_FORK, FAULT_TYPE_FORK_TH);
-  return true;
-}
-
-bool cHardware4Stack::Inst_KillThread()
-{
-  if (!KillThread()) Fault(FAULT_LOC_THREAD_KILL, FAULT_TYPE_KILL_TH);
-  else advance_ip = false;
-  return true;
-}
-
 bool cHardware4Stack::Inst_ThreadID()
 {
   const int reg_used = FindModifiedRegister(REG_BX);
@@ -2878,7 +3117,6 @@
 
 
 // Head-based instructions
-
 bool cHardware4Stack::Inst_SetHead()
 {
   const int head_used = FindModifiedHead(HEAD_IP);
@@ -2892,14 +3130,6 @@
   GetHead(head_used).Advance();
   return true;
 }
- 
-bool cHardware4Stack::Inst_MoveHead()
-{
-  const int head_used = FindModifiedHead(HEAD_IP);
-  GetHead(head_used).Set(GetHead(HEAD_FLOW));
-  if (head_used == HEAD_IP) advance_ip = false;
-  return true;
-}
 
 bool cHardware4Stack::Inst_JumpHead()
 {
@@ -2915,32 +3145,6 @@
   return true;
 }
 
-bool cHardware4Stack::Inst_IfLabel()
-{
-  ReadLabel();
-  GetLabel().Rotate(1);
-  if (GetLabel() != GetReadLabel())  IP().Advance();
-  return true;
-}
-
-bool cHardware4Stack::Inst_HeadDivideMut(double mut_multiplier)
-{
-  AdjustHeads();
-  const int divide_pos = GetHead(HEAD_READ).GetPosition();
-  int child_end =  GetHead(HEAD_WRITE).GetPosition();
-  if (child_end == 0) child_end = GetMemory().GetSize();
-  const int extra_lines = GetMemory().GetSize() - child_end;
-  bool ret_val = Divide_Main(divide_pos, extra_lines, mut_multiplier);
-  // Re-adjust heads.
-  AdjustHeads();
-  return ret_val; 
-}
-
-bool cHardware4Stack::Inst_HeadDivide()
-{
-  return Inst_HeadDivideMut(1);
-}
-
 bool cHardware4Stack::Inst_HeadDivideSex()  
 { 
   organism->GetPhenotype().SetDivideSex(true);
@@ -2978,81 +3182,6 @@
 bool cHardware4Stack::Inst_HeadDivide0_01()  { return Inst_HeadDivideMut(0.01); }
 bool cHardware4Stack::Inst_HeadDivide0_001()  { return Inst_HeadDivideMut(0.001); }
 
-bool cHardware4Stack::Inst_HeadRead()
-{
-  const int head_id = FindModifiedHead(HEAD_READ);
-  GetHead(head_id).Adjust();
-  sCPUStats & cpu_stats = organism->CPUStats();
-
-  // Mutations only occur on the read, for the moment.
-  int read_inst = 0;
-  if (organism->TestCopyMut()) {
-    read_inst = GetRandomInst().GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
-  } else {
-    read_inst = GetHead(head_id).GetInst().GetOp();
-  }
-  Register(REG_BX) = read_inst;
-  ReadInst(read_inst);
-
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
-  GetHead(head_id).Advance();
-  return true;
-}
-
-bool cHardware4Stack::Inst_HeadWrite()
-{
-  const int head_id = FindModifiedHead(HEAD_WRITE);
-  cCPUHead & active_head = GetHead(head_id);
-
-  active_head.Adjust();
-
-  int value = Register(REG_BX);
-  if (value < 0 || value >= GetNumInst()) value = 0;
-
-  active_head.SetInst(cInstruction(value));
-  active_head.FlagCopied() = true;
-
-  // Advance the head after write...
-  active_head++;
-  return true;
-}
-
-bool cHardware4Stack::Inst_HeadCopy()
-{
-  // For the moment, this cannot be nop-modified.
-  cCPUHead & read_head = GetHead(HEAD_READ);
-  cCPUHead & write_head = GetHead(HEAD_WRITE);
-  sCPUStats & cpu_stats = organism->CPUStats();
-
-  read_head.Adjust();
-  write_head.Adjust();
-
-  // TriggerMutations(MUTATION_TRIGGER_READ, read_head);
-  
-  // Do mutations.
-  cInstruction read_inst = read_head.GetInst();
-  if (organism->TestCopyMut()) {
-    read_inst = GetRandomInst();
-    cpu_stats.mut_stats.copy_mut_count++; 
-    write_head.FlagMutated() = true;
-    write_head.FlagCopyMut() = true;
-    //organism->GetPhenotype().IsMutated() = true;
-  }
-  ReadInst(read_inst.GetOp());
-
-  cpu_stats.mut_stats.copies_exec++;
-
-  write_head.SetInst(read_inst);
-  write_head.FlagCopied() = true;  // Set the copied flag...
-
-  // TriggerMutations(MUTATION_TRIGGER_WRITE, write_head);
-
-  read_head.Advance();
-  write_head.Advance();
-  return true;
-}
-
 bool cHardware4Stack::HeadCopy_ErrorCorrect(double reduction)
 {
   // For the moment, this cannot be nop-modified.
@@ -3094,19 +3223,6 @@
 bool cHardware4Stack::Inst_HeadCopy9()  { return HeadCopy_ErrorCorrect(9); }
 bool cHardware4Stack::Inst_HeadCopy10() { return HeadCopy_ErrorCorrect(10); }
 
-bool cHardware4Stack::Inst_HeadSearch()
-{
-  ReadLabel();
-  GetLabel().Rotate(1);
-  cCPUHead found_pos = FindLabel(0);
-  const int search_size = found_pos.GetPosition() - IP().GetPosition();
-  Register(REG_BX) = search_size;
-  Register(REG_CX) = GetLabel().GetSize();
-  GetHead(HEAD_FLOW).Set(found_pos);
-  GetHead(HEAD_FLOW).Advance();
-  return true; 
-}
-
 bool cHardware4Stack::Inst_SetFlow()
 {
   const int reg_used = FindModifiedRegister(REG_CX);
@@ -3139,12 +3255,11 @@
   return false;
 }
 
-
 //// Placebo insts ////
 bool cHardware4Stack::Inst_Skip()
 {
   IP().Advance();
   return true;
 }
-
+*/
 
Index: avida/current/source/cpu/hardware_4stack.hh
diff -u avida/current/source/cpu/hardware_4stack.hh:1.2.2.1 avida/current/source/cpu/hardware_4stack.hh:1.2.2.2
--- avida/current/source/cpu/hardware_4stack.hh:1.2.2.1	Tue May 20 05:12:19 2003
+++ avida/current/source/cpu/hardware_4stack.hh	Thu May 29 11:47:51 2003
@@ -26,6 +26,16 @@
 class cOrganism;
 class cMutation;
 
+//new-style constant declarations - law 
+static const int NUM_LOCAL_STACKS = 2;
+static const int NUM_GLOBAL_STACKS = 2;
+static const int NUM_STACKS = NUM_LOCAL_STACKS + NUM_GLOBAL_STACKS;
+static const int STACK_AX = 0;
+static const int STACK_BX = 1;
+static const int STACK_CX = 2;
+static const int STACK_DX = 3;
+static const int NUM_NOPS_4STACK = 4;
+
 /**
  * This class is needed to run several threads on a single genome.
  *
@@ -36,11 +46,12 @@
 private:
   int id;
 public:
-  int reg[NUM_REGISTERS];
+  int reg[NUM_REG_4STACK];
   cCPUHead heads[NUM_HEADS];
   cCPUStack stack;
   UCHAR cur_stack;              // 0 = local stack, 1 = global stack.
   UCHAR cur_head;
+  cCPUStack local_stacks[NUM_LOCAL_STACKS];
 
   UCHAR input_pointer;
   tBuffer<int> input_buf;
@@ -86,6 +97,7 @@
 private:
   cCPUMemory memory;          // Memory...
   cCPUStack global_stack;     // A stack that all threads share.
+  cCPUStack global_stacks[NUM_GLOBAL_STACKS];
   int thread_time_used;
 
   tArray<cHardware4Stack_Thread> threads;
@@ -107,6 +119,8 @@
   ~cHardware4Stack();
   void Recycle(cOrganism * new_organism, cInstSet * in_inst_set);
   static cInstLibBase *GetInstLib();
+  static cString GetDefaultInstFilename() { return "inst_lib.4stack"; }
+  static void WriteDefaultInstSet() { ; }
 
   void Reset();
   void SingleProcess(std::ostream * trace_fp=NULL);
@@ -130,6 +144,8 @@
   inline void StackClear();
   inline void SwitchStack();
   int GetActiveStackID() const { return threads[cur_thread].cur_stack; }
+  //NEW STUFF
+  inline cCPUStack & Stack(int stack_id); //retrieves appropriate stack
 
   // --------  Tasks & IO  --------
   tBuffer<int> & GetInputBuffer() { return threads[cur_thread].input_buf; }
@@ -241,11 +257,12 @@
  /////////---------- Instruction Helpers ------------//////////
 
   int FindModifiedRegister(int default_register);
+  int FindModifiedStack(int default_stack);
   int FindModifiedHead(int default_head);
   int FindComplementRegister(int base_reg);
+  int FindComplementStack(int base_stack);
 
-  void Fault(int fault_loc, int fault_type, cString fault_desc="");
-
+  void Fault(int fault_loc, int fault_type, cString fault_desc=""); 
   bool Allocate_Necro(const int new_size);
   bool Allocate_Random(const int old_size, const int new_size);
   bool Allocate_Default(const int new_size);
@@ -307,7 +324,7 @@
   bool Inst_SwapAB();
   bool Inst_SwapBC();
   bool Inst_SwapAC();
-  bool Inst_CopyReg();
+  bool Inst_CopyStack();
   bool Inst_CopyRegAB();
   bool Inst_CopyRegAC();
   bool Inst_CopyRegBA();
@@ -562,6 +579,18 @@
 {
   threads[cur_thread].cur_stack++;
   if (threads[cur_thread].cur_stack > 1) threads[cur_thread].cur_stack = 0;
+}
+
+inline cCPUStack& cHardware4Stack::Stack(int stack_id)
+{
+  if(stack_id >= NUM_STACKS)
+    {
+      stack_id=0;
+    }
+  if(stack_id < NUM_LOCAL_STACKS)
+    return threads[cur_thread].local_stacks[stack_id];
+  else
+    return global_stacks[stack_id % NUM_LOCAL_STACKS];
 }
 
 #endif
Index: avida/current/source/cpu/hardware_cpu.cc
diff -u avida/current/source/cpu/hardware_cpu.cc:1.34.2.6 avida/current/source/cpu/hardware_cpu.cc:1.34.2.7
--- avida/current/source/cpu/hardware_cpu.cc:1.34.2.6	Fri May 23 04:07:40 2003
+++ avida/current/source/cpu/hardware_cpu.cc	Thu May 29 11:47:51 2003
@@ -241,9 +241,10 @@
 cInstLibCPU *cHardwareCPU::s_inst_slib = cHardwareCPU::initInstLib();
 cInstLibCPU *cHardwareCPU::initInstLib(void){
   struct cNOPEntryCPU {
-    cNOPEntryCPU(const cString &name, int nop_mod):name(name), nop_mod(nop_mod){}
     cString name;
     int nop_mod;
+    cNOPEntryCPU(const cString &name, int nop_mod)
+      : name(name), nop_mod(nop_mod) {}
   };
   static const cNOPEntryCPU s_n_array[] = {
     cNOPEntryCPU("nop-A", REG_AX),
@@ -251,10 +252,15 @@
     cNOPEntryCPU("nop-C", REG_CX)
   };
 
-  struct cInstEntryCPU {
-    cInstEntryCPU(const cString &name, tHardwareCPUMethod function):name(name), function(function){}
-    cString name;
-    tHardwareCPUMethod function;
+  struct cInstEntryCPU { 
+    const cString name;
+    const tHardwareCPUMethod function;
+    const bool is_default;
+    const cString desc;
+
+    cInstEntryCPU(const cString & _name, tHardwareCPUMethod _fun,
+		  bool _def=false, const cString & _desc="")
+      : name(_name), function(_fun), is_default(_def), desc(_desc) {}
   };
   static const cInstEntryCPU s_f_array[] = {
     /*
@@ -262,30 +268,39 @@
     in the same order in cInstEntryCPU s_f_array, and these entries must
     be the first elements of s_f_array.
     */
-    cInstEntryCPU("nop-A",     &cHardwareCPU::Inst_Nop),
-    cInstEntryCPU("nop-B",     &cHardwareCPU::Inst_Nop),
-    cInstEntryCPU("nop-C",     &cHardwareCPU::Inst_Nop),
-
-    // Added "map-null" for use in analyze mode. -- kgn
-    cInstEntryCPU("map-null",     &cHardwareCPU::Inst_Nop),
-    cInstEntryCPU("nop-X",     &cHardwareCPU::Inst_Nop),
-    cInstEntryCPU("if-equ-0",  &cHardwareCPU::Inst_If0),
-    cInstEntryCPU("if-not-0",  &cHardwareCPU::Inst_IfNot0),
-    cInstEntryCPU("if-n-equ",  &cHardwareCPU::Inst_IfNEqu),
-    cInstEntryCPU("if-equ",    &cHardwareCPU::Inst_IfEqu),
+    cInstEntryCPU("nop-A",     &cHardwareCPU::Inst_Nop, true,
+		  "No-operation instruction; modifies other instructions"),
+    cInstEntryCPU("nop-B",     &cHardwareCPU::Inst_Nop, true,
+		  "No-operation instruction; modifies other instructions"),
+    cInstEntryCPU("nop-C",     &cHardwareCPU::Inst_Nop, true,
+		  "No-operation instruction; modifies other instructions"),
+
+    cInstEntryCPU("NULL",      &cHardwareCPU::Inst_Nop, false,
+		  "True no-operation instruction: does nothing"),
+    cInstEntryCPU("nop-X",     &cHardwareCPU::Inst_Nop, false,
+		  "True no-operation instruction: does nothing"),
+    cInstEntryCPU("if-equ-0",  &cHardwareCPU::Inst_If0, false,
+		  "Execute next instruction if ?BX?==0, else skip it"),
+    cInstEntryCPU("if-not-0",  &cHardwareCPU::Inst_IfNot0, false,
+		  "Execute next instruction if ?BX?!=0, else skip it"),
+    cInstEntryCPU("if-n-equ",  &cHardwareCPU::Inst_IfNEqu, true,
+		  "Execute next instruction if ?BX?!=?CX?, else skip it"),
+    cInstEntryCPU("if-equ",    &cHardwareCPU::Inst_IfEqu, false,
+		  "Execute next instruction if ?BX?==?CX?, else skip it"),
     cInstEntryCPU("if-grt-0",  &cHardwareCPU::Inst_IfGr0),
     cInstEntryCPU("if-grt",    &cHardwareCPU::Inst_IfGr),
     cInstEntryCPU("if->=-0",   &cHardwareCPU::Inst_IfGrEqu0),
     cInstEntryCPU("if->=",     &cHardwareCPU::Inst_IfGrEqu),
     cInstEntryCPU("if-les-0",  &cHardwareCPU::Inst_IfLess0),
-    cInstEntryCPU("if-less",   &cHardwareCPU::Inst_IfLess),
+    cInstEntryCPU("if-less",   &cHardwareCPU::Inst_IfLess, true,
+		  "Execute next instruction if ?BX? < ?CX?, else skip it"),
     cInstEntryCPU("if-<=-0",   &cHardwareCPU::Inst_IfLsEqu0),
     cInstEntryCPU("if-<=",     &cHardwareCPU::Inst_IfLsEqu),
     cInstEntryCPU("if-A!=B",   &cHardwareCPU::Inst_IfANotEqB),
     cInstEntryCPU("if-B!=C",   &cHardwareCPU::Inst_IfBNotEqC),
     cInstEntryCPU("if-A!=C",   &cHardwareCPU::Inst_IfANotEqC),
-    
     cInstEntryCPU("if-bit-1",  &cHardwareCPU::Inst_IfBit1),
+
     cInstEntryCPU("jump-f",    &cHardwareCPU::Inst_JumpF),
     cInstEntryCPU("jump-b",    &cHardwareCPU::Inst_JumpB),
     cInstEntryCPU("jump-p",    &cHardwareCPU::Inst_JumpP),
@@ -293,11 +308,15 @@
     cInstEntryCPU("call",      &cHardwareCPU::Inst_Call),
     cInstEntryCPU("return",    &cHardwareCPU::Inst_Return),
 
-    cInstEntryCPU("pop",       &cHardwareCPU::Inst_Pop),
-    cInstEntryCPU("push",      &cHardwareCPU::Inst_Push),
-    cInstEntryCPU("swap-stk",  &cHardwareCPU::Inst_SwitchStack),
+    cInstEntryCPU("pop",       &cHardwareCPU::Inst_Pop, true,
+		  "Remove top number from stack and place into ?BX?"),
+    cInstEntryCPU("push",      &cHardwareCPU::Inst_Push, true,
+		  "Copy number from ?BX? and place it into the stack"),
+    cInstEntryCPU("swap-stk",  &cHardwareCPU::Inst_SwitchStack, true,
+		  "Toggle which stack is currently being used"),
     cInstEntryCPU("flip-stk",  &cHardwareCPU::Inst_FlipStack),
-    cInstEntryCPU("swap",      &cHardwareCPU::Inst_Swap),
+    cInstEntryCPU("swap",      &cHardwareCPU::Inst_Swap, true,
+		  "Swap the contents of ?BX? with ?CX?"),
     cInstEntryCPU("swap-AB",   &cHardwareCPU::Inst_SwapAB),
     cInstEntryCPU("swap-BC",   &cHardwareCPU::Inst_SwapBC),
     cInstEntryCPU("swap-AC",   &cHardwareCPU::Inst_SwapAC),
@@ -317,25 +336,35 @@
     cInstEntryCPU("push-B",    &cHardwareCPU::Inst_PushB),
     cInstEntryCPU("push-C",    &cHardwareCPU::Inst_PushC),
 
-    cInstEntryCPU("shift-r",   &cHardwareCPU::Inst_ShiftR),
-    cInstEntryCPU("shift-l",   &cHardwareCPU::Inst_ShiftL),
+    cInstEntryCPU("shift-r",   &cHardwareCPU::Inst_ShiftR, true,
+		  "Shift bits in ?BX? right by one (divide by two)"),
+    cInstEntryCPU("shift-l",   &cHardwareCPU::Inst_ShiftL, true,
+		  "Shift bits in ?BX? left by one (multiply by two)"),
     cInstEntryCPU("bit-1",     &cHardwareCPU::Inst_Bit1),
     cInstEntryCPU("set-num",   &cHardwareCPU::Inst_SetNum),
-    cInstEntryCPU("inc",       &cHardwareCPU::Inst_Inc),
-    cInstEntryCPU("dec",       &cHardwareCPU::Inst_Dec),
-    cInstEntryCPU("zero",      &cHardwareCPU::Inst_Zero),
+    cInstEntryCPU("inc",       &cHardwareCPU::Inst_Inc, true,
+		  "Increment ?BX? by one"),
+    cInstEntryCPU("dec",       &cHardwareCPU::Inst_Dec, true,
+		  "Decrement ?BX? by one"),
+    cInstEntryCPU("zero",      &cHardwareCPU::Inst_Zero, false,
+		  "Set ?BX? to zero"),
     cInstEntryCPU("neg",       &cHardwareCPU::Inst_Neg),
     cInstEntryCPU("square",    &cHardwareCPU::Inst_Square),
     cInstEntryCPU("sqrt",      &cHardwareCPU::Inst_Sqrt),
     cInstEntryCPU("not",       &cHardwareCPU::Inst_Not),
     cInstEntryCPU("minus-17",  &cHardwareCPU::Inst_Minus17),
     
-    cInstEntryCPU("add",       &cHardwareCPU::Inst_Add),
-    cInstEntryCPU("sub",       &cHardwareCPU::Inst_Sub),
-    cInstEntryCPU("mult",      &cHardwareCPU::Inst_Mult),
-    cInstEntryCPU("div",       &cHardwareCPU::Inst_Div),
+    cInstEntryCPU("add",       &cHardwareCPU::Inst_Add, true,
+		  "Add BX to CX and place the result in ?BX?"),
+    cInstEntryCPU("sub",       &cHardwareCPU::Inst_Sub, true,
+		  "Subtract CX from BX and place the result in ?BX?"),
+    cInstEntryCPU("mult",      &cHardwareCPU::Inst_Mult, false,
+		  "Multiple BX by CX and place the result in ?BX?"),
+    cInstEntryCPU("div",       &cHardwareCPU::Inst_Div, false,
+		  "Divide BX by CX and place the result in ?BX?"),
     cInstEntryCPU("mod",       &cHardwareCPU::Inst_Mod),
-    cInstEntryCPU("nand",      &cHardwareCPU::Inst_Nand),
+    cInstEntryCPU("nand",      &cHardwareCPU::Inst_Nand, true,
+		  "Nand BX by CX and place the result in ?BX?"),
     cInstEntryCPU("nor",       &cHardwareCPU::Inst_Nor),
     cInstEntryCPU("and",       &cHardwareCPU::Inst_And),
     cInstEntryCPU("order",     &cHardwareCPU::Inst_Order),
@@ -359,7 +388,8 @@
     cInstEntryCPU("stk-get",   &cHardwareCPU::Inst_TaskStackGet),
     cInstEntryCPU("stk-load",  &cHardwareCPU::Inst_TaskStackLoad),
     cInstEntryCPU("put",       &cHardwareCPU::Inst_TaskPut),
-    cInstEntryCPU("IO",        &cHardwareCPU::Inst_TaskIO),
+    cInstEntryCPU("IO",        &cHardwareCPU::Inst_TaskIO, true,
+		  "Output ?BX?, and input new number back into ?BX?"),
     cInstEntryCPU("search-f",  &cHardwareCPU::Inst_SearchF),
     cInstEntryCPU("search-b",  &cHardwareCPU::Inst_SearchB),
     cInstEntryCPU("mem-size",  &cHardwareCPU::Inst_MemSize),
@@ -376,21 +406,30 @@
     cInstEntryCPU("id-th",     &cHardwareCPU::Inst_ThreadID),
 
     // Head-based instructions
-    cInstEntryCPU("h-alloc",   &cHardwareCPU::Inst_MaxAlloc),
-    cInstEntryCPU("h-divide",  &cHardwareCPU::Inst_HeadDivide),
+    cInstEntryCPU("h-alloc",   &cHardwareCPU::Inst_MaxAlloc, true,
+		  "Allocate maximum allowed space"),
+    cInstEntryCPU("h-divide",  &cHardwareCPU::Inst_HeadDivide, true,
+		  "Divide code between read and write heads."),
     cInstEntryCPU("h-read",    &cHardwareCPU::Inst_HeadRead),
     cInstEntryCPU("h-write",   &cHardwareCPU::Inst_HeadWrite),
-    cInstEntryCPU("h-copy",    &cHardwareCPU::Inst_HeadCopy),
-    cInstEntryCPU("h-search",  &cHardwareCPU::Inst_HeadSearch),
+    cInstEntryCPU("h-copy",    &cHardwareCPU::Inst_HeadCopy, true,
+		  "Copy from read-head to write-head; advance both"),
+    cInstEntryCPU("h-search",  &cHardwareCPU::Inst_HeadSearch, true,
+		  "Find complement template and make with flow head"),
     cInstEntryCPU("h-push",    &cHardwareCPU::Inst_HeadPush),
     cInstEntryCPU("h-pop",     &cHardwareCPU::Inst_HeadPop),
     cInstEntryCPU("set-head",  &cHardwareCPU::Inst_SetHead),
     cInstEntryCPU("adv-head",  &cHardwareCPU::Inst_AdvanceHead),
-    cInstEntryCPU("mov-head",  &cHardwareCPU::Inst_MoveHead),
-    cInstEntryCPU("jmp-head",  &cHardwareCPU::Inst_JumpHead),
-    cInstEntryCPU("get-head",  &cHardwareCPU::Inst_GetHead),
-    cInstEntryCPU("if-label",  &cHardwareCPU::Inst_IfLabel),
-    cInstEntryCPU("set-flow",  &cHardwareCPU::Inst_SetFlow),
+    cInstEntryCPU("mov-head",  &cHardwareCPU::Inst_MoveHead, true,
+		  "Move head ?IP? to the flow head"),
+    cInstEntryCPU("jmp-head",  &cHardwareCPU::Inst_JumpHead, true,
+		  "Move head ?IP? by amount in CX register; CX = old pos."),
+    cInstEntryCPU("get-head",  &cHardwareCPU::Inst_GetHead, true,
+		  "Copy the position of the ?IP? head into CX"),
+    cInstEntryCPU("if-label",  &cHardwareCPU::Inst_IfLabel, true,
+		  "Execute next if we copied complement of attached label"),
+    cInstEntryCPU("set-flow",  &cHardwareCPU::Inst_SetFlow, true,
+		  "Set flow-head to position in ?CX?"),
 
     cInstEntryCPU("h-copy2",    &cHardwareCPU::Inst_HeadCopy2),
     cInstEntryCPU("h-copy3",    &cHardwareCPU::Inst_HeadCopy3),
@@ -2031,7 +2070,7 @@
 bool cHardwareCPU::Inst_JumpF()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   // If there is no label, jump BX steps.
   if (GetLabel().GetSize() == 0) {
@@ -2056,7 +2095,7 @@
 bool cHardwareCPU::Inst_JumpB()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   // If there is no label, jump BX steps.
   if (GetLabel().GetSize() == 0) {
@@ -2096,7 +2135,7 @@
   cHardwareCPU & other_hardware = (cHardwareCPU &) other_organism->GetHardware();
 
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   // If there is no label, jump to line BX in creature.
   if (GetLabel().GetSize() == 0) {
@@ -2125,7 +2164,7 @@
 bool cHardwareCPU::Inst_JumpSelf()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   // If there is no label, jump to line BX in creature.
   if (GetLabel().GetSize() == 0) {
@@ -2154,7 +2193,7 @@
 
   // Jump to the compliment label (or by the ammount in the bx register)
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   if (GetLabel().GetSize() == 0) {
     IP().Jump(Register(REG_BX));
@@ -2217,8 +2256,8 @@
 bool cHardwareCPU::Inst_PopC() { Register(REG_CX) = StackPop(); return true;}
 
 bool cHardwareCPU::Inst_PushA() { StackPush(Register(REG_AX)); return true;}
-bool cHardwareCPU::Inst_PushB() { StackPush(Register(REG_AX)); return true;}
-bool cHardwareCPU::Inst_PushC() { StackPush(Register(REG_AX)); return true;}
+bool cHardwareCPU::Inst_PushB() { StackPush(Register(REG_BX)); return true;}
+bool cHardwareCPU::Inst_PushC() { StackPush(Register(REG_CX)); return true;}
 
 bool cHardwareCPU::Inst_SwitchStack() { SwitchStack(); return true;}
 bool cHardwareCPU::Inst_FlipStack()   { StackFlip(); return true;}
@@ -2289,7 +2328,7 @@
 bool cHardwareCPU::Inst_SetNum()
 {
   ReadLabel();
-  Register(REG_BX) = GetLabel().AsInt();
+  Register(REG_BX) = GetLabel().AsInt(NUM_NOPS);
   return true;
 }
 
@@ -2710,7 +2749,7 @@
   }
 
   // Search for the label in the host...
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   const int inject_signal =
     host_organism->GetHardware().Inject(GetLabel(), inject_code);
@@ -2782,7 +2821,7 @@
   }
 
   // Search for the label in the host...
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
 
   const int inject_signal =
     host_organism->GetHardware().InjectThread(GetLabel(), inject_code);
@@ -2851,7 +2890,7 @@
 bool cHardwareCPU::Inst_SearchF()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   const int search_size = FindLabel(1).GetPosition() - IP().GetPosition();
   Register(REG_BX) = search_size;
   Register(REG_CX) = GetLabel().GetSize();
@@ -2861,7 +2900,7 @@
 bool cHardwareCPU::Inst_SearchB()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   const int search_size = IP().GetPosition() - FindLabel(-1).GetPosition();
   Register(REG_BX) = search_size;
   Register(REG_CX) = GetLabel().GetSize();
@@ -2891,7 +2930,7 @@
   if (!GetLabel().GetSize()) return true;
 
   // Rotate until a complement label is found (or all have been checked).
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   for (int i = 1; i < num_neighbors; i++) {
     cOrganism * neighbor = organism->GetNeighbor();
 
@@ -2927,7 +2966,7 @@
   if (!GetLabel().GetSize()) return true;
 
   // Rotate until a complement label is found (or all have been checked).
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   for (int i = 1; i < num_neighbors; i++) {
     cOrganism * neighbor = organism->GetNeighbor();
 
@@ -3030,7 +3069,7 @@
 bool cHardwareCPU::Inst_IfLabel()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   if (GetLabel() != GetReadLabel())  IP().Advance();
   return true;
 }
@@ -3209,7 +3248,7 @@
 bool cHardwareCPU::Inst_HeadSearch()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   cCPUHead found_pos = FindLabel(0);
   const int search_size = found_pos.GetPosition() - IP().GetPosition();
   Register(REG_BX) = search_size;
Index: avida/current/source/cpu/hardware_cpu.hh
diff -u avida/current/source/cpu/hardware_cpu.hh:1.19.2.3 avida/current/source/cpu/hardware_cpu.hh:1.19.2.4
--- avida/current/source/cpu/hardware_cpu.hh:1.19.2.3	Tue May 20 05:12:19 2003
+++ avida/current/source/cpu/hardware_cpu.hh	Thu May 29 11:47:52 2003
@@ -26,6 +26,8 @@
 class cOrganism;
 class cMutation;
 
+static const int NUM_NOPS = 3;
+
 /**
  * This class is needed to run several threads on a single genome.
  *
@@ -107,6 +109,8 @@
   ~cHardwareCPU();
   void Recycle(cOrganism * new_organism, cInstSet * in_inst_set);
   static cInstLibBase *GetInstLib();
+  static cString GetDefaultInstFilename() { return "inst_lib.default"; }
+  static void WriteDefaultInstSet() { ; }
 
   void Reset();
   void SingleProcess(std::ostream * trace_fp=NULL);
Index: avida/current/source/cpu/hardware_util.cc
diff -u avida/current/source/cpu/hardware_util.cc:1.12.2.7 avida/current/source/cpu/hardware_util.cc:1.12.2.8
--- avida/current/source/cpu/hardware_util.cc:1.12.2.7	Fri May 23 05:05:08 2003
+++ avida/current/source/cpu/hardware_util.cc	Thu May 29 11:47:52 2003
@@ -23,17 +23,54 @@
 
 
 #ifdef USE_INST_SET_CODE
-void cHardwareUtil::LoadInstSet(const cString & filename, cInstSet & inst_set, 
+void cHardwareUtil::LoadInstSet(cString filename, cInstSet & inst_set, 
 				tDictionary<int> & nop_dict,
 				tDictionary<int> & inst_dict
 ){
 #else /* USE_INST_SET_CODE */
-void cHardwareUtil::LoadInstSet(const cString & filename, cInstSet & inst_set, 
+void cHardwareUtil::LoadInstSet(cString & filename, cInstSet & inst_set, 
 				tDictionary<int> & nop_dict,
 				tDictionary<tHardwareMethod> & inst_dict
 ){
 #endif /* USE_INST_SET_CODE */
+  // If there is no filename, use the default for the appropriate hardware.
+  cString default_filename = "unknown";
+  if (cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_ORIGINAL) {
+    default_filename = cHardwareCPU::GetDefaultInstFilename();
+  }
+  else if (cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_4STACK) {
+    default_filename = cHardware4Stack::GetDefaultInstFilename();
+  }
+
+  if (filename == "") {
+    cerr << "Warning: No instruction set specified; using default '"
+	 << filename << "'." << endl;
+    filename = default_filename;
+  }
+
   cInitFile file(filename);
+
+  // If we could not open the instruction set what to do?
+  if (file.IsOpen() == false) {
+
+    // If this is the default filename, write the file and try again.
+    if (filename == default_filename) {
+      if (cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_ORIGINAL) {
+	cHardwareCPU::WriteDefaultInstSet();
+      }
+      else if (cConfig::GetHardwareType() == HARDWARE_TYPE_CPU_4STACK) {
+	cHardware4Stack::WriteDefaultInstSet();
+      }      
+    }
+
+    // If this is not the default filename, give and error and stop.
+    else {
+      cerr << "Error: Could not open instruction set '" << filename
+	   << "'.  Halting." << endl;
+      exit(1);
+    }
+  }
+
   file.Load();
   file.Compress();
 
@@ -55,16 +92,25 @@
     
     // Otherwise, this instruction will be in the set.
     // First, determine if it is a nop...
-    int nop_mod = -1;
-    if (nop_dict.Find(inst_name, nop_mod) == true) {
 #ifdef USE_INST_SET_CODE
+    /* XXX start -- kgn */
+    int nop_mod = -1;
+    if(nop_dict.Find(inst_name, nop_mod) == true) {
       inst_set.AddNop2(nop_mod, redundancy, ft_cost, cost, prob_fail);
+      continue;
+    }
+    /* XXX end */
 #else /* USE_INST_SET_CODE */
+    int nop_mod = -1;
+    /* XXX start -- kgn */
+    int nop_mod_2 = -1;
+    /* XXX end */
+    if (nop_dict.Find(inst_name, nop_mod) == true) {
       inst_set.AddNop(inst_name, &cHardwareBase::Inst_Nop, nop_mod,
 		      redundancy, ft_cost, cost, prob_fail);
-#endif /* USE_INST_SET_CODE */
       continue;
     }
+#endif /* USE_INST_SET_CODE */
 
     // Otherwise, it had better be in the main dictionary...
 #ifdef USE_INST_SET_CODE
@@ -77,6 +123,9 @@
     /* XXX end */
 #else /* USE_INST_SET_CODE */
     tHardwareMethod cpu_method = NULL;
+    /* XXX start -- kgn */
+    int fun_id = -1;
+    /* XXX end */
     if (inst_dict.Find(inst_name, cpu_method) == true) {
       inst_set.Add(inst_name, cpu_method, redundancy, ft_cost, cost, prob_fail);
       continue;
@@ -334,15 +383,89 @@
   //  first instructions added to the set.
 #ifndef USE_INST_SET_CODE
   tDictionary< int > nop_dict;
-  nop_dict.Add("nop-A", REG_AX);
-  nop_dict.Add("nop-B", REG_BX);
-  nop_dict.Add("nop-C", REG_CX);
+  nop_dict.Add("Nop-A", REG_AX);
+  nop_dict.Add("Nop-B", REG_BX);
+  nop_dict.Add("Nop-C", REG_CX);
+  nop_dict.Add("Nop-D", REG_DX);
 #endif /* !USE_INST_SET_CODE */
 
   // Build a dictionary of instructions and their corresponding methods...
 #ifndef USE_INST_SET_CODE
   tDictionary< tHardwareMethod > inst_dict;
-
+  
+  // Remaining instructions.
+  //1
+  //inst_dict.Add("nop-A",     &cHardware4Stack::Inst_Nop), 
+  //2
+  //inst_dict.Add("nop-B",     &cHardware4Stack::Inst_Nop), 
+  //3
+  //inst_dict.Add("nop-C",     &cHardware4Stack::Inst_Nop),   
+  //4 - not implemented yet...
+  //inst_dict.Add("nop-D",     &cHardware4Stack::Inst_Nop), 
+  //5
+  inst_dict.Add("Nop-X", (tHardwareMethod) &cHardware4Stack::Inst_Nop);
+  //6 
+  inst_dict.Add("Val-Shift-R", (tHardwareMethod) &cHardware4Stack::Inst_ShiftR);
+  //7
+  inst_dict.Add("Val-Shift-L", (tHardwareMethod) &cHardware4Stack::Inst_ShiftL);
+  //8
+  inst_dict.Add("Val-Nand",  (tHardwareMethod) &cHardware4Stack::Inst_Nand);
+  //9
+  inst_dict.Add("Val-Add",  (tHardwareMethod) &cHardware4Stack::Inst_Add);
+  //10
+  inst_dict.Add("Val-Sub",  (tHardwareMethod)  &cHardware4Stack::Inst_Sub);
+  //11
+  inst_dict.Add("Val-Mult",  (tHardwareMethod) &cHardware4Stack::Inst_Mult);
+  //12
+  inst_dict.Add("Val-Div",   (tHardwareMethod) &cHardware4Stack::Inst_Div);
+  //13
+  inst_dict.Add("SetMemory", (tHardwareMethod) &cHardware4Stack::Inst_MaxAlloc);
+  //14
+  inst_dict.Add("Divide", (tHardwareMethod) &cHardware4Stack::Inst_HeadDivide);
+  //15
+  inst_dict.Add("Inst-Read", (tHardwareMethod) &cHardware4Stack::Inst_HeadRead);
+  //16
+  inst_dict.Add("Inst-Write", (tHardwareMethod) &cHardware4Stack::Inst_HeadWrite);
+  //keeping this one for the transition period
+  inst_dict.Add("Inst-Copy", (tHardwareMethod) &cHardware4Stack::Inst_HeadCopy);
+  //17
+  inst_dict.Add("If-Equal", (tHardwareMethod) &cHardware4Stack::Inst_IfEqu);
+  //18
+  inst_dict.Add("If-Not-Equal", (tHardwareMethod) &cHardware4Stack::Inst_IfNEqu);
+  //19
+  inst_dict.Add("If-Less", (tHardwareMethod) &cHardware4Stack::Inst_IfLess);
+  //20
+  inst_dict.Add("If-Greater", (tHardwareMethod) &cHardware4Stack::Inst_IfGr);
+  //21
+  inst_dict.Add("Head-Push",  (tHardwareMethod) &cHardware4Stack::Inst_HeadPush);
+  //22
+  inst_dict.Add("Head-Pop",  (tHardwareMethod) &cHardware4Stack::Inst_HeadPop);
+  //23
+  inst_dict.Add("Head-Move", (tHardwareMethod) &cHardware4Stack::Inst_MoveHead);
+  //24
+  inst_dict.Add("Search", (tHardwareMethod) &cHardware4Stack::Inst_HeadSearch);
+  //25
+  inst_dict.Add("Push-Next", (tHardwareMethod) &cHardware4Stack::Inst_PushA);
+  //26
+  inst_dict.Add("Push-Prev", (tHardwareMethod) &cHardware4Stack::Inst_PushB);
+  //27
+  inst_dict.Add("Push-Comp", (tHardwareMethod) &cHardware4Stack::Inst_PushC);
+  //28 - Not implemented yet...
+  //inst_dict.Add("Val-Delete", &cHardware4Stack::Inst_ValDelete
+  //29
+  inst_dict.Add("Val-Copy", (tHardwareMethod) &cHardware4Stack::Inst_CopyReg);
+  //30
+  inst_dict.Add("ThreadFork", (tHardwareMethod) &cHardware4Stack::Inst_ForkThread);
+  //31
+  inst_dict.Add("if-label", (tHardwareMethod) &cHardware4Stack::Inst_IfLabel);
+  //32
+  inst_dict.Add("Val-Inc", (tHardwareMethod) &cHardware4Stack::Inst_Inc);
+  //33
+  inst_dict.Add("Val-Dec", (tHardwareMethod) &cHardware4Stack::Inst_Dec);
+  //34
+  inst_dict.Add("Val-Mod",  (tHardwareMethod) &cHardware4Stack::Inst_Mod);
+  //35
+  inst_dict.Add("ThreadKill", (tHardwareMethod) &cHardware4Stack::Inst_KillThread);/*
   // Remaining instructions.
   inst_dict.Add("nop-X",    (tHardwareMethod) &cHardware4Stack::Inst_Nop);
   inst_dict.Add("if-equ-0", (tHardwareMethod) &cHardware4Stack::Inst_If0);
@@ -543,6 +666,10 @@
   // Placebo instructions
   // nop-x (included with nops)
   inst_dict.Add("skip", (tHardwareMethod) &cHardware4Stack::Inst_Skip);
+										*/
+  cout << "BLEE! Instruction Library in util has " << inst_dict.GetSize()
+       << " instructions + " << nop_dict.GetSize() << " nops." << endl;
+
 #endif /* !USE_INST_SET_CODE */
   
 #ifdef USE_INST_SET_CODE
@@ -558,7 +685,7 @@
 #endif /* USE_INST_SET_CODE */
 
   cout << "Instruction Library in util has " << inst_dict.GetSize()
-       << " instructions." << endl;
+       << " instructions and " << nop_dict.GetSize() <<  " nops." << endl;
 
 
   // And load it on up!
Index: avida/current/source/cpu/hardware_util.hh
diff -u avida/current/source/cpu/hardware_util.hh:1.2.2.3 avida/current/source/cpu/hardware_util.hh:1.2.2.4
--- avida/current/source/cpu/hardware_util.hh:1.2.2.3	Fri May 23 04:07:41 2003
+++ avida/current/source/cpu/hardware_util.hh	Thu May 29 11:47:52 2003
@@ -20,19 +20,11 @@
 class cHardwareUtil {
 public:
 #ifdef USE_INST_SET_CODE
-  static void LoadInstSet(
-    const cString & filename,
-    cInstSet & inst_set, 
-		tDictionary<int> & nop_dict,
-		tDictionary<int> & inst_dict
-  );
+  static void LoadInstSet( cString filename, cInstSet & inst_set, 
+	tDictionary<int> & nop_dict, tDictionary<int> & inst_dict );
 #else /* USE_INST_SET_CODE */
-  static void LoadInstSet(
-    const cString & filename,
-    cInstSet & inst_set, 
-		tDictionary<int> & nop_dict,
-		tDictionary<tHardwareMethod> & inst_dict
-  );
+  static void LoadInstSet( cString filename, cInstSet & inst_set, 
+	tDictionary<int> & nop_dict, tDictionary<tHardwareMethod> & inst_dict);
 #endif /* USE_INST_SET_CODE */
   static void LoadInstSet_CPUOriginal(const cString & filename,
 				      cInstSet & inst_set);
Index: avida/current/source/cpu/label.cc
diff -u avida/current/source/cpu/label.cc:1.9.2.1 avida/current/source/cpu/label.cc:1.9.2.2
--- avida/current/source/cpu/label.cc:1.9.2.1	Mon May 12 10:22:46 2003
+++ avida/current/source/cpu/label.cc	Thu May 29 11:47:52 2003
@@ -19,16 +19,14 @@
 // cCodeLabel stuff...
 ////////////////////////////////
 
-cCodeLabel::cCodeLabel(int in_base)
+cCodeLabel::cCodeLabel()
   : size(0)
-  , base(in_base)
 {
 }
 
 cCodeLabel::cCodeLabel(const cCodeLabel &in_label)
   : nop_sequence(in_label.nop_sequence)
   , size(in_label.size)
-  , base(in_label.base)
 {
 }
 
@@ -43,7 +41,7 @@
   assert (size <= MAX_LABEL_SIZE);
   assert (size <= nop_sequence.GetSize());
   for (int i = 0; i < size; i++) {
-    assert (nop_sequence[i] < base);
+    assert (nop_sequence[i] < MAX_NOPS);
   }
 
   return result;
Index: avida/current/source/cpu/label.hh
diff -u avida/current/source/cpu/label.hh:1.10.2.1 avida/current/source/cpu/label.hh:1.10.2.2
--- avida/current/source/cpu/label.hh:1.10.2.1	Mon May 12 10:22:46 2003
+++ avida/current/source/cpu/label.hh	Thu May 29 11:47:53 2003
@@ -24,9 +24,9 @@
 private:
   tArray<char> nop_sequence;
   int size;
-  const int base;
+  //const int base;
 public:
-  cCodeLabel(int in_base=MAX_NOPS);
+  cCodeLabel();//int in_base=MAX_NOPS);
   cCodeLabel(const cCodeLabel &in_label);
   ~cCodeLabel();
 
@@ -39,19 +39,19 @@
 
   void Clear() { size = 0; }
   inline void AddNop(int nop_num);
-  inline void Rotate(const int rot);
+  inline void Rotate(const int rot, const int base);
 
   int GetSize() const { return size; }
-  int GetBase() const { return base; }
+  //int GetBase() const { return base; }
   inline cString AsString() const;
-  inline int AsInt() const;
+  inline int AsInt(const int base) const;
 
   void SaveState(std::ostream & fp);
   void LoadState(std::istream & fp);
 };
 
 void cCodeLabel::AddNop(int nop_num) {
-  assert (nop_num < base);
+  assert (nop_num < MAX_NOPS);
 
   if (size < MAX_LABEL_SIZE) {
     if (size == nop_sequence.GetSize()) {
@@ -61,10 +61,16 @@
   }
 }
 
-void cCodeLabel::Rotate(const int rot)
+void cCodeLabel::Rotate(const int rot, const int base)
 {
+  //for (int i = 0; i < size; i++) {
+  //  nop_sequence[i] += rot;
+  //  if (nop_sequence[i] == 3) nop_sequence[i]++; //IGNORING NOP-D FOR NOW!
+  //  if (nop_sequence[i] >= base) nop_sequence[i] -= base;
+  //}
   for (int i = 0; i < size; i++) {
     nop_sequence[i] += rot;
+    //if (nop_sequence[i] == 3) nop_sequence[i]++; //IGNORING NOP-D FOR NOW!
     if (nop_sequence[i] >= base) nop_sequence[i] -= base;
   }
 }
@@ -80,7 +86,7 @@
   return out_string;
 }
 
-int cCodeLabel::AsInt() const
+int cCodeLabel::AsInt(const int base) const
 {
   int value = 0;
 
Index: avida/current/source/main/analyze.cc
diff -u avida/current/source/main/analyze.cc:1.63.2.5 avida/current/source/main/analyze.cc:1.63.2.6
--- avida/current/source/main/analyze.cc:1.63.2.5	Fri May 23 02:36:34 2003
+++ avida/current/source/main/analyze.cc	Thu May 29 11:47:53 2003
@@ -1808,13 +1808,13 @@
     cInstSet map_inst_set(inst_set);
 #ifdef USE_INST_SET_CODE
     /* XXX start -- kgn */
-    // Locate instruction corresponding to "map-null" in the instruction library.
+    // Locate instruction corresponding to "NULL" in the instruction library.
     {
-      const cInstruction inst_lib_null_inst = map_inst_set.GetInstLib()->GetInst("map-null");
+      const cInstruction inst_lib_null_inst = map_inst_set.GetInstLib()->GetInst("NULL");
       if(inst_lib_null_inst == map_inst_set.GetInstLib()->GetInstError()){
         cout << "<cAnalyze::CommandMapTasks> got error:" << endl;
-        cout << " --- instruction \"map-null\" isn't in the instruction library;" << endl;
-        cout << " --- get somebody to map a function to \"map-null\" in the library." << endl;
+        cout << " --- instruction \"NULL\" isn't in the instruction library;" << endl;
+        cout << " --- get somebody to map a function to \"NULL\" in the library." << endl;
         cout << " --- (probably to class method \"cHardware-of-some-type::initInstLib\"" << endl;
         cout << " --- in file named \"cpu/hardware-of-some-type.cc\".)" << endl;
         cout << " --- bailing-out." << endl;
@@ -1823,12 +1823,12 @@
       // Add mapping to located instruction. 
       map_inst_set.Add2(inst_lib_null_inst.GetOp());
     }
-    const cInstruction null_inst = map_inst_set.GetInst("map-null");
+    const cInstruction null_inst = map_inst_set.GetInst("NULL");
     /* XXX end */
 #else /* USE_INST_SET_CODE */
     // Build an empty instruction into the instruction set.
-    map_inst_set.Add("map-null", &cHardwareBase::Inst_Nop);
-    const cInstruction null_inst = map_inst_set.GetInst("map-null");
+    map_inst_set.Add("NULL", &cHardwareBase::Inst_Nop);
+    const cInstruction null_inst = map_inst_set.GetInst("NULL");
 #endif /* USE_INST_SET_CODE */
 
     // Loop through all the lines of code, testing the removal of each.
@@ -2018,13 +2018,13 @@
     cInstSet map_inst_set(inst_set);
 #ifdef USE_INST_SET_CODE
     /* XXX start -- kgn */
-    // Locate instruction corresponding to "map-null" in the instruction library.
+    // Locate instruction corresponding to "NULL" in the instruction library.
     {
-      const cInstruction inst_lib_null_inst = map_inst_set.GetInstLib()->GetInst("map-null");
-      if(inst_lib_null_inst == map_inst_set.GetInstLib()->GetInstError()){
+      const cInstruction inst_lib_null_inst = map_inst_set.GetInstLib()->GetInst("NULL");
+      if (inst_lib_null_inst == map_inst_set.GetInstLib()->GetInstError()){
         cout << "<cAnalyze::CommandMapMutations> got error:" << endl;
-        cout << " --- instruction \"map-null\" isn't in the instruction library;" << endl;
-        cout << " --- get somebody to map a function to \"map-null\" in the library." << endl;
+        cout << " --- instruction \"NULL\" isn't in the instruction library;" << endl;
+        cout << " --- get somebody to map a function to \"NULL\" in the library." << endl;
         cout << " --- (probably to class method \"cHardware-of-some-type::initInstLib\"" << endl;
         cout << " --- in file named \"cpu/hardware-of-some-type.cc\".)" << endl;
         cout << " --- bailing-out." << endl;
@@ -2033,12 +2033,12 @@
       // Add mapping to located instruction. 
       map_inst_set.Add2(inst_lib_null_inst.GetOp());
     }
-    const cInstruction null_inst = map_inst_set.GetInst("map-null");
+    const cInstruction null_inst = map_inst_set.GetInst("NULL");
     /* XXX end */
 #else /* USE_INST_SET_CODE */
     // Build an empty instruction into the instruction set.
-    map_inst_set.Add("map-null", &cHardwareBase::Inst_Nop);
-    const cInstruction null_inst = map_inst_set.GetInst("map-null");
+    map_inst_set.Add("NULL", &cHardwareBase::Inst_Nop);
+    const cInstruction null_inst = map_inst_set.GetInst("NULL");
 #endif /* USE_INST_SET_CODE */
 
     cString color_string;  // For coloring cells...
Index: avida/current/source/main/config.cc
diff -u avida/current/source/main/config.cc:1.50.2.4 avida/current/source/main/config.cc:1.50.2.5
--- avida/current/source/main/config.cc:1.50.2.4	Tue May 20 08:19:33 2003
+++ avida/current/source/main/config.cc	Thu May 29 11:47:54 2003
@@ -16,7 +16,7 @@
 
 using namespace std;
 
-
+tList<cConfig::cConfigGroup> cConfig::group_list;
 bool cConfig::analyze_mode;
 bool cConfig::primitive_mode;
 cString cConfig::default_dir;
@@ -43,9 +43,6 @@
 double cConfig::divide_ins_prob;
 double cConfig::divide_del_prob;
 double cConfig::parent_mut_prob;
-double cConfig::crossover_prob;
-double cConfig::aligned_cross_prob;
-double cConfig::exe_err_prob;
 int cConfig::num_instructions;
 int cConfig::hardware_type;
 int cConfig::max_cpu_threads;
@@ -54,7 +51,6 @@
 int cConfig::base_size_merit;
 int cConfig::task_merit_method;
 int cConfig::max_label_exe_size;
-int cConfig::max_num_tasks_rewarded;
 int cConfig::merit_time;
 int cConfig::num_tasks;
 int cConfig::num_reactions;
@@ -93,139 +89,260 @@
 int cConfig::test_cpu_time_mod;
 int cConfig::track_main_lineage;
 bool cConfig::log_threshold_only;
-bool cConfig::log_breed_count;
 bool cConfig::log_creatures;
-bool cConfig::log_phylogeny;
 bool cConfig::log_genotypes;
 bool cConfig::log_threshold;
 bool cConfig::log_species;
 bool cConfig::log_landscape;
-bool cConfig::log_mutations;
 bool cConfig::log_lineages;
 int cConfig::debug_level;
 int cConfig::view_mode;
-int cConfig::viewer_type;
 
 
 
 void cConfig::Setup(int argc, char * argv[])
 {
+  // Start with the Architecture variables...
+  cConfigGroup * arch_group = new cConfigGroup("Architecture Variables");
+  group_list.PushRear(arch_group);
+  
+  arch_group->Add(max_updates, "-1", "MAX_UPDATES",
+		  "Maximum updates to run experiment (-1 = no limit)");
+  arch_group->Add(max_generations, "-1", "MAX_GENERATIONS",
+		  "Maximum generations to run experiment (-1 = no limit)");
+  arch_group->Add(end_condition_mode, "0", "END_CONDITION_MODE",
+		  "End run when ...\n0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached\n1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached");
+  arch_group->Add(world_x, "100", "WORLD-X",
+		  "Width of the Avida world");
+  arch_group->Add(world_y, "100", "WORLD-Y",
+		  "Height of the Avida world");
+  arch_group->Add(rand_seed, "0", "RANDOM_SEED",
+		  "Random number seed (0 for based on time)");
+  arch_group->Add(hardware_type, "0", "HARDWARE_TYPE",
+		  "0 = Original CPUs\n1 = New, Stack-based CPUs");
+
+  // Configuration file group.
+  cConfigGroup * file_group = new cConfigGroup("Configuration Files");
+  group_list.PushRear(file_group);
+  
+  file_group->Add(default_dir, DEFAULT_DIR, "DEFAULT_DIR",
+		  "Directory in which config files are found");
+  file_group->Add(inst_filename, "inst_set.default", "INST_SET",
+		  "File containing instruction set");
+  file_group->Add(event_filename, "events.cfg", "EVENT_FILE",
+		  "File containing list of events during run");
+  file_group->Add(analyze_filename, "analyze.cfg", "ANALYZE_FILE",
+		  "File used for analysis mode");
+  file_group->Add(env_filename, "environment.cfg", "ENVIRONMENT_FILE",
+		  "File that describes the environment");
+  file_group->Add(start_creature, "organism.default", "START_CREATURE",
+		  "Organism to seed the soup");
+
+  // Reproduction group.
+  cConfigGroup * repro_group = new cConfigGroup("Birth and Death");
+  group_list.PushRear(repro_group);
+  
+  repro_group->Add(birth_method, "4", "BIRTH_METHOD",
+		   "0 = Replace random organism in neighborhood\n1 = Replace oldest organism in neighborhood\n2 = Replace largest Age/Merit in neighborhood\n3 = Place only in empty cells in neighborhood\n4 = Replace random from population (Mass Action)\n5 = Replace oldest in entire population (like Tierra)");
+  repro_group->Add(death_method, "0", "DEATH_METHOD",
+		   "0 = Never die of old age.\n1 = Die when inst executed = AGE_LIMIT (+deviation)\n2 = Die when inst executed = length*AGE_LIMIT (+dev)");
+  repro_group->Add(age_limit, "5000", "AGE_LIMIT",
+		   "Modifies DEATH_METHOD");
+  repro_group->Add(age_deviation, "0", "AGE_DEVIATION",
+		   "Creates a distribution around AGE_LIMIT");
+  repro_group->Add(alloc_method, "0", "ALLOC_METHOD",
+		   "0 = Allocated space is set to default instruction.\n1 = Set to section of dead genome (Necrophilia)\n2 = Allocated space is set to random instruction.");
+  repro_group->Add(divide_method, "1", "DIVIDE_METHOD",
+		   "0 = Divide leaves state of mother untouched.\n1 = Divide resets state of mother\n    (after the divide, we have 2 children)");
+  repro_group->Add(generation_inc_method, "1", "GENERATION_INC_METHOD",
+		   "0 = Only the generation of the child is\n    increased on divide.\n1 = Both the generation of the mother and child are\n    increased on divide (good with DIVIDE_METHOD 1).");
+
+
+  // Divide Restrictions Group.
+  cConfigGroup * div_group = new cConfigGroup("Divide Restrictions");
+  group_list.PushRear(div_group);
+  
+  div_group->Add(child_size_range, "2.0", "CHILD_SIZE_RANGE",
+		 "Maximal differential between child and parent sizes.");
+  div_group->Add(min_copied_lines, "0.5", "MIN_COPIED_LINES",
+		 "Code fraction which must be copied before divide.");
+  div_group->Add(min_exe_lines, "0.5", "MIN_EXE_LINES",
+		 "Code fraction which must be executed before divide.");
+  div_group->Add(require_allocate, "1", "REQUIRE_ALLOCATE",
+		 "Is a an allocate required before a divide? (0/1)");
+  div_group->Add(required_task, "-1", "REQUIRED_TASK",
+		 "Task ID required for successful divide.");
+
+
+  // Mutations Group
+  cConfigGroup * muts_group = new cConfigGroup("Mutations");
+  group_list.PushRear(muts_group);
+
+  muts_group->Add(point_mut_prob, "0.0", "POINT_MUT_PROB",
+		  "Mutation rate (per-location per update)");
+  muts_group->Add(copy_mut_prob, "0.0075", "COPY_MUT_PROB",
+		  "Mutation rate (per copy)");
+  muts_group->Add(ins_mut_prob, "0.0", "INS_MUT_PROB",
+		  "Insertion rate (per site, applied on divide)");
+  muts_group->Add(del_mut_prob, "0.0", "DEL_MUT_PROB",
+		  "Deletion rate (per site, applied on divide)");
+  muts_group->Add(div_mut_prob, "0.0", "DIV_MUT_PROB",
+		  "Mutation rate (per site, applied on divide)");
+  muts_group->Add(divide_mut_prob, "0.0", "DIVIDE_MUT_PROB",
+		  "Mutation rate (per divide)");
+  muts_group->Add(divide_ins_prob, "0.05", "DIVIDE_INS_PROB",
+		  "Insertion rate (per divide)");
+  muts_group->Add(divide_del_prob, "0.05", "DIVIDE_DEL_PROB",
+		  "Deletion rate (per divide)");
+  muts_group->Add(parent_mut_prob, "0.0", "PARENT_MUT_PROB",
+		  "Per-site, in parent, on divide");
+
+  
+  // Mutation reversions group
+  cConfigGroup * rev_group = new cConfigGroup("Mutation Reversion");
+  rev_group->SetComment("These slow down avida a lot, and should be set to 0.0 normally.");
+  group_list.PushRear(rev_group);
+
+  rev_group->Add(revert_fatal, "0.0", "REVERT_FATAL",
+		 "Should any mutations be reverted on birth?");
+  rev_group->Add(revert_neg, "0.0", "REVERT_DETRIMENTAL",
+		 "  0.0 to 1.0; Probability of reversion.");
+  rev_group->Add(revert_neut, "0.0", "REVERT_NEUTRAL",
+		 "");
+  rev_group->Add(revert_pos, "0.0", "REVERT_BENEFICIAL",
+		 "");
+  rev_group->Add(sterilize_fatal, "0.0", "STERILIZE_FATAL",
+		 "Should any mutations clear (kill) the organism?");
+  rev_group->Add(sterilize_neg, "0.0", "STERILIZE_DETRIMENTAL",
+		 "  0.0 to 1.0; Probability of reset.");
+  rev_group->Add(sterilize_neut, "0.0", "STERILIZE_NEUTRAL",
+		 "");
+  rev_group->Add(sterilize_pos, "0.0", "STERILIZE_BENEFICIAL",
+		 "");
+  rev_group->Add(fail_implicit, "0", "FAIL_IMPLICIT",
+		 "Should copies that failed *not* due to mutations\nbe eliminated?");
+
+
+  // Time slicing group
+  cConfigGroup * time_group = new cConfigGroup("Time Slicing");
+  group_list.PushRear(time_group);
+
+  time_group->Add(ave_time_slice, "30", "AVE_TIME_SLICE",
+		  "Ave number of insts per org per update");
+  time_group->Add(slicing_method, "2", "SLICING_METHOD",
+		  "0 = CONSTANT: all organisms get default...\n1 = PROBABILISTIC: Run _prob_ proportional to merit.\n2 = INTEGRATED: Perfectly integrated deterministic.");
+  time_group->Add(size_merit_method, "0", "SIZE_MERIT_METHOD",
+		  "0 = off (merit is independent of size)\n1 = Merit proportional to copied size\n2 = Merit prop. to executed size\n3 = Merit prop. to full size\n4 = Merit prop. to min of executed or copied size\n5 = Merit prop. to sqrt of the minimum size");
+  time_group->Add(task_merit_method, "1", "TASK_MERIT_METHOD",
+		  "0 = No task bonuses\n1 = Bonus just equals the task bonus");
+  time_group->Add(max_cpu_threads, "1", "MAX_CPU_THREADS",
+		  "Number of Threads a CPU can spawn");
+  time_group->Add(thread_slicing_method, "0", "THREAD_SLICING_METHOD",
+		  "0 = One thread executed per time slice.\n1 = All threads executed each time slice.");
+  time_group->Add(max_label_exe_size, "1", "MAX_LABEL_EXE_SIZE",
+		  "Max nops marked as executed when labels are used");
+  time_group->Add(base_size_merit, "0", "BASE_SIZE_MERIT",
+		  "Base merit when size is *not* used");
+  time_group->Add(merit_time, "0", "MERIT_TIME",
+		  "0 = Merit Calculated when task completed\n1 = Merit Calculated on Divide");
+
+
+  // Geneology group
+  cConfigGroup * gen_group = new cConfigGroup("Geneology");
+  group_list.PushRear(gen_group);
+
+  gen_group->Add(track_main_lineage, "0", "TRACK_MAIN_LINEAGE",
+		 "Track primary lineage leading to final population?");
+  gen_group->Add(threshold, "3", "THRESHOLD",
+		 "Number of organisms in a genotype needed for it\n  to be considered viable.");
+  gen_group->Add(genotype_print, "0", "GENOTYPE_PRINT",
+		 "0/1 (off/on) Print out all threshold genotypes?");
+  gen_group->Add(genotype_print_dom, "0", "GENOTYPE_PRINT_DOM",
+		 "Print out a genotype if it stays dominant for\n  this many updates. (0 = off)");
+  gen_group->Add(species_threshold, "2", "SPECIES_THRESHOLD",
+		 "max failure count for organisms to be same species");
+  gen_group->Add(species_recording, "0", "SPECIES_RECORDING",
+		 "1 = full, 2 = limited search (parent only)");
+  gen_group->Add(species_print, "0", "SPECIES_PRINT",
+		 "0/1 (off/on) Print out all species?");
+  gen_group->Add(test_cpu_time_mod, "20", "TEST_CPU_TIME_MOD",
+		 "Time allocated in test CPUs (multiple of length)");
+  
+
+  // Log Files group
+  cConfigGroup * log_group = new cConfigGroup("Log Files");
+  group_list.PushRear(log_group);
+
+  log_group->Add(log_creatures, "0", "LOG_CREATURES",
+		 "0/1 (off/on) toggle to print file.");
+  log_group->Add(log_genotypes, "0", "LOG_GENOTYPES",
+		 "0 = off, 1 = print ALL, 2 = print threshold ONLY.");
+  log_group->Add(log_threshold, "0", "LOG_THRESHOLD",
+		 "0/1 (off/on) toggle to print file.");
+  log_group->Add(log_species, "0", "LOG_SPECIES",
+		 "0/1 (off/on) toggle to print file.");
+  log_group->Add(log_landscape, "0", "LOG_LANDSCAPE",
+		 "0/1 (off/on) toggle to print file.");
+
+
+  // Viewer group
+  cConfigGroup * view_group = new cConfigGroup("Viewer Settings");
+  group_list.PushRear(view_group);
+
+  view_group->Add(view_mode, "0", "VIEW_MODE",
+		  "Initial viewer screen");
+
+  // Lineages group
+  cConfigGroup * lin_group = new cConfigGroup("Lineage");
+  lin_group->SetComment("NOTE: This should probably be called \"Clade\"\nThis one can slow down avida a lot. It is used to get an idea of how\noften an advantageous mutation arises, and where it goes afterwards.\nLineage creation options are.  Works only when LOG_LINEAGES is set to 1.\n  0 = manual creation (on inject, use successive integers as lineage labels).\n  1 = when a child's (potential) fitness is higher than that of its parent.\n  2 = when a child's (potential) fitness is higher than max in population.\n  3 = when a child's (potential) fitness is higher than max in dom. lineage\n*and* the child is in the dominant lineage, or (2)\n  4 = when a child's (potential) fitness is higher than max in dom. lineage\n(and that of its own lineage)\n  5 = same as child's (potential) fitness is higher than that of the\n      currently dominant organism, and also than that of any organism\n      currently in the same lineage.\n  6 = when a child's (potential) fitness is higher than any organism\n      currently in the same lineage.\n  7 = when a child's (potential) fitness is higher than that of any\n      organism in its line of descent");
+
+  group_list.PushRear(lin_group);
+
+  lin_group->Add(log_lineages, "0", "LOG_LINEAGES",
+		 "");
+  lin_group->Add(lineage_creation_method, "0", "LINEAGE_CREATION_METHOD",
+		 "");
+
+  /***
+   * Load all of the variables from genesis.
+   ***/
+
   default_dir = DEFAULT_DIR;
 
   cGenesis genesis;
   genesis.SetVerbose();
   ProcessConfiguration(argc, argv, genesis);
+  
+  tListIterator<cConfigGroup> group_it(group_list);
+  cConfigGroup * cur_group;
+  while ((cur_group = group_it.Next()) != NULL) {
+    cur_group->LoadValues(genesis);
+  }
+
+  /***
+   * Handle any special modifications to any of the variables now that
+   * they've been loaded.
+   ***/
 
-  // Load the default directory...
-  default_dir = genesis.ReadString("DEFAULT_DIR", DEFAULT_DIR);
+  // The default directory should end in a '/'.
   char dir_tail = default_dir[default_dir.GetSize() - 1];
   if (dir_tail != '\\' && dir_tail != '/') default_dir += "/";
 
-  // Input files...
-  inst_filename  = genesis.ReadString("INST_SET", "inst_set");
-  event_filename = genesis.ReadString("EVENT_FILE", "events.cfg");
-  analyze_filename = genesis.ReadString("ANALYZE_FILE", "analyze.cfg");
-  env_filename = genesis.ReadString("ENVIRONMENT_FILE", "environment.cfg");
-  start_creature = genesis.ReadString("START_CREATURE");
-
-
-  // Load Archetecture...
-  max_updates     = genesis.ReadInt("MAX_UPDATES", -1);
-  max_generations = genesis.ReadInt("MAX_GENERATIONS", -1);
-  end_condition_mode = genesis.ReadInt("END_CONDITION_MODE", 0);
-  world_x         = genesis.ReadInt("WORLD-X");
-  world_y         = genesis.ReadInt("WORLD-Y");
-  hardware_type   = genesis.ReadInt("HARDWARE_TYPE");
-
-  birth_method   = genesis.ReadInt("BIRTH_METHOD", POSITION_CHILD_AGE);
-  death_method   = genesis.ReadInt("DEATH_METHOD", DEATH_METHOD_OFF);
-  alloc_method   = genesis.ReadInt("ALLOC_METHOD", ALLOC_METHOD_DEFAULT);
-  divide_method  = genesis.ReadInt("DIVIDE_METHOD", DIVIDE_METHOD_SPLIT);
-  required_task   = genesis.ReadInt("REQUIRED_TASK", -1);
-  lineage_creation_method =
-    genesis.ReadInt("LINEAGE_CREATION_METHOD", 0);
-  generation_inc_method =
-    genesis.ReadInt("GENERATION_INC_METHOD", GENERATION_INC_BOTH);
-  age_limit      = genesis.ReadInt("AGE_LIMIT", -1);
-  age_deviation    = genesis.ReadFloat("AGE_DEVIATION", 0);
-  child_size_range = genesis.ReadFloat("CHILD_SIZE_RANGE", 2.0);
-  min_copied_lines = genesis.ReadFloat("MIN_COPIED_LINES", 0.5);
-  min_exe_lines    = genesis.ReadFloat("MIN_EXE_LINES", 0.5);
-  require_allocate = genesis.ReadInt("REQUIRE_ALLOCATE", 1);
-
-  revert_fatal = genesis.ReadFloat("REVERT_FATAL", 0.0);
-  revert_neg   = genesis.ReadFloat("REVERT_DETRIMENTAL", 0.0);
-  revert_neut  = genesis.ReadFloat("REVERT_NEUTRAL", 0.0);
-  revert_pos   = genesis.ReadFloat("REVERT_BENEFICIAL", 0.0);
-  sterilize_fatal = genesis.ReadFloat("STERILIZE_FATAL", 0.0);
-  sterilize_neg   = genesis.ReadFloat("STERILIZE_DETRIMENTAL", 0.0);
-  sterilize_neut  = genesis.ReadFloat("STERILIZE_NEUTRAL", 0.0);
-  sterilize_pos   = genesis.ReadFloat("STERILIZE_BENEFICIAL", 0.0);
+  // Determine if any variables were set that require test CPUs to be run
+  // at every divide.
   test_on_divide = (revert_fatal > 0.0) || (revert_neg > 0.0) ||
     (revert_neut > 0.0) || (revert_pos > 0.0) || (sterilize_fatal > 0.0) ||
     (sterilize_neg > 0.0) || (sterilize_neut > 0.0) || (sterilize_pos > 0.0);
-  fail_implicit = genesis.ReadInt("FAIL_IMPLICIT", 0);
-
-  // Genealogy
-  species_threshold  = genesis.ReadInt("SPECIES_THRESHOLD");
-  threshold          = genesis.ReadInt("THRESHOLD");
-  genotype_print     = genesis.ReadInt("GENOTYPE_PRINT");
-  species_print      = genesis.ReadInt("SPECIES_PRINT");
-  species_recording  = genesis.ReadInt("SPECIES_RECORDING");
-  genotype_print_dom = genesis.ReadInt("GENOTYPE_PRINT_DOM");
-  test_cpu_time_mod  = genesis.ReadInt("TEST_CPU_TIME_MOD", 20);
-  track_main_lineage = genesis.ReadInt("TRACK_MAIN_LINEAGE", 0);
-
-  // Thread Info
-  max_cpu_threads = genesis.ReadInt("MAX_CPU_THREADS", 1);
-  thread_slicing_method = genesis.ReadInt("THREAD_SLICING_METHOD", 0);
-  
-
-  // Time Slicing Info
-  slicing_method = genesis.ReadInt("SLICING_METHOD", SLICE_CONSTANT);
-  size_merit_method = genesis.ReadInt("SIZE_MERIT_METHOD", 0);
-  base_size_merit   = genesis.ReadInt("BASE_SIZE_MERIT", 0);
-  ave_time_slice = genesis.ReadInt("AVE_TIME_SLICE", 30);
-  merit_time = genesis.ReadInt("MERIT_TIME", 0);
-
-  // Task Merit Method
-  task_merit_method = genesis.ReadInt("TASK_MERIT_METHOD", TASK_MERIT_NORMAL);
-  max_num_tasks_rewarded = genesis.ReadInt("MAX_NUM_TASKS_REWARDED", -1);
-  max_label_exe_size = genesis.ReadInt("MAX_LABEL_EXE_SIZE", 1);
-
-  // Load Mutation Info
-  point_mut_prob  = genesis.ReadFloat("POINT_MUT_PROB");
-  copy_mut_prob   = genesis.ReadFloat("COPY_MUT_PROB");
-  ins_mut_prob    = genesis.ReadFloat("INS_MUT_PROB");
-  del_mut_prob    = genesis.ReadFloat("DEL_MUT_PROB");
-  div_mut_prob    = genesis.ReadFloat("DIV_MUT_PROB");
-  divide_mut_prob = genesis.ReadFloat("DIVIDE_MUT_PROB");
-  divide_ins_prob = genesis.ReadFloat("DIVIDE_INS_PROB");
-  divide_del_prob = genesis.ReadFloat("DIVIDE_DEL_PROB");
-  parent_mut_prob = genesis.ReadFloat("PARENT_MUT_PROB");
-  crossover_prob  = genesis.ReadFloat("CROSSOVER_PROB");
-  aligned_cross_prob = genesis.ReadFloat("ALIGNED_CROSS_PROB");
-  exe_err_prob    = genesis.ReadFloat("EXE_ERROR_PROB");
-
-  // Load Viewer Info...
-  view_mode = genesis.ReadInt("VIEW_MODE");
-  viewer_type = genesis.ReadInt("VIEWER_TYPE",0);
-
-  log_breed_count = genesis.ReadInt("LOG_BREED_COUNT", 0);
-  log_creatures   = genesis.ReadInt("LOG_CREATURES", 0);
-  log_phylogeny   = genesis.ReadInt("LOG_PHYLOGENY", 0);
 
-  log_genotypes = genesis.ReadInt("LOG_GENOTYPES", 0);
+  // Determine if we are only logging threshold genotypes...
   log_threshold_only = false;
   if (log_genotypes > 1) log_threshold_only = true;
 
-  log_threshold = genesis.ReadInt("LOG_THRESHOLD", 0);
-  log_species   = genesis.ReadInt("LOG_SPECIES", 0);
-  log_landscape = genesis.ReadInt("LOG_LANDSCAPE", 0);
-  log_mutations = genesis.ReadInt("LOG_MUTATIONS", 0);
-  log_lineages = genesis.ReadInt("LOG_LINEAGES", 0);
-
+  // Warn if there are settings in the genesis file that have not been read.
   genesis.WarnUnused();
+
+  // Test printing... @CAO
+  //  PrintGenesis("genesis.test");
 }
 
 void cConfig::SetupMS()
@@ -251,6 +368,71 @@
 #endif
 }
 
+void cConfig::PrintGenesis(const cString & filename)
+{
+  ofstream fp(filename);
+
+  // Print out the generic header, including the version ID.
+  fp << "#############################################################################" << endl
+     << "# This file includes all the basic run-time defines for avida." << endl
+     << "# For more information, see doc/genesis.html" << endl
+     << "#############################################################################" << endl
+     << endl
+     << "VERSION_ID " << AVIDA_VERSION << "   # Do not change this value."
+     << endl;
+
+  // Loop through the groups, and print out all of the variables.
+  
+  tListIterator<cConfigGroup> group_it(group_list);
+  cConfigGroup * cur_group;
+  while ((cur_group = group_it.Next()) != NULL) {
+    // Print out the group name...
+    fp << endl;
+    fp << "### " << cur_group->GetName() << " ###" << endl;
+
+    // If we have a comment about the current group, include it.
+    for (int i = 0; i < cur_group->GetComment().GetSize(); i++) {
+      fp << "# " << cur_group->GetComment().GetLine(i) << endl;
+    }
+
+    // Print out everything for this group...
+    tListIterator<cConfigEntryBase> entry_it(cur_group->GetEntries());
+    cConfigEntryBase * cur_entry;
+
+    // First, figure out the widest entry so we know where to put comments.
+    int max_width = 0;
+    while ((cur_entry = entry_it.Next()) != NULL) {
+      int cur_width = cur_entry->GetTag().GetSize() +
+	cur_entry->GetDefault().GetSize() + 1;
+      if (cur_width > max_width) max_width = cur_width;
+    }
+
+    // Now, make a second pass printing everything.
+    entry_it.Reset();
+    while ((cur_entry = entry_it.Next()) != NULL) {
+      int cur_width = cur_entry->GetTag().GetSize() +
+ 	cur_entry->GetDefault().GetSize() + 1;
+      // Print the variable and its setting...
+      fp << cur_entry->GetTag() << " " << cur_entry->GetDefault();
+
+      // Print some spaces before the description.
+      for (int i = cur_width; i < max_width; i++) fp << " ";
+
+      // Print the first line of the description.
+      if (cur_entry->GetDesc().GetSize() == 0) {
+	fp << "  # " << endl;
+      } else {
+	fp << "  # " << cur_entry->GetDesc().GetLine(0) << endl;
+      }
+
+      // Print the remaining lines of a description.
+      for (int i = 1; i < cur_entry->GetDesc().GetSize(); i++) {
+	for (int j = 0; j < max_width; j++) fp << " ";
+	fp << "  # " << cur_entry->GetDesc().GetLine(i) << endl;
+      }
+    }
+  }
+}
 
 //  void cConfig::PerturbTaskSet(double max_factor)
 //  {
@@ -274,7 +456,9 @@
 
 void cConfig::ProcessConfiguration(int argc, char * argv[], cGenesis & genesis)
 {
-  genesis_filename = "genesis"; // Name of genesis file.
+  const cString default_filename = "genesis";
+  genesis_filename = default_filename;
+
   int arg_num = 1;              // Argument number being looked at.
   analyze_mode = false;         // Initialize analyze_mode tp be off.
   primitive_mode = false;       // Initialize primitive_mode tp be off.
@@ -299,6 +483,16 @@
   // Open and verify the genesis file.
 
   genesis.Open(genesis_filename);
+
+  // If we failed to open the genesis file, and we are using the default,
+  // try creating it.
+  if (genesis.IsOpen() == false && genesis_filename == default_filename) {
+    cerr << "Warning: Unable to find file '" << genesis_filename
+ 	 << "'.  Creating." << endl;
+    PrintGenesis(genesis_filename);
+    genesis.Open(genesis_filename);
+  }
+  
   cString version_id = genesis.ReadString("VERSION_ID", "Unknown");
   if (genesis.IsOpen() == true && version_id != AVIDA_VERSION) {
     cerr << "/  WARNING   WARNING   WARNING   WARNING   WARNING  \\" << endl
@@ -390,16 +584,6 @@
       cString value(cur_arg);
       cout << "SET " << name() << " = " << value() << endl;
       genesis.AddInput(name(), value());
-    } else if (cur_arg == "-viewer") {
-      if (arg_num + 1 == argc || args[arg_num + 1][0] == '-') {
-	cerr<<"Must include viewer type"<<endl;
-	exit(0);
-      } else {
-	arg_num++;  if (arg_num < argc) cur_arg = args[arg_num];
-	viewer_type = cur_arg.AsInt();
-      }
-      genesis.AddInput("VIEWER_TYPE", viewer_type);
-
 
     } else if (cur_arg == "-g" || cur_arg == "-genesis") {
       cerr << "Error: -g[enesis] option must be listed first." << endl;
Index: avida/current/source/main/config.hh
diff -u avida/current/source/main/config.hh:1.43.2.3 avida/current/source/main/config.hh:1.43.2.4
--- avida/current/source/main/config.hh:1.43.2.3	Tue May 20 08:19:33 2003
+++ avida/current/source/main/config.hh	Thu May 29 11:47:54 2003
@@ -57,6 +57,94 @@
 
 class cConfig {
 protected:
+  class cConfigEntryBase {
+  protected:
+    const cString genesis_tag;
+    const cString default_value;
+    const cStringList description;
+  public:
+    cConfigEntryBase(const cString & _tag, const cString & _def,
+		     const cString & _desc)
+      : genesis_tag(_tag), default_value(_def), description(_desc, '\n') { ; }
+
+    const cString & GetTag() { return genesis_tag; }
+    const cString & GetDefault() { return default_value; }
+    const cStringList & GetDesc() { return description; }
+
+    virtual bool LoadValue(cGenesis & genesis) = 0;
+  };
+
+  template <class T> class tConfigEntry : public cConfigEntryBase {
+  private:
+    T & variable;
+  public:
+    tConfigEntry(T & _var, const cString & _def, const cString & _tag,
+		 const cString _desc)
+      : cConfigEntryBase(_tag, _def, _desc), variable(_var)
+    { ; }
+
+    bool LoadValue(cGenesis & genesis) {
+      genesis.Read(variable, genesis_tag, default_value);
+      return true;
+    }
+  };
+
+  class cConfigGroup {
+  private:
+    const cString group_name;
+    cStringList comment;
+    tList<cConfigEntryBase> group_entries;
+  public:
+    cConfigGroup(const cString & _name) : group_name(_name) { ; }
+    ~cConfigGroup() {
+      while (group_entries.GetSize() > 0) delete group_entries.Pop();
+    }
+
+    void SetComment(const cString & _comment) { comment.Load(_comment, '\n'); }
+
+    const cString & GetName() { return group_name; }
+    const cStringList & GetComment() { return comment; }
+    tList<cConfigEntryBase> & GetEntries() { return group_entries; }
+
+    void LoadValues(cGenesis & genesis) {
+      tListIterator<cConfigEntryBase> group_it(group_entries);
+      cConfigEntryBase * cur_entry;
+      while ((cur_entry = group_it.Next()) != NULL) {
+	cur_entry->LoadValue(genesis);
+      }
+    };
+
+    void Add(int & _var, const cString &  _def, const cString & _tag,
+	     const cString & _desc)
+    {
+      group_entries.
+	PushRear(new cConfig::tConfigEntry<int>(_var,_def,_tag,_desc));
+    }
+
+    void Add(double & _var, const cString & _def, const cString & _tag,
+	     const cString & _desc)
+    {
+      group_entries.
+	PushRear(new cConfig::tConfigEntry<double>(_var,_def,_tag,_desc));
+    }
+
+    void Add(cString & _var, const cString & _def, const cString & _tag,
+	     const cString & _desc)
+    {
+      group_entries.
+	PushRear(new cConfig::tConfigEntry<cString>(_var,_def,_tag,_desc));
+    }
+
+    void Add(bool & _var, const cString & _def, const cString & _tag,
+	     const cString & _desc)
+    {
+      group_entries.
+	PushRear(new cConfig::tConfigEntry<bool>(_var,_def,_tag,_desc));
+    }
+  };
+
+  // Collection of genesis groups...
+  static tList<cConfigGroup> group_list;
 
   // Major Configurations
   static bool analyze_mode;     // Should avida do only analysis work?
@@ -92,9 +180,6 @@
   static double divide_ins_prob;
   static double divide_del_prob;
   static double parent_mut_prob;
-  static double crossover_prob;
-  static double aligned_cross_prob;
-  static double exe_err_prob;
 
   // CPU Configutation
   static int num_instructions;
@@ -114,7 +199,6 @@
 
   // Task Merit Method
   static int task_merit_method;
-  static int max_num_tasks_rewarded;
 
   static int merit_time;
 
@@ -160,9 +244,7 @@
   // Log files...
   static bool log_threshold_only;
 
-  static bool log_breed_count;
   static bool log_creatures;
-  static bool log_phylogeny;
   static bool log_genotypes;
   static bool log_threshold;
   static bool log_species;
@@ -175,13 +257,13 @@
 
   // Viewer
   static int view_mode;
-  static int viewer_type;
 
   // Other functions...
   static void ProcessConfiguration(int argc, char* argv[], cGenesis & genesis);
 public:
   static void Setup(int argc, char * argv[]);
   static void SetupMS();
+  static void PrintGenesis(const cString & filename);
 
   // ``Get''
   static bool GetAnalyzeMode() { return analyze_mode; }
@@ -221,9 +303,6 @@
   static double GetDivideInsProb() { return divide_ins_prob; }
   static double GetDivideDelProb() { return divide_del_prob; }
   static double GetParentMutProb() { return parent_mut_prob; }
-  static double GetCrossoverProb() { return crossover_prob; }
-  static double GetAlignedCrossProb() { return aligned_cross_prob; }
-  static double GetExeErrProb()    { return exe_err_prob; }
 
   static int GetNumInstructions() { return num_instructions; }
   static int GetHardwareType() { return hardware_type; }
@@ -233,7 +312,6 @@
   static int GetSizeMeritMethod() { return size_merit_method; }
   static int GetBaseSizeMerit()  { return base_size_merit; }
   static int GetTaskMeritMethod() { return task_merit_method; }
-  static int GetMaxNumTasksRewarded() { return max_num_tasks_rewarded; }
   static int GetMaxLabelExeSize() { return max_label_exe_size; }
 
   static int GetMeritTime() { return merit_time; }
@@ -282,20 +360,16 @@
 
   static bool GetLogThresholdOnly()  { return log_threshold_only; }
 
-  static bool GetLogBreedCount() { return log_breed_count; }
   static bool GetLogCreatures() { return log_creatures; }
-  static bool GetLogPhylogeny() { return log_phylogeny; }
   static bool GetLogGenotypes() { return log_genotypes; }
   static bool GetLogThreshold() { return log_threshold; }
   static bool GetLogSpecies()   { return log_species; }
   static bool GetLogLandscape() { return log_landscape; }
-  static bool GetLogMutations() { return log_mutations; }
   static bool GetLogLineages()  { return log_lineages; }
 
   static int GetDebugLevel() { return debug_level; }
 
   static int GetViewMode() { return view_mode; }
-  static int GetViewerType() { return viewer_type; }
 
 
   // ``Set''
Index: avida/current/source/main/inst_set.cc
diff -u avida/current/source/main/inst_set.cc:1.1.2.3 avida/current/source/main/inst_set.cc:1.1.2.4
--- avida/current/source/main/inst_set.cc:1.1.2.3	Fri May 23 03:17:41 2003
+++ avida/current/source/main/inst_set.cc	Thu May 29 11:47:54 2003
@@ -34,7 +34,8 @@
 
 #ifdef USE_INST_SET_CODE
 cInstSet::cInstSet(const cInstSet & in_inst_set)
-  : m_lib_name_map(in_inst_set.m_lib_name_map)
+  : m_inst_lib(in_inst_set.m_inst_lib)
+  , m_lib_name_map(in_inst_set.m_lib_name_map)
   , m_lib_nopmod_map(in_inst_set.m_lib_nopmod_map)
   , mutation_chart2(in_inst_set.mutation_chart2)
 {
Index: avida/current/source/main/mutations.cc
diff -u avida/current/source/main/mutations.cc:1.6.2.1 avida/current/source/main/mutations.cc:1.6.2.2
--- avida/current/source/main/mutations.cc:1.6.2.1	Mon May 12 10:22:47 2003
+++ avida/current/source/main/mutations.cc	Thu May 29 11:47:54 2003
@@ -119,7 +119,6 @@
 void cMutationRates::Clear()
 {
   exec.point_mut_prob = 0.0;
-  exec.exe_err_prob = 0.0;
   copy.copy_mut_prob = 0.0;
   divide.ins_mut_prob = 0.0;
   divide.del_mut_prob = 0.0;
@@ -135,7 +134,6 @@
 void cMutationRates::Copy(const cMutationRates & in_muts)
 {
   exec.point_mut_prob = in_muts.exec.point_mut_prob;
-  exec.exe_err_prob = in_muts.exec.exe_err_prob;
   copy.copy_mut_prob = in_muts.copy.copy_mut_prob;
   divide.ins_mut_prob = in_muts.divide.ins_mut_prob;
   divide.del_mut_prob = in_muts.divide.del_mut_prob;
@@ -153,11 +151,6 @@
 bool cMutationRates::TestPointMut() const
 {
   return g_random.P(exec.point_mut_prob);
-}
-
-bool cMutationRates::TestExeErr() const
-{
-  return g_random.P(exec.exe_err_prob);
 }
 
 bool cMutationRates::TestCopyMut() const
Index: avida/current/source/main/mutations.hh
diff -u avida/current/source/main/mutations.hh:1.6.2.1 avida/current/source/main/mutations.hh:1.6.2.2
--- avida/current/source/main/mutations.hh:1.6.2.1	Tue May 20 05:12:22 2003
+++ avida/current/source/main/mutations.hh	Thu May 29 11:47:54 2003
@@ -102,7 +102,6 @@
   // ...anytime during execution...
   struct sExecMuts {
     double point_mut_prob;
-    double exe_err_prob;
   };
   sExecMuts exec;
 
@@ -137,7 +136,6 @@
   void Copy(const cMutationRates & in_muts);
 
   bool TestPointMut() const;
-  bool TestExeErr() const;
   bool TestCopyMut() const;
   bool TestDivideMut() const;
   bool TestDivideIns() const;
@@ -147,7 +145,6 @@
   bool TestAlignedCrossover() const;
 
   double GetPointMutProb() const     { return exec.point_mut_prob; }
-  double GetExeErrProb() const       { return exec.exe_err_prob; }
   double GetCopyMutProb() const      { return copy.copy_mut_prob; }
   double GetInsMutProb() const       { return divide.ins_mut_prob; }
   double GetDelMutProb() const       { return divide.del_mut_prob; }
@@ -160,7 +157,6 @@
   double GetAlignedCrossProb() const { return divide.aligned_cross_prob; }
 
   void SetPointMutProb(double in_prob)  { exec.point_mut_prob  = in_prob; }
-  void SetExeErrProb(double in_prob)    { exec.exe_err_prob    = in_prob; }
   void SetCopyMutProb(double in_prob)   { copy.copy_mut_prob   = in_prob; }
   void SetInsMutProb(double in_prob)    { divide.ins_mut_prob    = in_prob; }
   void SetDelMutProb(double in_prob)    { divide.del_mut_prob    = in_prob; }
Index: avida/current/source/tools/file.cc
diff -u avida/current/source/tools/file.cc:1.14.2.3 avida/current/source/tools/file.cc:1.14.2.4
--- avida/current/source/tools/file.cc:1.14.2.3	Tue May 20 05:12:37 2003
+++ avida/current/source/tools/file.cc	Thu May 29 11:47:55 2003
@@ -387,6 +387,9 @@
   }
 
   int base_ret = cFile::Open(_filename, mode);
+  
+  if (IsOpen() == false) return base_ret;  // Failed to open!
+
   Load();
   Compress();
   Close();
Index: avida/current/source/tools/file.hh
diff -u avida/current/source/tools/file.hh:1.13.2.2 avida/current/source/tools/file.hh:1.13.2.3
--- avida/current/source/tools/file.hh:1.13.2.2	Tue May 20 05:12:37 2003
+++ avida/current/source/tools/file.hh	Thu May 29 11:47:55 2003
@@ -278,7 +278,23 @@
      * @param base The default value.
      * @param warn Warn user if not set?
      **/
-    double ReadFloat (const cString & name, float base=0.0, bool warn=true) const;
+     double ReadFloat (const cString & name, float base=0.0, bool warn=true) const;
+
+  void Read(cString & _var, const cString & _name, const cString & _def="") {
+    _var = ReadString(_name, _def);
+  }
+
+  void Read(int & _var, const cString & _name, const cString & _def="0") {
+    _var = ReadInt(_name, _def.AsInt());
+  }
+
+  void Read(double & _var, const cString & _name, const cString & _def="0.0") {
+    _var = ReadFloat(_name, _def.AsDouble());
+  }
+
+  void Read(bool & _var, const cString & _name, const cString & _def="0.0") {
+    _var = ReadInt(_name, _def.AsInt()) != 0;
+  }
 };
 
 #endif
Index: avida/current/source/tools/string_list.hh
diff -u avida/current/source/tools/string_list.hh:1.3 avida/current/source/tools/string_list.hh:1.3.2.1
--- avida/current/source/tools/string_list.hh:1.3	Thu Feb 14 07:57:41 2002
+++ avida/current/source/tools/string_list.hh	Thu May 29 11:47:56 2003
@@ -42,7 +42,7 @@
   cStringList & operator=(const cStringList & _list);
 
   int GetSize() const { return string_list.GetSize(); }
-  cString GetLine(int line_num) { return *(string_list.GetPos(line_num)); }
+  cString GetLine(int line_num) const { return *(string_list.GetPos(line_num)); }
   const tList<cString> & GetList() const { return string_list; }
 
   bool HasString(const cString & test_string) const;
Index: avida/current/source/tools/tList.hh
diff -u avida/current/source/tools/tList.hh:1.8 avida/current/source/tools/tList.hh:1.8.2.1
--- avida/current/source/tools/tList.hh:1.8	Thu Feb 14 07:57:41 2002
+++ avida/current/source/tools/tList.hh	Thu May 29 11:47:56 2003
@@ -1,5 +1,5 @@
 //////////////////////////////////////////////////////////////////////////////
-// Copyright (C) 1993 - 2001 California Institute of Technology             //
+// Copyright (C) 1993 - 2003 California Institute of Technology             //
 //                                                                          //
 // Read the COPYING and README files, or contact 'avida at alife.org',         //
 // before continuing.  SOME RESTRICTIONS MAY APPLY TO USE OF THIS FILE.     //
@@ -185,6 +185,13 @@
   T * GetLast()              { return root.prev->data; }
 
   T * GetPos(int pos) {
+    if (pos >= GetSize()) return NULL;
+    tListNode<T> * test_node = root.next;
+    for (int i = 0; i < pos; i++) test_node = test_node->next;
+    return test_node->data;
+  }
+
+  const T * GetPos(int pos) const {
     if (pos >= GetSize()) return NULL;
     tListNode<T> * test_node = root.next;
     for (int i = 0; i < pos; i++) test_node = test_node->next;


More information about the Avida-cvs mailing list