Results 1 to 11 of 11

Thread: Calculating the multiple checksums

  1. #1

    Calculating the multiple checksums

    Okay, so i've been doing a lot of stuff but understanding the checksum routines is not one of the things i have prioritized. I know where the checksums are and also found a table that stores the segment locs for my particular o/s. i'm sure it's just a simple refernce somewhere to this table and then a cksum alg etc.

    Anyone already made any progress?

    I count sheep in hex...

  2. #2
    Guest
    Guest

    Re: Calculating the multiple checksums

    Could you specify what model year box involved and
    OS number and calibration file no: if avail



  3. #3

    Re: Calculating the multiple checksums

    okay so here's something that i found works for segments 2 to 8 ;D

    1. sum all the words from ($segstart+2) to ($segend)
    2. AND with $FFFF (to mask the lower 16 bits)
    3. Xor with $FFFF
    4. ADD $01

    checksum is at $segstart. Eg. for seg2 $8000

    seems to work for me. Somebody else pls try this if possible.

    Also, I am not sure about segment 1 yet. Anyone any ideas?


    I count sheep in hex...

  4. #4
    HP Tuners Owner Keith@HPTuners's Avatar
    Join Date
    Sep 2002
    Location
    Chicago, IL
    Posts
    6,395

    Re: Calculating the multiple checksums

    Thats how its done.. its something I'm incorporaring into PCM Edit soon.

    I'm not sure about seg 1 yet either.
    We got this guy Not Sure, ...

  5. #5
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: Calculating the multiple checksums

    Instead of doing "XOR w/ FFFF".

    Consider doing logical negation ;D

    In boolean logic:

    A ^ ONES == *A

    Or any variable XOR'd with a varable the same # of
    bits all high/one is the same as logical negation.

    AKA "One's Complement".

    The Addition of one makes it the "TWO's Complement"

    Ones Complement is the logical inverse.

    Twos Complement is the mathematical inverse.


  6. #6
    HP Tuners Owner Keith@HPTuners's Avatar
    Join Date
    Sep 2002
    Location
    Chicago, IL
    Posts
    6,395

    Re: Calculating the multiple checksums

    Here is my VB code for anyone interested... note that I have more formatting code in there that I removed for readability.

    Code:
      'Set our buffer size
      ReDim Buffer(1 To 2)
    
    
      'Read until EOF
      Do Until EOF(iHandle)
        Get #iHandle, pos, Buffer
        
        b1 = Buffer(1)
        b2 = Buffer(2)
    
        If pos > 2 Then checksum = checksum + (b1 * 256) + b2
    
        pos = pos + 2
      Loop
    
      checksum = checksum And 65535
      checksum = checksum Xor 65535
      checksum = checksum + 1
    We got this guy Not Sure, ...

  7. #7
    HP Tuners Owner Keith@HPTuners's Avatar
    Join Date
    Sep 2002
    Location
    Chicago, IL
    Posts
    6,395

    Re: Calculating the multiple checksums

    To do segment one, you do the entire segment exlcuding the csum at loc 0x500.

    I incorporated all of this into PCM_Edit including segment identification.
    We got this guy Not Sure, ...

  8. #8
    Guest
    Guest

    Re: Calculating the multiple checksums

    do you explain this to me that I do not understand it?

    Thanks


    1. sum all the words from ($segstart+2) to ($segend)
    2. AND with $FFFF (to mask the lower 16 bits)
    3. Xor with $FFFF
    4. ADD $01

    checksum is at $segstart. Eg. for seg2 $8000



  9. #9

    Re: Calculating the multiple checksums

    What happens if you flash with the incorrect checksum?

  10. #10
    HP Tuners Owner Keith@HPTuners's Avatar
    Join Date
    Sep 2002
    Location
    Chicago, IL
    Posts
    6,395

    Re: Calculating the multiple checksums

    PCM won't run the OS code after boot.
    We got this guy Not Sure, ...

  11. #11
    Potential Tuner
    Join Date
    Jul 2005
    Location
    Australia
    Posts
    5
    Quote Originally Posted by Keith@HPTuners
    To do segment one, you do the entire segment exlcuding the csum at loc 0x500.
    Define entire segment 1 ... 0-> 4FF, then exclude seg2 - 8, then continue until end of file ????

    Or, entire file from start to finish excluding csum at 0x500 ?

    Dan.