           Serial.print(String(programmer->getLocation(), HEX));
           Serial.print(": ");
           for (int i = 0; i < 16; i++) {
-            Serial.print((w & 1) == 1 ? "1 " : "0 ");
-            w >>= 1;
+            Serial.print(((w >> (15 - i)) & 1) == 1 ? "1 " : "0 ");
           }
           Serial.println();
           

        return result;
      }
      return -1;
    }

    bool incAddress() {

    }
};

class WriteTextWordControl : public Command {
  public:
    virtual bool match(const String& name) const {
      return name.startsWith("text_write");
    }
    
    virtual void execute(const String& commandString) {
      if (!programmer->inProgrammingMode()) {
        Serial.println("ERROR: Programmer not in programming mode");
      } else {
        StringSplitter splitter(commandString, ' ', 2);
        if (splitter.getItemCount() < 2) {
          Serial.println("ERROR: Expected word to write as first argument");
        }
        String parameter = splitter.getItemAtIndex(1);
        parameter.toLowerCase();
        int data = hexToInt(parameter);

        if (data < 0 || data > 0x3F) {
          Serial.println("ERROR: Word must be >= 0 and <= 3F");
        } else {
          programmer->writeWord(data);
        }
      }
    }
    
    virtual void printHelpString() const {
      Serial.println("  text_write hex_value  writes a word to the current memory location");
    }
};

class IncAddressControl : public Command {
  public:
    virtual bool match(const String& name) const {
      return name.startsWith("inc");
    }
    
    virtual void execute(const String& commandString) {
      if (!programmer->inProgrammingMode()) {
        Serial.println("ERROR: Programmer not in programming mode");
      } else {
        programmer->incAddress();
      }
    }
