           Serial << "?" << endl;
     }
   }
+}
 #endif // INTERACTIVE
 
-#if (INTERACTIVE == 0)
-  #define MAX_OPTIONS   5
-  //
-  // valid commands:
-  // 't ?' - get E(E)PROM type
-  // 't <t>' - set E(E)PROM type
-  // 'r <addr> <len>' - read <len> bytes starting from address <addr>
-  // 'w <addr> <bytes>' - write <bytes> (in IHEX format) to address <addr> 
-  //
-  if ( lineComplete ) {
-    
-    Serial << strlen(inputLine) << " '" << inputLine << "'" << endl;
-
-    char *command = NULL;
-    int nopts = 0;
-    char* token = strtok(inputLine, " ");
-    char *option[MAX_OPTIONS];
-    bool err = false;
-
-    while ( token && !err ) {
-      
-      // 'command' token must have length of 1
-      if ( strlen(token) == 1 && !command ) {
-        command = token;
-      }
-      // 'command' token found, now check for options
-      else if ( command ) {
-        if ( nopts == MAX_OPTIONS ) {
-          err = true;
-          Serial << F("ERR: maximum number of options exceeded") << endl;
-        }
-        option[nopts++] = token;
-      }
-      else if ( !command ) {
-        Serial << F("ERR: no command found!") << endl;
-        err = true;
-      }
-
-      // find next token
-      token = strtok(0, " ");
-    }
-
-    // final control output after tokenisation
-    if ( command && !err ) {
-      Serial << F("command= '") << command << "'" << endl;
-      for ( int i=0; i<nopts; ++i )
-        Serial << F("option[") << i << F("]= '") << option[i] << "'" << endl;
-    }
-
-    if ( !err ) {
-      switch ( command[0] ) {
-        case 't': break;
-        case 'r': break;
-        case 'w': break;
-        case '?': break;
-        default:
-          Serial << F("ERR: unknown command entered!") << endl;
-          err = true;
-      }
-    }
-
-    if ( !err ) {
-      Serial << F("OK") << endl;
-    }
-
-    lineLength = 0;
-    inputLine[lineLength] = 0;
-    
-    lineComplete = false;
-  }
-#endif // INTERACTIVE
-}
-
-
+/** Read unsigned integer, 32 bits from console (experimental). */
 uint32_t readUInt32(void) {
 
   byte line[20];

      case 'f':  // --- toggle output format
      case 'F':
          if ( output_format == 0 ) {
	          output_format = 1;
	          Serial.println(F("Switched to IHEX output format!"));
	        }
	        else {
	          output_format = 0;
	          Serial.println(F("Switched to DUMP output format!"));
      	  }
        break;

      case 'l':  // --- set the length

  eeprom.setType(eepromType);
}


/**  */
void loop() {

#ifdef TEST
  testCode();
#endif // TEST

#if (INTERACTIVE != 0)
  loopInteractive();
#else
  loopNonInteractive();
#endif // INTERACTIVE
}

#if (INTERACTIVE == 0)
 // Calculated based on max input size expected for one command
 #define INPUT_SIZE   64
 // Maximum number of options expected
 #define MAX_OPTIONS   3

char inputLine[INPUT_SIZE+1] = { 0 };
int lineLength = 0;
bool lineComplete = false;

/** loop() function for the non-interactive version. */
void loopNonInteractive() {

  // read characters from serial interface and put them in input buffer until EOL
  int ch = Serial.read();

  if ( ch == -1 ) return;
  
  // check for LF or add character to inputLine
  if ( ch == 0x0a || ch == 0x0d ) {
    lineComplete = true;
  }
  else {
    // Add the final 0 to end the C string
    inputLine[lineLength++] = ch;
    inputLine[lineLength] = 0;
  
    // too many chars entered? clear line buffer and issue warning
    if ( lineLength == INPUT_SIZE ) {
      lineLength = 0;
      inputLine[lineLength] = 0;
      Serial << F("ERR: max. line length exceeded!") << endl;
    }
  }

  //
  // valid commands:
  // 't ?' - get E(E)PROM type
  // 't <t>' - set E(E)PROM type
  // 'r <addr> <len>' - read <len> bytes starting from address <addr>
  // 'w <addr> <bytes>' - write <bytes> (in IHEX format) to address <addr> 
  //
  if ( lineComplete ) {
    
    Serial << strlen(inputLine) << " '" << inputLine << "'" << endl;

    char *command = NULL;
    int nopts = 0;
    char* token = strtok(inputLine, " ");
    char *option[MAX_OPTIONS];
    bool err = false;

    while ( token && !err ) {
      
      // 'command' token must have length of 1
      if ( strlen(token) == 1 && !command ) {
        command = token;
      }
      // 'command' token found, now check for options
      else if ( command ) {
        if ( nopts == MAX_OPTIONS ) {
          err = true;
          Serial << F("ERR: maximum number of options exceeded") << endl;
        }
        option[nopts++] = token;
      }
      else if ( !command ) {
        Serial << F("ERR: no command found!") << endl;
        err = true;
      }

      // find next token
      token = strtok(0, " ");
    }

    // final control output after tokenisation
    if ( command && !err ) {
      Serial << F("command= '") << command << "'" << endl;
      for ( int i=0; i<nopts; ++i )
        Serial << F("option[") << i << F("]= '") << option[i] << "'" << endl;
    }

    if ( !err ) {
      switch ( command[0] ) {
        case 't': break;
        case 'r': break;
        case 'w': break;
        case '?': break;
        default:
          Serial << F("ERR: unknown command entered!") << endl;
          err = true;
      }
    }

    if ( !err ) {
      Serial << F("OK") << endl;
    }

    lineLength = 0;
    inputLine[lineLength] = 0;
    
    lineComplete = false;
  }
}
#endif // INTERACTIVE

#if (INTERACTIVE != 0)
//
// flash strings for the main menu
