private bool ChecksumProgram()
        {
            Crc16 crc = new Crc16();

            // bootsector
            ushort chksumCalc = 0x0;
            ushort chksumFile = 0x0;

            ushort initial = 0;

            byte[] Initial_Value = new byte[0x2];
            Buffer.BlockCopy(sim.buffFull, 0x6066, Initial_Value, 0x0, 0x2);
            Array.Reverse(Initial_Value);
            initial    = BitConverter.ToUInt16(Initial_Value, 0);
            chksumCalc = BitConverter.ToUInt16(Initial_Value, 0);
            // label5.Text = chksumCalc.ToString("X4"); // initial value

            chksumFile = BitConverter.ToUInt16(sim.buffFull, 0x6050);
            // label3.Text = chksumFile.ToString("X4");
            // all ms41`s
            chksumCalc = crc.CCB(sim.buffFull, 0x06100, FindCheckEnd(sim.buffFull, 0x7FFF), chksumCalc);
            chksumCalc = crc.CCB(sim.buffFull, 0x00000, FindCheckEnd(sim.buffFull, 0x3FFF), chksumCalc);

            // must be 8 parts
            //chksumCalc = crc.CCB(sim.buffFull1, 0x20000, FindCheckEnd(sim.buffFull1, 0x3FFFF), chksumCalc);
            byte[] buf = new byte[0x20000]; // rearange memory for checksum calculation

            Buffer.BlockCopy(sim.buffFull, 0x24000, buf, 0x00000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x20000, buf, 0x04000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x2c000, buf, 0x08000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x28000, buf, 0x0C000, 0x4000);

            Buffer.BlockCopy(sim.buffFull, 0x34000, buf, 0x10000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x30000, buf, 0x14000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x3c000, buf, 0x18000, 0x4000);
            Buffer.BlockCopy(sim.buffFull, 0x38000, buf, 0x1C000, 0x4000);

            chksumCalc = crc.CCB(buf, 0x00000, FindCheckEnd(buf, 0x1FFFF), chksumCalc);


            if (chksumFile != chksumCalc)
            {
                byte[] update = new byte[0x2];
                update = BitConverter.GetBytes(chksumCalc);
                sim.buffFull[0x6050] = update[0x00];
                sim.buffFull[0x6051] = update[0x01];

                richTextBox1.Text         += "Checksum ProgramSec -- Value: " + chksumFile.ToString("X4") + " Comp: " + chksumCalc.ToString("X4") + "\t\t\t(Checksum ERROR)\r\n" + "\r\n";
                toolStripMenuItem3.Enabled = true;
                toolStripMenuItem2.Enabled = true;
                return(true);
            }

            richTextBox1.Text += "Checksum ProgramSec -- Value: " + chksumFile.ToString("X4") + " Comp: " + chksumCalc.ToString("X4") + "\t\t\t(Checksum OK)\r\n";

            return(false);
        }
        public bool ChecksumBootSector()
        {
            // bootsector
            Crc16  crc        = new Crc16();
            ushort chksumCalc = 0x4711; // hardcoded initial value
            int    chksumFile = BitConverter.ToUInt16(sim.buffFull, 0x5C80);

            chksumCalc = crc.CCB(sim.buffFull, 0x4000, 0x5C14, chksumCalc);

            if (chksumFile != chksumCalc)
            {
                byte[] update = new byte[0x2];
                update = BitConverter.GetBytes(chksumCalc);
                sim.buffFull[0x5C80] = update[0x00];
                sim.buffFull[0x5C81] = update[0x01];

                richTextBox1.Text         += "Checksum Bootsector -- Value: " + chksumFile.ToString("X4") + " Comp: " + chksumCalc.ToString("X4") + "\t\t\t(Checksum ERROR)\r\n";
                toolStripMenuItem3.Enabled = true;
                toolStripMenuItem2.Enabled = true;
                return(true);
            }
            richTextBox1.Text += "Checksum Bootsector -- Value: " + chksumFile.ToString("X4") + " Comp: " + chksumCalc.ToString("X4") + "\t\t\t(Checksum OK)\r\n";
            return(false);
        }