     with ConsAKD; use ConsAKD;
     with InteAKD; use InteAKD;
     with FloaAKD; use FloaAKD;
     with MathAKD; use MathAKD;
     with SounAKD;
     with TextAKD; use TextAKD;
     with TTY;

     procedure HyperSoma is
     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
       T         :  long_integer := 1e6;
       Spike     :  long_integer := 1e9;
       dt        :  long_integer := 1;
       V         :  long_integer := 0;
       dV_dt     :  long_integer := 0;
       I         :  long_integer := 0;
       Deci      :  natural      := 5;
       Key       :  character;
     begin
       loop
	 Put_Line (
	   "HyperSoma (C) 1994 David W. Croft.  All rights reserved." );
	 New_Line;
	 Put_Line ( "Press 0 to pause or halt the simulation." );
	 Put_Line ( "Press 1 to 9 to inject current." );
	 New_Line;
	 I     := Ask_Long ( "Initial Injected Current :  ", I        );
	 V     := Ask_Long ( "Initial Membrane Voltage :  ", V        );
	 T     := Ask_Long ( "Threshold                :  ", T        );
	 Spike := Ask_Long ( "Hyperpolarization Level  :  ", Spike, T );
	 dt    := Ask_Long ( "Time Step                :  ", dt       );
	 Deci  := Ask_Nat  ( "Decimal Places           :  ", Deci     );
	 loop
	   dV_dt := I + V * ( V - T );
	   V := V + dV_dt * dt;
	   I := 0;
	   if V >= Spike then
	     V := -Spike;
	     SounAKD.Speaker_Thump;
	   end if;
	   if TTY.Char_Ready then
	     Key := TTY.Get ( No_Echo => true );
	     exit when Key = '0';
	     I := I + float ( character'pos ( Key ) - 48 );
	   end if;
	   Put ( I       ); Put ( "  " );
	   Put ( V       ); Put ( "  " );
	   Put ( dV_dt   ); Put ( "  " );
	   New_Line;
	 end loop;
	 exit when not Ask_Bool ( "Continue? ", true );
       end loop;
     exception
       when others =>
	 Pause (
	   "An error has been detected.  Please press ENTER to exit..." );
	 raise;
     end HyperSoma;
