I found this a while back over on the HPT's forum discussing how the main loops are setup in a 512 kB OS. It was from back in the day when the early tuning packages were still being developed. I hope that it provides some use and insight to those who are smarter than me on how all this stuff works.
https://forum.hptuners.com/showthread.p ... isassembly
512 kB main loop reference
-
turbo_bu
- Posts: 65
- Joined: Mon Dec 02, 2019 5:58 pm
-
turbo_bu
- Posts: 65
- Joined: Mon Dec 02, 2019 5:58 pm
Re: 512 kB main loop reference
FWIW - in the 12202088 OS, the main loops start at $2A1D6 and go through $2A298. I am not 100% sure how / why it starts, but I could at least match up with the code that they were sharing.
I have some vague ideas about how things translate from code into meaningful outputs (like spark, fuel etc..), but haven't figured it all out yet. I am hoping that bread crumbs like these will give others who understand this stuff more a head start on figuring things out.
I have some vague ideas about how things translate from code into meaningful outputs (like spark, fuel etc..), but haven't figured it all out yet. I am hoping that bread crumbs like these will give others who understand this stuff more a head start on figuring things out.
-
NSFW
- Posts: 802
- Joined: Fri Feb 02, 2018 5:13 am
Re: 512 kB main loop reference
Thanks for posting this. I just started working on 12587603 (a P59 operating system that's available in lots of configurations) and the same loops are present in that one.
It's weird that the code looks like a bunch of endless loops. I don't see why the PCM isn't just bricked every time it goes into one of them.
It's weird that the code looks like a bunch of endless loops. I don't see why the PCM isn't just bricked every time it goes into one of them.
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!
-
turbo_bu
- Posts: 65
- Joined: Mon Dec 02, 2019 5:58 pm
Re: 512 kB main loop reference
NSFW - I have a similar thought process as well, but my guess is that is how the code functions. It starts when you power it up, (not sure how it originally gets here), and then relies on interrupts to kick it out of certain loops, which then brings it back (again, not sure how it gets back to here either). I am hoping that other people who know a lot more can shed some light on how these basic things happen.
-
antus
- Site Admin
- Posts: 10096
- 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: 512 kB main loop reference
The vectors are a list of addresses at the start of the bin. The second address in the list is the reset vector from memory so this is the starting point (i think the first is the stack - should be documented in the processor data sheets). I think the loops are interupt driven by the timing hardware (tpu), so they fire off at given time intervals to process data and calculate times. Typically it'd program timing data in to the onboard helper hardware that does the work to trigger injectors and coils at the right time.
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
-
turbo_bu
- Posts: 65
- Joined: Mon Dec 02, 2019 5:58 pm
Re: 512 kB main loop reference
So all these loops are basically calculating things which get loaded into memory, which the helper hardware uses to trigger things like spark and fuel? If this is correct, then the key thing to work backwards from is which memory addresses are the actual ones which are used by the helper hardware.
-
Highlander
- Posts: 82
- Joined: Sun May 11, 2014 8:36 am
- cars: Z06
Re: 512 kB main loop reference
What is the main goal?
-
turbo_bu
- Posts: 65
- Joined: Mon Dec 02, 2019 5:58 pm
Re: 512 kB main loop reference
Goal would be to try and add a new feature to the existing OS. Something like rev limiter using spark instead of fuel. If we knew which address was the main one controlling, then we could try and figure out how to modify it outside of the existing OS. This also implies that we understand which loop(s) are also modifying these same addresses.
Adding other features would most likely follow this same path.
Adding other features would most likely follow this same path.
-
Highlander
- Posts: 82
- Joined: Sun May 11, 2014 8:36 am
- cars: Z06
Re: 512 kB main loop reference
That shouldn't be too difficult to implement. But based on what? Trigger input? these ECMs have 3 inputs you can use IIRC. but I only know of one ground input which is what EFILive found.
-
turbo_v6
- Posts: 513
- Joined: Tue Apr 10, 2018 10:50 pm
Re: 512 kB main loop reference
I think going to a spark cut vs. a fuel cut rev limit would be really nice and you wouldn't need any more inputs to do that.
LS1 Boost OS Version 5 Available Here. For feature suggestions post in here Development Thread.