4 bit LCD connection only uses half of LCD

I have it figured out. The LCD is 16x1 physically, but it is 2x40 logically. If I write a message that is greater than 40 characters, the part beyond 40 characters appears on the second set of 8 character spaces.

As a result, the way to get a message onto the display is to break it into two 8-character parts, put the cursor at the first character of the first line, print the first part of the message, move the cursor to the second line, and print the second part of the message.

The code I used for this is below.

Interestingly, since there are 2 lines of 40 chars, and the LCD only uses 8 on each line, there are 64 characters that are not visible. These are probably good for buffering for scrolling, or just as off-chip storage. You would have to be able to read from the LCD to use it as off-chip RAM.

void setup()
{
  LCD4Bit lcd = LCD4Bit(2);   //It's 2-line internally
  lcd.init();
  delay(50);
  lcd.clear();
  delay(50);
  lcd.cursorTo(1,0);        //Home on first line
  delay(50);
  lcd.printIn("hello wo");  //First part of message
  delay(50);                
  lcd.cursorTo(2,0);        //Home on second line
  delay(50);
  lcd.printIn("rld! foo");  //Second part of message
  delay(50);
}