12587603 OS disassembly

They go by many names, P01, P10, P12, P59, E38, VPW, '0411 etc.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

If I recall right, there were plenty of instances of the instruction, or variations of it, decompiling without errors, but I ran across at least 2 instances that didn't.
Don't stress specific units.
User avatar
antus
Site Admin
Posts: 10014
Joined: Sat Feb 28, 2009 10:34 am
cars: TX Gemini 2L Twincam 8psi
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Subaru WRX 2007

Re: 12587603 OS disassembly

Post by antus »

Yeah different thing. I recall another thread where someone said that NSFWs patch was no longer working on the latest. Pitty the patch was not officially accepted. So now its either ignore the TBL instructions or do it some other way (I dont have anything in mind, suspect it might be scriptable somehow), use IDA, use an older 10.x version of Ghidra with these patches, or fix it and post the update for 11.x. The instruction is from a later or automotive revision of the chip. It is documented, but not available on the base 68332. You may be able to use CPU32 or a other different and newer variant of the 68k chip in Ghidra too.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

That's unfortunate.
Don't stress specific units.
User avatar
NSFW
Posts: 802
Joined: Fri Feb 02, 2018 5:13 am

Re: 12587603 OS disassembly

Post by NSFW »

To be fair, I did not include unit tests for the instructions, so I understand why they didn't merge it. It might be possible to apply the same PR to a recent build, I haven't tried.

I should look at Ghidra again... I have just been sticking with IDA.
Please don't PM me with technical questions - start a thread instead, and send me a link to it. That way I can answer in public, and help other people who have the same question. Thanks!
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

IDA does seem much more capable. from what little I've been shown. What's it cost? $1,000 or something? I remember it being a lot.
Don't stress specific units.
User avatar
antus
Site Admin
Posts: 10014
Joined: Sat Feb 28, 2009 10:34 am
cars: TX Gemini 2L Twincam 8psi
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Subaru WRX 2007

Re: 12587603 OS disassembly

Post by antus »

Yes it is. There are free and home editions but they don't have CPU32 targets, so you need pro or a beta. I'm fortunate enough to have one received with previous employment so I can keep using it, I think some people who use it have been accepted in to beta programs in the past, but how to know they are running a beta program and how be accepted is not something I know much about. Then I guess some people sail the seven seas but that's not advised or recommended.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

Yeah, none of it sounds reasonable to me, so I put it all out of mind and went Ghidra.
But, recently put some of my own code in Ghidra, aaaand it was incoherent in areas. Looked like nonsense. Gave it a .elf file. Order of operations were jumbled in areas. Was real bad.
So, seems I just don't have a good option, as far as I can tell.
Don't stress specific units.
User avatar
pman92
Posts: 667
Joined: Thu May 03, 2012 12:50 pm
Location: Castlemaine, Vic

Re: 12587603 OS disassembly

Post by pman92 »

AngelMarc wrote: Tue Jul 29, 2025 12:07 am Yeah, none of it sounds reasonable to me, so I put it all out of mind and went Ghidra.
But, recently put some of my own code in Ghidra, aaaand it was incoherent in areas. Looked like nonsense. Gave it a .elf file. Order of operations were jumbled in areas. Was real bad.
So, seems I just don't have a good option, as far as I can tell.
If it's your own compiled code, especially if it's been compiled with optimisation, it's normal for it to look very very different to the source code.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

this
Capture.PNG
is suppose to be

Code: Select all

void loop() {
  if (newSample) {
    newSample = false;

        if (digitalRead(21) == HIGH){
    // Spark patterns
    if (signalHistory == pattern0) {triggerPulseSpark0 = true; triggerPulseFuel0 = true;}
    if (signalHistory == pattern1) {triggerPulseSpark2 = true; triggerPulseFuel2 = true;}
    if (signalHistory == pattern2) {triggerPulseSpark4 = true; triggerPulseFuel4 = true;}
    if (signalHistory == pattern3) {triggerPulseSpark6 = true; triggerPulseFuel6 = true;}
    } 
        if (digitalRead(21) == LOW) {
    if (signalHistory == pattern0) {triggerPulseSpark1 = true; triggerPulseFuel1 = true;}
    if (signalHistory == pattern1) {triggerPulseSpark3 = true; triggerPulseFuel3 = true;}
    if (signalHistory == pattern2) {triggerPulseSpark5 = true; triggerPulseFuel5 = true;}
    if (signalHistory == pattern3) {triggerPulseSpark7 = true; triggerPulseFuel7 = true;}
    }
And a piece of this jammed in there for some reason.

Code: Select all

   RPMTimeavg = constrain(RPMTimeavg, 278UL, 3000000UL);  // 9600 RPM to 0 RPM. Always round the decimal up, even if it's 0.0001. Not overflowing arrays is important
    // --- ADC rolling average (12-bit to 7-bit scale) ---
    total -= readings[bufIndex];
    int newVal = analogRead(A0);
    readings[bufIndex] = newVal;
    total += newVal;
    bufIndex = (bufIndex + 1) % 24;
    int avg12bit = total / 24;
    adcIndex = avg12bit >> 8; //Discarding LSBs to match array resolution
    uint32_t IndexFull = ((uint64_t)2500000 << 8) / ((uint32_t)RPMTimeavg * 600);
    
    uint16_t IndexWhole = IndexFull >> 8;
    uint8_t Frac = IndexFull & 0xFF;
    int Frac2 = avg12bit & 0x1F;
I don't even see all the cylinders in the decompile.
The 1st half "if PVar1=high" if cam signal high, then 4 ifs inside it, looked reasonable enough. Why wouldn't the second half, with the other 4 cylinders, look as reasonable? instead it looks like the scribblings of a psychopath.
You do not have the required permissions to view the files attached to this post.
Don't stress specific units.
User avatar
AngelMarc
Posts: 612
Joined: Sat Apr 08, 2023 11:23 am
cars: A CB450 running to 8,000RPM with a P59.

Re: 12587603 OS disassembly

Post by AngelMarc »

pman92 wrote: Tue Jul 29, 2025 12:35 am If it's your own compiled code, especially if it's been compiled with optimisation, it's normal for it to look very very different to the source code.
Wasn't a just a .bin file.
.elf
https://en.wikipedia.org/wiki/Executabl ... ble_Format
What Arduino IDE outputs with some "verbose" options set.
in other words, Ghidra had extra info vs just a .bin.
Last edited by AngelMarc on Tue Jul 29, 2025 1:33 am, edited 1 time in total.
Don't stress specific units.