- switch(cmd[0]) {
- case LEGIC_READ :snprintf(exp, size, "READ Byte(%d)", cmd[1]);break;
- case LEGIC_WRITE :snprintf(exp, size, "WRITE Byte(%d)", cmd[1]);break;
- default :snprintf(exp, size, "?"); break;
- }
+
+ uint8_t cmdBit = (cmd[0] & 1);
+ uint8_t address = (cmd[1] << 7) | cmd[0] >> 1;
+
+ if (cmdBit == LEGIC_READ)
+ snprintf(exp, size, "READ Byte(%d)", address);
+ else if (cmdBit == LEGIC_WRITE )
+ snprintf(exp, size, "WRITE Byte(%d)", address);
+ else
+ snprintf(exp, size, "?");
+