New to source code editing
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
As far as a timer/counter...
Here's mine:
https://github.com/kerchakone/MerpMo...erpMod/Timer.c
May not work too great on this old CPU but the idea is there.
It's really simple. Need to find out how many cycles per second the CPU runs your code at. For this code I wrote it was about 15000 per second.
Then everytime the code is run it counts down 1. So you set the highest value you need and it counts down to 0. When it gets there execute what you need.
Again, this ECM had PLENTY of ram and was 32 bit so the code worked easily, but will need to be worked for these old cars.
You'll need at least 2 bytes of ram for a counter. And possibly another bit or two for execution flag and start flag.
Here's mine:
https://github.com/kerchakone/MerpMo...erpMod/Timer.c
May not work too great on this old CPU but the idea is there.
It's really simple. Need to find out how many cycles per second the CPU runs your code at. For this code I wrote it was about 15000 per second.
Then everytime the code is run it counts down 1. So you set the highest value you need and it counts down to 0. When it gets there execute what you need.
Again, this ECM had PLENTY of ram and was 32 bit so the code worked easily, but will need to be worked for these old cars.
You'll need at least 2 bytes of ram for a counter. And possibly another bit or two for execution flag and start flag.
Last edited by Vanilla Ice; May 17, 2016 at 03:59 PM.
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
Could I just make it where it then jumps from a point to check if the knock counts are lower than the threshold and then turn the light off? Or would that cause the program to infinitely loop with checking if it is higher and checking if it is lower?
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
You also keep saying knock counts. Please use knock retard instead. It will make your coding infinitely easier. I speak from experience. I don't know if you missed it or youre just typing counts still but meaning degrees, but use degrees of retard.
As far as looping, you MUST walk through the code you're writing to make sure there are no bugs or "loops." Take a value and go through the code to see where it ends up. Then take another value and do the same. You should be able to see every way it walks through and where it ends up. This is how you avoid loops and errors.
I found that in order to write in Antilag how I wanted there was a massive amount of coding I had to add in to keep it working correctly. I never went back to streamline it and it may have been done, but the original code is quite long.
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
Ok sorry for using knock counts, That's how it was mentioned in the program. Anyways, since school is done Ill have much more time to work on this. And do you know how exactly fast the program runs all of this? I guess I just need a perspective view to understand things correctly. I was just wondering because if I put this at the end of the program how long it would actually take to start reading it. This is because I don't know if the program just reads down onto the next line if there are no jumps or interrupts?
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
I feel like it is pretty straight forward in terms of just copying the same code but to turn it off if it is lower than the knock retard threshold. But I also feel like after the first time it runs to check if it is higher it should run the whole program again and then check to see if it is lower.
I guess now would be a good time to start learning how to actually make it jump from the middle of the "stock" code to my "patch area".
To do this I am assuming I need to find all the points where the "knock retard" value is loaded in and then after where it completes that portion jumps to my "patch" and executes the first part?
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b
cmpb 8EE5 ;compare knock retard to knock threshold
bhi LF60C ;branch if hi to
LF60C: clrb
jsr LF60D
LF60D: bset *L0038,#0x01 ;turn on check engine light
LF60E: ldab *L00A2 ;load knock counts to acumulator b
cmpb 8EE5 ;compare knock retard to knock threshold
bhi LF60F ;branch if low to
LF60F: clrb
jsr LF610
LF610: bset *L0038,#0x00 ;turn off check engine light To do this I am assuming I need to find all the points where the "knock retard" value is loaded in and then after where it completes that portion jumps to my "patch" and executes the first part?
Joined: Apr 2004
Posts: 3,180
Likes: 3
From: Browns Town
Car: 86 Monte SS (730,$8D,G3,AP,4K,S_V4)
Engine: 406 Hyd Roller 236/242
Transmission: 700R4 HomeBrew, 2.4K stall
Axle/Gears: 3:73 Posi, 7.5 Soon to break
Re: New to source code editing
Suggestion,
Don't use CEL for the indication (It will scare you the first time it turns on a WOT)
Find an open output and wire up an LED to it.
Use 1 RAM address,
If Knock retard >0 then increment up by 1.
If Knock Retard=0 then decrement by 1.
If RAM >0 = turn on light, RAM = 0, turn off light.
or use no RAM,
if Knock Retard >0, turn on the light.
if Knock Retard = 0, Turn off the light.
That option will give no residual delay of the light turning off.
Gets rid of any CEL/SES light conflicts in the code.
Don't use CEL for the indication (It will scare you the first time it turns on a WOT)
Find an open output and wire up an LED to it.
Use 1 RAM address,
If Knock retard >0 then increment up by 1.
If Knock Retard=0 then decrement by 1.
If RAM >0 = turn on light, RAM = 0, turn off light.
or use no RAM,
if Knock Retard >0, turn on the light.
if Knock Retard = 0, Turn off the light.
That option will give no residual delay of the light turning off.
Gets rid of any CEL/SES light conflicts in the code.
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
But i was told that there are not too many outputs you can use on the 7730 ecm. That is why I would use the CEL. And this isnt neccsarily to be totally practical. Its just so can learn some of the ins and outs of the ecm for future tuning use.
Drew
Drew
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
You ever get this going?
Here you can see how I started this venture:
https://www.thirdgen.org/forums/powe...ml#post6055449
Maybe you'd like to take my setup idea and make it better so I don't have to.
Here you can see how I started this venture:
https://www.thirdgen.org/forums/powe...ml#post6055449
Maybe you'd like to take my setup idea and make it better so I don't have to.
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
How or where are you writing this patch?
If you're writing in hex just use a hex editor to edit the bin directly.
Right now I alter the Ida file and produce a dif file then use idapatcher.c to patch the bin.
If you're writing in hex just use a hex editor to edit the bin directly.
Right now I alter the Ida file and produce a dif file then use idapatcher.c to patch the bin.
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
I was just modifying the text file to see what worked. I haven't done anything with assembling it back.
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
I read through that whole thing twice and I can't seem to get the assembler to work. I don't know if it is because I have windows 10 or not.
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
I have read the write up using tuner pro: https://www.thirdgen.org/forums/diy-...-tunerpro.html
but there were some steps that jumped to another without very much explanation.
but there were some steps that jumped to another without very much explanation.
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
I have read the write up using tuner pro: https://www.thirdgen.org/forums/diy-...-tunerpro.html
but there were some steps that jumped to another without very much explanation.
but there were some steps that jumped to another without very much explanation.
Thread Starter
Member

Joined: Aug 2011
Posts: 280
Likes: 5
From: Wisconsin
Car: 1985 Camaro Sport Coupe
Engine: Chevy 3.1
Transmission: 700r4
Re: New to source code editing
Haha Yeah I guess. Would using tunerpro to change the hex file work though? Is that what you would use?
Supreme Member

Joined: Aug 2002
Posts: 1,170
Likes: 42
From: ARIZONA
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Thread
Thread Starter
Forum
Replies
Last Post
AmpleUnicorn88
South West Region
28
May 22, 2017 12:47 PM
yevgenievich
Engine/Drivetrain/Suspension Parts for Sale
7
Jul 18, 2016 07:47 AM
85@IRocZ
Engine/Drivetrain/Suspension Parts for Sale
21
May 17, 2016 08:03 PM




