Segment Swap utility

They go by many names, P01, P59, VPW, '0411 etc . Circa 1999 to 2006. All VPW OBD2 PCMs.
User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Thu Feb 06, 2020 10:31 pm

Ver 1.6.2

All binaries I have, starts 00 FF, so:
Added validation: OS1 segment must start with 00 FF

If this is not correct check, I will change it. But for now I have no other method.

Posts: 186
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Fri Feb 07, 2020 12:12 am

For the small os file check use byte $503. It is 01 on all files.
For the big OS file there isn`t any real check available, so either use file`s size or leave it without verification.

I think we need to make a button: check if eeprom data valid.

First checks the [a5 a0] location. If it is at $4056 or $6056, the eerpom data is valid only for 99-00 OSs
If it is at $4088 and $6088, the eeporm data is valid for 01-07 OSs.
Than check if the seed key pair is valid.
Seed is the first word and key is the second word in eeprom data. Key is derived from seed by some calculations.
Here it is how it is done.
[seed=4fee][key=a4fe]

add 5201 4fee+5201=a1ef
swap; add 9738 a1ef=efa1+9738=86d9
2`s complement [ffff-86d9]+1=7926
subtract d428 7926-d428=a4fe

If not valid apply a valid pair.

Than you can print the other info from the eeprom data.

Code: Select all
69 CD seed
C5 E4 key
00 C0 02 EB - 12583659[HARDWARE number in HEX]
31 4B 41 30 33 4C 31 55 33 32 36 36[serial number in ASCII]
BC 00 39 56 -[some identifier]
00 C0 13 87 - 12587911[some number on the PCM label below broadcast code]
59 46 5A 42 - YFZB[broadcast code in ASCII]
00
31 47 31 59 59 33 32 47 34 34 35 31 30 39 32 33 32 3A 67 -[VIN in ASCII]
00 00 00 00 00 00 00 FF 00 00 80 14 80 30 7F E7 7F D7 FF FF FF FF FF FF FF FF FF 00 FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
A5 A0 -eeprom area check word


There ate still some undefined data in the eeprom area than can be used for future release.

I tried to load eeprom data from different file but if the OS size and OS number don`t match I can`t load it.
I think that it can be safely migrated between different OS and p01 and p59 so maybe only on the eeprom data selection some of the checks can be omitted. Or do a final check mentioned above before saving the bin and printing the eeprom info data and for which OSs it is valid.

User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Fri Feb 07, 2020 10:56 pm

kur4o wrote:For the small os file check use byte $503. It is 01 on all files.

I think we need to make a button: check if eeprom data valid.

First checks the [a5 a0] location. If it is at $4056 or $6056, the eerpom data is valid only for 99-00 OSs
If it is at $4088 and $6088, the eeporm data is valid for 01-07 OSs.


But how you (program) can know what year OS is => This check is not yet implemented.
Edit: Should I use list:
https://github.com/LegacyNsfw/PcmHacks/ ... kb-OS-List
Edit2: Easy for full binary, not for OS segment

kur4o wrote:[seed=4fee][key=a4fe]

add 5201 4fee+5201=a1ef
swap; add 9738 a1ef=efa1+9738=86d9
2`s complement [ffff-86d9]+1=7926
subtract d428 7926-d428=a4fe


Are you sure this is correct? If remove +1 from from "2`s complement", I get correct key.

Removed limitations: You can load Eeprom_data from any file (Should limit by year, or at least add warning?)

Version 1.7.0 uploaded.

Posts: 186
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Sat Feb 08, 2020 3:33 am

It is getting better and better.
It is 1`s complement. My mistake. Skip the +1

I noticed some areas that needs attention. On the eeprom data if the seed or key starts with 0, the zero is not printed. It might be better when printing hex number to include the leading zeros.
Hardware and id2 can be converted to decimal.

Can you add the segments` size on the binfile info dialog. It is good for bin comparison for segment compatibility.
And print to text file the bin file information for single bin and for all files in folder.

Unless we get a full list of all os by year, adding that check might be put on hold. The list you found is very limited and far for complete. For now a warning that the selected eeprom is valid for "only these years" will be enough.


When someone wants to convert a 9354896 PCM OS to 0411 pcm OS and if the eeprom is not valid for the 0411 pcm OS a semi-brick condition can occur. I am still working on a way to figure the unknowns in the eeprom data and make a way to convert it from 4896 to 0411 pcm.

User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Sat Feb 08, 2020 6:13 pm

Uploaded v 1.7.1

Now checking Eeprom compatibility, and will ask if can't detect BIN version.
Info printing added, segment size in info.

Tested even less than usually (busy). Sorry about that.

Posts: 186
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Sun Feb 09, 2020 7:33 am

I did some testing.
The bin file info from a folder prints the same info from the selected bin to all files. Otherwise it works great. Maybe we can rip a list for 99-00 OSs from there.
The eeprom validation check is good.

It seems the critical validations are all there and work flawless. Nice work.

I will dig, in the patch area. We might have to apply some safety logic there. Especially on comparing different p/n calibrations with the same OS.

I stumbled on a bin with bad[empty, filled with FFs] eeprom data. Maybe some exception can be set in this case. The bin file info seems to freeze on the serial tab and it takes seed from $1 address from small OS file. Extracting bins with bad eeprom data, the eeprom data saving can be omitted.

User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Mon Feb 10, 2020 4:28 am

kur4o wrote:I did some testing.
The bin file info from a folder prints the same info from the selected bin to all files.


Doh. copy-paste error.
Fixed in version 1.7.2.

Made some rewrite to avoid global variables, hope nothing breaks.
I try to clean code, it is becoming hard to understand even for me :wtf: :oops:

User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Tue Feb 11, 2020 2:00 am

Version 1.8.0

Added selection for extracted segments
Removed all globals objects (only SegmentNames left, it IS global)
Small fixes & improvements

Posts: 186
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Postby kur4o » Tue Feb 11, 2020 3:28 am

Nice clean-up.
I found a couple of more issues to address. If there are any files in the folder that are not ls1 bins, the program says corrupted file and seizes extraction of the other files left for processing. A skip might be better. On the bin info, if you select file with bad eeprom data, the print out is weird. Might be better to print that file have bad eeprom data and is not good for cloning.
On extraction and selection of eeprom it is not possible to select or extract eeprom from file that doesn`t have good data.

I managed to get an error "The path is not of legal form." on the extract segments tab. It occurs when playing with different paths and closing the dialog without selecting path.

The patch extract might be used only on the same OS and same cal segments. Otherwise the patch apply can be used on the same OS, but on any cal segments.

Can you add universal file patching to work with bins that are not ls1s. Just compare 2 files and make the patch adding file size and name for usage with short description.

User avatar
Posts: 180
Joined: Tue Dec 17, 2019 3:27 am

Re: Segment Swap utility

Postby joukoy » Tue Feb 11, 2020 6:05 am

Version 1.8.1

Fixes to extraction & file information.

I try to create universal patching app soon.

PreviousNext

Return to GM LS1 512Kbyte and 1Mbyte

Who is online

Users browsing this forum: No registered users and 3 guests