 		return;
 	}
 
+	// find the appropriate location to insert it
+
+	int lineNo = latoi( theLine );
+
+	char *bufc = programRam;
+	char *bufn = 0;
+
+	while( *bufc ) {
+		// if we're looking at '\0', error line not found, return
+	    	if( *bufc == '\0' ) break;
+
+		// check the current pointer for the matching line
+		int cline = latoi( bufc );
+
+		// find the end point
+		bufn = bufc;
+		while( *bufn != '\0' && *bufn != '\n' ) bufn++;
+
+		// if it matches, 
+		if( cline > lineNo )
+		{
+			// shove the current data out to the end.
+			int moveSz = strlen( bufc ) +1;
+			char * srcpos = bufc + moveSz;
+			char * dstpos = bufc + newSz + moveSz +1;
+
+			do {
+				*dstpos = *srcpos;
+				srcpos--;
+				dstpos--;
+			} while( srcpos != bufc );
+			*dstpos = *srcpos; // copy over the last one...
+
+			// and insert the new content
+			dstpos = bufc;
+			srcpos = theLine;
+
+			while( *srcpos != '\0' ) {
+				*dstpos = *srcpos;
+				dstpos++;
+				srcpos++;
+			}
+			*dstpos = '\n';
+
+			return;
+		}
+
+		// if not, move looking pointer to next line
+		bufc = bufn;
+		bufc++; // move past the newline
+	}
+	// shove the content out the length of the new string
+	// copy the data in
+
 	// append it on the end for now
 	strcat( programRam, theLine );
 	strcat( programRam, "\n" );	// new line


#define kBufLen (16)
char buffer[16];

int latoi( char * buf )
{

////////////////////////////////////////////////////////////////////////////////
// Version history
//
// v0.01  2013-June-19  Line entry, line editing
//			cmds: help, mem, new, list
//			      EEPROM: elist, eload, esave, enew
//
// v0.00  2013-June-18  Initial test versions

#define kBLuBVersion	"v0.01  2013-June-19  yorgle@gmail.com"


////////////////////////////////////////////////////////////////////////////////
