void doOnebytebatch(string bitdata)//, StringBuilder Chunk) { bitdata = bitdata.Trim(); if (bitdata.Length == 0) { return; } int lng = bitdata.Length / 8; if (lng < 3) { // this code needs at least 3 bytes! dobytebatch(bitdata); return; } // Chunk.Append(nl + "defb &00,"); //Double Zero nibble is the marker for a repating byte batch addbytetodata(0); while (lng >= 0) { int pp2 = lng; if (pp2 > 255) { pp2 = 255; } // Chunk.Append((pp2).ToString("x")); addbytetodata(pp2); lng -= 255; } addbytetodata(VbX.BinToHex(unnibble(bitdata.Substring(0, 8)))); }
void donibblebatch(string nibblename, int nibblecount)//, StringBuilder Chunk) { int lineitem = 0; //while (nibblecount > 0) // { //if (lineitem > 0) //{ Chunk.Append(","); } //else //{ Chunk.Append(nl + "defb "); } int nc = nibblecount; if (nibblecount > 15) { nc = 15; } //nibblecount -= nc; string ct = VbX.IntToBin(nc).Substring(4, 4); addbytetodata(VbX.BinToHex(nibblename + ct)); nibblecount -= 15; while (nibblecount >= 0) { int pp2 = nibblecount; if (pp2 > 255) { pp2 = 255; } //Chunk.Append(",&" + (pp2).ToString("x")); addbytetodata(pp2); nibblecount -= 255; } lineitem++; // } }
void dobytebatch(string bitdata)//, StringBuilder Chunk) { bitdata = bitdata.Trim(); if (bitdata.Length == 0) { return; } int lng = bitdata.Length / 8; int partnum = 0; for (int i = 0; i < bitdata.Length; i += 8) { //; string part = VbX.Mid(bitdata + " ", i + 1, 8).Trim(); if (part.Length == 8) { //if (i > 0) //{ //Chunk.Append(","); //} //else //{ //Chunk.Append(nl + "defb "); //} // if (partnum == 14) partnum = 0; if (partnum == 0) { int pp = (lng - (i / 8)); if (pp > 15) { pp = 15; } //Chunk.Append("&" + (16 * pp).ToString("x") + ","); addbytetodata((16 * pp)); if (pp == 15) { pp = (lng - (i / 8)); pp -= 15; while (pp >= 0) { int pp2 = pp; if (pp2 > 255) { pp2 = 255; } //Chunk.Append("&" + (pp2).ToString("x") + ","); addbytetodata(pp2); pp -= 255; } } } partnum = partnum + 1; addbytetodata(VbX.BinToHex(unnibble(part))); // VbX.MsgBox("&" + globals.BinToHex(part)); // donibblebatch(part, 1, Chunk); } else { //Chunk.Append(nl); donibblebatch(part, 1); } } }