[avida-cvs] avida(Sherri) CVS commits: /current/aclocal emptyfile /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 label.cc label.hh

goingssh avida-cvs at alife.org
Thu May 29 19:21:03 PDT 2003


goingssh		Thu May 29 11:21:03 2003 EDT

  Added files:                 (Branch: Sherri)
    /avida/current/aclocal	emptyfile 

  Modified files:              
    /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 label.cc label.hh 
  Log:
  commiting merge of head branch and my branch (Sherri)
  
-------------- 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.4.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:20:57 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.4.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:20:57 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.4.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:20:57 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.4.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:20:57 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.2 avida/current/doc/code_environment.html:1.2.2.1
--- avida/current/doc/code_environment.html:1.2	Thu May  8 11:39:44 2003
+++ avida/current/doc/code_environment.html	Thu May 29 11:20:57 2003
@@ -297,3 +297,8 @@
 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>
+    
\ No newline at end of file
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.4.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:20:57 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.4.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:20:57 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.4.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:20:57 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.4.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:20:57 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.4.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:20:57 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.4.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:20:58 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.4.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:20:58 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.4.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:20:58 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.4.1
--- avida/current/doc/cvs.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/cvs.html	Thu May 29 11:20:58 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.4.1
--- avida/current/doc/devel.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/devel.html	Thu May 29 11:20:58 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.2 avida/current/doc/environment.html:1.2.2.1
--- avida/current/doc/environment.html:1.2	Thu May  8 11:39:45 2003
+++ avida/current/doc/environment.html	Thu May 29 11:20:58 2003
@@ -434,3 +434,8 @@
   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>
+    
\ No newline at end of file
Index: avida/current/doc/events.html
diff -u avida/current/doc/events.html:1.3 avida/current/doc/events.html:1.3.2.1
--- avida/current/doc/events.html:1.3	Thu May  8 11:39:45 2003
+++ avida/current/doc/events.html	Thu May 29 11:20:58 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.4.1
--- avida/current/doc/genesis.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/genesis.html	Thu May 29 11:20:58 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.4.1
--- avida/current/doc/index.html:1.2	Fri Feb  7 13:33:09 2003
+++ avida/current/doc/index.html	Thu May 29 11:20:58 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.4.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:20:58 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.4.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:20:58 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.4.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:20:58 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.4.1
--- avida/current/doc/screen.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/screen.html	Thu May 29 11:20:58 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.4.1
--- avida/current/doc/structure.html:1.1	Sun Jul 28 18:19:36 2002
+++ avida/current/doc/structure.html	Thu May 29 11:20:58 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.10 avida/current/source/cpu/cpu_defs.hh:1.10.2.1
--- avida/current/source/cpu/cpu_defs.hh:1.10	Sun May 18 13:49:27 2003
+++ avida/current/source/cpu/cpu_defs.hh	Thu May 29 11:20:59 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.3 avida/current/source/cpu/cpu_stack.hh:1.3.2.1
--- avida/current/source/cpu/cpu_stack.hh:1.3	Sat May 17 02:48:07 2003
+++ avida/current/source/cpu/cpu_stack.hh	Thu May 29 11:20:59 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.4.2 avida/current/source/cpu/hardware_4stack.cc:1.2.4.3
--- avida/current/source/cpu/hardware_4stack.cc:1.2.4.2	Tue May 27 11:45:36 2003
+++ avida/current/source/cpu/hardware_4stack.cc	Thu May 29 11:20:59 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,11 +256,88 @@
     tHardware4StackMethod function;
   };
   static const cInstEntry4Stack s_f_array[] = {
-    /*
+    //<<<<<<< hardware_4stack.cc
+    //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.
-    */
+   
+    >>>>>>> 1.4
+    
     cInstEntry4Stack("nop-A",     &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("nop-B",     &cHardware4Stack::Inst_Nop),
     cInstEntry4Stack("nop-C",     &cHardware4Stack::Inst_Nop),
@@ -348,7 +427,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);
@@ -622,6 +701,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() << " "
@@ -1386,7 +1468,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();
@@ -1396,6 +1478,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)
 {
@@ -1412,10 +1506,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)
 {
@@ -1800,167 +1899,460 @@
 // 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;
+}
+
+//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;
 }
 
@@ -1983,7 +2375,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) {
@@ -2012,7 +2404,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) {
@@ -2041,7 +2433,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));
@@ -2080,33 +2472,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;}
 
@@ -2122,14 +2491,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;
@@ -2152,20 +2513,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);
@@ -2180,20 +2527,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);
@@ -2258,62 +2591,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);
@@ -2499,18 +2776,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
@@ -2597,7 +2862,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);
@@ -2616,7 +2881,6 @@
   return true;
 }
 
-
 bool cHardware4Stack::Inst_InjectRand()
 {
   // Rotate to a random facing and then run the normal inject instruction
@@ -2669,7 +2933,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);
@@ -2738,7 +3002,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();
@@ -2748,7 +3012,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();
@@ -2778,7 +3042,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();
 
@@ -2814,7 +3078,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();
 
@@ -2850,24 +3114,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);
@@ -2877,7 +3125,6 @@
 
 
 // Head-based instructions
-
 bool cHardware4Stack::Inst_SetHead()
 {
   const int head_used = FindModifiedHead(HEAD_IP);
@@ -2891,14 +3138,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()
 {
@@ -2914,32 +3153,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);
@@ -2977,81 +3190,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.
@@ -3093,19 +3231,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);
@@ -3138,12 +3263,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.4.1 avida/current/source/cpu/hardware_4stack.hh:1.2.4.2
--- avida/current/source/cpu/hardware_4stack.hh:1.2.4.1	Tue May 27 11:45:36 2003
+++ avida/current/source/cpu/hardware_4stack.hh	Thu May 29 11:21:00 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;
@@ -132,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; }
@@ -243,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);
@@ -309,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();
@@ -564,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.45.2.2 avida/current/source/cpu/hardware_cpu.cc:1.45.2.3
--- avida/current/source/cpu/hardware_cpu.cc:1.45.2.2	Tue May 27 11:45:36 2003
+++ avida/current/source/cpu/hardware_cpu.cc	Thu May 29 11:21:00 2003
@@ -2070,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) {
@@ -2095,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) {
@@ -2135,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) {
@@ -2164,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) {
@@ -2193,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));
@@ -2328,7 +2328,7 @@
 bool cHardwareCPU::Inst_SetNum()
 {
   ReadLabel();
-  Register(REG_BX) = GetLabel().AsInt();
+  Register(REG_BX) = GetLabel().AsInt(NUM_NOPS);
   return true;
 }
 
@@ -2749,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);
@@ -2821,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);
@@ -2890,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();
@@ -2900,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();
@@ -2930,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();
 
@@ -2966,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();
 
@@ -3069,7 +3069,7 @@
 bool cHardwareCPU::Inst_IfLabel()
 {
   ReadLabel();
-  GetLabel().Rotate(1);
+  GetLabel().Rotate(1, NUM_NOPS);
   if (GetLabel() != GetReadLabel())  IP().Advance();
   return true;
 }
@@ -3248,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.28.2.1 avida/current/source/cpu/hardware_cpu.hh:1.28.2.2
--- avida/current/source/cpu/hardware_cpu.hh:1.28.2.1	Tue May 27 11:45:37 2003
+++ avida/current/source/cpu/hardware_cpu.hh	Thu May 29 11:21:00 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.
  *
Index: avida/current/source/cpu/hardware_util.cc
diff -u avida/current/source/cpu/hardware_util.cc:1.23.2.2 avida/current/source/cpu/hardware_util.cc:1.23.2.3
--- avida/current/source/cpu/hardware_util.cc:1.23.2.2	Tue May 27 11:45:37 2003
+++ avida/current/source/cpu/hardware_util.cc	Thu May 29 11:21:00 2003
@@ -383,15 +383,95 @@
   //  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);
+  //<<<<<<< hardware_util.cc
+  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);
+  //=======
+  //nop_dict.Add("nop-A", REG_AX);
+  //nop_dict.Add("nop-B", REG_BX);
+  //nop_dict.Add("nop-C", REG_CX);
 #endif /* !USE_INST_SET_CODE */
+  //>>>>>>> 1.25
 
   // 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);
@@ -592,9 +672,16 @@
   // Placebo instructions
   // nop-x (included with nops)
   inst_dict.Add("skip", (tHardwareMethod) &cHardware4Stack::Inst_Skip);
+<<<<<<< hardware_util.cc
+										*/
+  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
+  //>>>>>>> 1.25
   /* XXX start -- kgn */
   tDictionary<int> nop_dict;
   for(int i=0; i<inst_set.GetInstLib()->GetNumNops(); i++)
@@ -607,7 +694,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/label.cc
diff -u avida/current/source/cpu/label.cc:1.10 avida/current/source/cpu/label.cc:1.10.2.1
--- avida/current/source/cpu/label.cc:1.10	Sat May 17 02:48:08 2003
+++ avida/current/source/cpu/label.cc	Thu May 29 11:21:00 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.11 avida/current/source/cpu/label.hh:1.11.2.1
--- avida/current/source/cpu/label.hh:1.11	Sat May 17 02:48:08 2003
+++ avida/current/source/cpu/label.hh	Thu May 29 11:21:00 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;
 


More information about the Avida-cvs mailing list