Casio vz checksum calculator?

Does anyone has information on how Casio made its sysEx checksums?

EDIT to correct the name of the software

I use software called Hex Workshop In addition to editing binary files and such, you can calculate checksums across a range of bytes using various checksum algorithms.

Thereā€™s only a few ways to calculate checksums, so maybe post a dump and indicate where the header ends and data begins.

1 Like

I just downloaded it zip file ā€œHexEdit_220_Projectā€ but Iā€™m on unfamiliar terrain here. Can you get me kickstarted on how to install this?

On my phone at the moment. Thereā€™s an on line hex editor by that name which also can do checksums (I think).

Need to get back to my development computer in a bit to give real answer.

Hex Workshop. The link appears to be legit, but itā€™s showing not secure: www.hexworkshop.com and the download is broken.

Hereā€™s the tool on CNET: Hex Workshop for Windows - Free download and software reviews - CNET Download

I guess old people use old tools. lol

1 Like

Old tools , yes. But new tools too :wink:
Iā€™m currently reverse engineering the Casio checksum using ChatGPT :slight_smile: No results yet though

simplest answer is to post a dump as an attachment here.

Iā€™ve tried the following 6 types, none of them brought a solution:

function calcChecksum(payLoad) -- calculates a checksum
  local result = 0
  local type = 4 -- fixed choice of checksum to use
  for i= 1, #payLoad do
    if type < 4 then result = result+payLoad[i] else result = result~payLoad[i] end
  end
  if type == 0 then result = (128-result)%128 end -- roland
  if type == 1 then  result = ((~result & 0xFF) +1) & 0x7F end-- yamaha
  if type == 2 then result = result%128 end -- simple 7bit checksum
  if type == 3 then result = (128-(result%128))%128 end 
  if type == 4 then result = (128-result)%128 end --  7bit XOR checksum 
  if type == 5 then result = result%128 end --  7bit XOR checksum 
  return result 
end

Here are 5 strings each 159 bytes long, whereby the header is the first 7 bytes and the second to last is the checksum. Each will start with F0 and end with F7. They are as they came from the Casio VZ-8M

  • F0 44 03 02 70 01 40 02 01 00 00 08 00 02 00 02 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 06 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 06 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0B 00 00 00 00 00 00 04 0B 00 00 00 01 00 0A 08 07 00 03 00 03 00 00 00 01 01 0F 01 04 00 00 61 F7
  • F0 44 03 02 70 01 40 02 01 00 00 08 00 02 00 02 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 06 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 06 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0B 00 00 00 00 00 00 04 0B 00 00 00 01 00 07 08 07 00 03 00 03 00 00 00 01 01 04 01 0F 00 00 64 F7
  • F0 44 03 02 70 01 40 02 01 00 00 08 00 02 00 02 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 06 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 06 08 02 00 00 04 01 04 00 00 06 03 00 00 00 00 07 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0B 00 00 00 00 00 00 04 0B 00 00 00 01 00 05 08 05 00 03 00 03 00 00 00 01 01 04 01 0F 00 00 68 F7
  • F0 44 03 02 70 01 40 02 01 00 00 08 00 02 00 02 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 06 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 06 08 02 00 02 04 01 04 00 00 06 03 00 00 08 00 07 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0B 00 00 00 00 00 00 04 0B 00 00 00 01 00 08 08 08 00 03 00 03 00 00 00 01 01 04 01 0F 00 00 42 F7
  • F0 44 03 02 70 01 40 02 01 00 00 08 00 02 00 02 00 02 00 02 00 00 00 00 00 00 00 00 00 00 00 06 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 06 08 02 00 02 04 01 04 00 00 06 03 00 00 08 00 07 00 02 00 00 04 01 04 00 00 06 03 00 00 08 00 07 08 02 00 00 04 01 04 00 00 06 03 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0B 00 00 00 00 00 00 04 0B 00 00 00 01 00 08 08 08 00 03 00 03 00 00 00 01 01 04 01 0F 00 00 42 F7

Iim not a programmer myself, so also Github is a bit unfamiliar, but I found these traces to a VZ and a CZ editor. If someone can retrieve the checksum constructor out of their voice edit logic, Iā€™ll set it up in lua and test itā€¦

Here is the checksum code

wxByte VZSysex::Checksum(wxByte* pData, unsigned int nSize, wxByte nChecksum)
{
    wxByte nSum = nChecksum;
    for(unsigned int nIndex = 0; nIndex < nSize; nIndex+=2)
        nSum += DecodeByte(pData + nIndex);
    return (0 - nSum) & 0x7F;
}


wxByte VZSysex::DecodeByte(wxByte* pCursor)
{
    return (*(pCursor) << 4) | (*(pCursor + 1));
}

and here is the code that validates the Casio sysex header:

bool VZSysex::Validate(bool bFix, unsigned int nSubheaderSize, bool bChecksum)
{
    m_bModified = false;
    unsigned int nPos = 0;
    m_bModified |= ValidateByte(m_pSysEx + nPos++, 0xF0, bFix);
    m_bModified |= ValidateByte(m_pSysEx + nPos++, 0x44, bFix);
    m_bModified |= ValidateByte(m_pSysEx + nPos++, 0x03, bFix);
    m_bModified |= ValidateByte(m_pSysEx + nPos++, 0x00, bFix);
    m_bModified |= ValidateByte(m_pSysEx + nPos++, 0x70, bFix); //!@todo Allow different MIDI channel [0xF0 - 0xFF]
    if(bChecksum) //!@todo Checksum created before derived classes run validate
        m_bModified |= ValidateByte(m_pSysEx + nPos++ + nSubheaderSize + m_nPayloadSize, Checksum(m_pSysEx + 7, m_nPayloadSize), bFix);
    m_bModified |= ValidateByte(m_pSysEx + nPos++ + nSubheaderSize + m_nPayloadSize, 0xF7, bFix);
    return m_bModified;
}
1 Like

I think I start to see the logic: the checkSum is a standard one , but NOT on the sysEx 7-bit 672 byte payload, but rather on the internal Casio 8-bit 336 byte payload. Luckily Iā€™ve kept both in sync in lua. Need to check further. Thanks youā€™ve set me on a good track :slight_smile:

Yes, that makes sense given your other tests. Just a bit more work on your part.

1 Like

It works :slight_smile:
Now I can start changing sounds on the Casio

Are you working on the VZ1 (or I guess VZ10M) by any chance? If so I have a VZ1 here I can test with

Yes, indirectly. Check it out here.

I have a VZ-8M, but this preset should for a great deal on a VZ1 or a VZ10 since the sysex is pretty similar. If you care to join, let it be known in that other thread.

I know you have figured it out for the voice patch data, but I found this info on a VZ website from the late 1999s and thought it might be useful to you for the operation memory data part:

There is a checksum on the end of every block of voice patch data (336 bytes) and on the end of every block of Op patch data (100 bytes).

To get the checksum, add up every byte in that block, take the last seven bits (ie MOD 128) then subtract the answer from 128 to get your final checksum value.

1 Like