New to source code editing
#1
Member
Thread Starter
New to source code editing
So here is my dilemma, I am really interested in the potentials of source code editing for our ecms but it seems like alot of the information on here is very outdated.
I have read all of the threads on source code editing and almost all the links are no longer there. I would really like to continue to learn this stuff and help others out as well.
So the ecm I will be using is a '7730 ecm and I want to run a $A1 mask on it. This is because I want the DIS from the FWD and MAP sensor with other features as well.
BUT... In the future I want to put forced induction on which I know will require a 2 bar MAP sensor. With this I also want to learn the basics of source code editing and patching.
What I already know: Some kind of dissasembler, I got the TUNERCATS dissasembler and when I dissasembled a bin it put it into an .src file.
When I open it up in note pad I have a vague Idea of whats going on but really don't know what parts of the program do what so I really don't know what to comment on to remember. I don't know if you can use the hex editor in Tunerpro RT to find values where things are located or what.
Then I don't know what to use for an assembler. I can not find a link for the as6811 assembler that was talked about in the old threads.
I know actually understanding the assembly language will need some practice but I am definately willing to put in the time if someone wants to teach me or if they still think it is worth it.
Thanks,
Drew
I have read all of the threads on source code editing and almost all the links are no longer there. I would really like to continue to learn this stuff and help others out as well.
So the ecm I will be using is a '7730 ecm and I want to run a $A1 mask on it. This is because I want the DIS from the FWD and MAP sensor with other features as well.
BUT... In the future I want to put forced induction on which I know will require a 2 bar MAP sensor. With this I also want to learn the basics of source code editing and patching.
What I already know: Some kind of dissasembler, I got the TUNERCATS dissasembler and when I dissasembled a bin it put it into an .src file.
When I open it up in note pad I have a vague Idea of whats going on but really don't know what parts of the program do what so I really don't know what to comment on to remember. I don't know if you can use the hex editor in Tunerpro RT to find values where things are located or what.
Then I don't know what to use for an assembler. I can not find a link for the as6811 assembler that was talked about in the old threads.
I know actually understanding the assembly language will need some practice but I am definately willing to put in the time if someone wants to teach me or if they still think it is worth it.
Thanks,
Drew
#3
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
camaroyoungster, couple of things to discuss. Using $A1 because it has been used for DIS is not required. The $8D code base will also run DIS, and is a better start.
$8F is already 2-bar MAP compliment, and was also used with a DIS system. This was on the '89 - '92 (or so) FWD 3.1l Turbo Grand Prix's. There is also $58, which GM used in many turbo cars.
All of the above have disassembled hacs available. Some are well commented which is a blessing to those just starting out.
I wrote my own disassembler as at the time there weren't any available at a reasonable cost.
I use Dunfields cross-assembler for assembling source into a S19 file. Then use home built tools to convert into a BIN. It can handle large source code files.
I have also used AS11 to assemble code, but it can only handle smaller files. I did this first to create patch files for BINs. This is a good way to start out learning the code.
RBob.
$8F is already 2-bar MAP compliment, and was also used with a DIS system. This was on the '89 - '92 (or so) FWD 3.1l Turbo Grand Prix's. There is also $58, which GM used in many turbo cars.
All of the above have disassembled hacs available. Some are well commented which is a blessing to those just starting out.
I wrote my own disassembler as at the time there weren't any available at a reasonable cost.
I use Dunfields cross-assembler for assembling source into a S19 file. Then use home built tools to convert into a BIN. It can handle large source code files.
I have also used AS11 to assemble code, but it can only handle smaller files. I did this first to create patch files for BINs. This is a good way to start out learning the code.
RBob.
#4
Member
Thread Starter
Re: New to source code editing
Thanks for giving me some feedback, to be honest I really didn't know where to start with masks but that is definitely pointing me in the right direction.
Now if there are already hacs out there to mess with, what would I now have to do be able to assemble them back into a bin. I guess I can just use AS11 to patch for now because I really don't need to do anything bigger than that. I have a machine that is running windows 10 and I have previously tried running that to see if I could get it to work but I really don't know what it all needs to run.
Drew
Now if there are already hacs out there to mess with, what would I now have to do be able to assemble them back into a bin. I guess I can just use AS11 to patch for now because I really don't need to do anything bigger than that. I have a machine that is running windows 10 and I have previously tried running that to see if I could get it to work but I really don't know what it all needs to run.
Drew
#5
Re: New to source code editing
I've thought about this for a while too. I've read everything I could find years ago and then again a while ago. it's just that first jump I guess,.. I haven't made it yet lol.
I do have a few questions too. a hack, is that just a bin file, like say the s_aujp that when you disassemble it, export it to a file and opened in plain old notepad, will have comments show up next to the lines of code? or are these separate files that are just hacks.
and yes, as I understand it, if you have a well defined xdf, you can kinda cross reference that location of the values, and guess get an idea of where what is. and there's some section of the oem chip manual to download, so you understand the short cuts and what the terms mean.
as what bin to start with, Rbob gave good info, the dis is easy to adjust for just using tunerpro settings. at this point, 8D has a great bin with the S_aujp project. now that it seems the AE and DE adjustments are well documented. back when I tried it 5 or 6 years ago, AE made me want to throw my laptop out of the window haha. but everything else ran great. I switched to a easier to understand code, but I'll probably go back and try again for my na project later. big thing I see would be going thru and converting to 2 bar, which I think is very involved, and probably not so much noob project. you'd need deep understanding of how the code works, I'm guessing just about everything is map value based. maybe just a map2 input fuel and spark table would be easier. but I don't know.
and then a E85 sensor input and somehow a table modifier to change the target af and timing, or some way to get the low octane part of the stock code involve?
anyways. as you go along and dive in. please follow up here. I'd like to follow and see how it goes.
oh and it seems like Windows itself is a hassle, since more of these programs aren't main stream. when Windows changes everything. it's not backwards compatible. which sucks too
I do have a few questions too. a hack, is that just a bin file, like say the s_aujp that when you disassemble it, export it to a file and opened in plain old notepad, will have comments show up next to the lines of code? or are these separate files that are just hacks.
and yes, as I understand it, if you have a well defined xdf, you can kinda cross reference that location of the values, and guess get an idea of where what is. and there's some section of the oem chip manual to download, so you understand the short cuts and what the terms mean.
as what bin to start with, Rbob gave good info, the dis is easy to adjust for just using tunerpro settings. at this point, 8D has a great bin with the S_aujp project. now that it seems the AE and DE adjustments are well documented. back when I tried it 5 or 6 years ago, AE made me want to throw my laptop out of the window haha. but everything else ran great. I switched to a easier to understand code, but I'll probably go back and try again for my na project later. big thing I see would be going thru and converting to 2 bar, which I think is very involved, and probably not so much noob project. you'd need deep understanding of how the code works, I'm guessing just about everything is map value based. maybe just a map2 input fuel and spark table would be easier. but I don't know.
and then a E85 sensor input and somehow a table modifier to change the target af and timing, or some way to get the low octane part of the stock code involve?
anyways. as you go along and dive in. please follow up here. I'd like to follow and see how it goes.
oh and it seems like Windows itself is a hassle, since more of these programs aren't main stream. when Windows changes everything. it's not backwards compatible. which sucks too
#6
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
Thanks for giving me some feedback, to be honest I really didn't know where to start with masks but that is definitely pointing me in the right direction.
Now if there are already hacs out there to mess with, what would I now have to do be able to assemble them back into a bin. I guess I can just use AS11 to patch for now because I really don't need to do anything bigger than that. I have a machine that is running windows 10 and I have previously tried running that to see if I could get it to work but I really don't know what it all needs to run.
Drew
Now if there are already hacs out there to mess with, what would I now have to do be able to assemble them back into a bin. I guess I can just use AS11 to patch for now because I really don't need to do anything bigger than that. I have a machine that is running windows 10 and I have previously tried running that to see if I could get it to work but I really don't know what it all needs to run.
Drew
https://www.thirdgen.org/forums/diy-...thod-demo.html
To open a DOS type command window: Start->Run, then enter CMD and hit the enter key. Can then run AS11 and the patch utility.
As for assembling the source code, will need to edit it first. The code formatting varies some between different assemblers. And hacs that have the line numbers and addresses listed will need them removed.
RBob.
#7
Member
Thread Starter
Re: New to source code editing
Ok, I guess could we start from the beginning?
Reading the patch method demo thread assumes that you already have it at the part where all you have to do is change the code and re assemble it. I don't know where to begin so that is why I am asking.
I now have a .bin for the 3.1 turbo grand prix and a text file with I am pretty sure the actual code.
So I am assuming I need to disassemble the bin first but what would be the best program to use to disassemble? I guess what would you reccommend?
Do I need to get it into a .dis or a .src?
Thanks for putting up with me, definitely a rookie but it really interests me.
Drew
Reading the patch method demo thread assumes that you already have it at the part where all you have to do is change the code and re assemble it. I don't know where to begin so that is why I am asking.
I now have a .bin for the 3.1 turbo grand prix and a text file with I am pretty sure the actual code.
So I am assuming I need to disassemble the bin first but what would be the best program to use to disassemble? I guess what would you reccommend?
Do I need to get it into a .dis or a .src?
Thanks for putting up with me, definitely a rookie but it really interests me.
Drew
Trending Topics
#8
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
The patch method demo is not about reassembling the entire source. It is where a small source file is created that is over-laid on top of a current BIN file. Thereby 'patching' it.
The 8F_hack.txt file is already disassembled into source. It needs work to make it into something that will assemble. But that isn't required (not yet at least).
Read through the 8F_hack until you start to understand the code. Then what changes do you want to make. Having the Motorola pink book is also required as it lists the CPU operations and how they work.
Chapter 4 is the one to study:
http://www.nxp.com/files/microcontro...t/M68HC11E.pdf
RBob.
The 8F_hack.txt file is already disassembled into source. It needs work to make it into something that will assemble. But that isn't required (not yet at least).
Read through the 8F_hack until you start to understand the code. Then what changes do you want to make. Having the Motorola pink book is also required as it lists the CPU operations and how they work.
Chapter 4 is the one to study:
http://www.nxp.com/files/microcontro...t/M68HC11E.pdf
RBob.
#9
Member
Thread Starter
Re: New to source code editing
So in the .txt file I am assuming from line 0000 to 9FF0 are the values that are set to begin with like what you actually change in a tuner program like tuner pro. Then starting at A000 is where the actual program starts:
lds: Load stack pointer
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
; INITIALIZATION ROUTINES
;--------------------------------------------------------
A000 ILOPRT:lds #0x01FF ;SET USER STACK
A003 jsr LF160 ;GO DO FACTORY TEST
A006 ldd #0xEB1A
A009 std L3FFC ;CPU CONTROL REG
;--------------------------------------------------------
A000 ILOPRT:lds #0x01FF ;SET USER STACK
A003 jsr LF160 ;GO DO FACTORY TEST
A006 ldd #0xEB1A
A009 std L3FFC ;CPU CONTROL REG
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
#10
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
So in the .txt file I am assuming from line 0000 to 9FF0 are the values that are set to begin with like what you actually change in a tuner program like tuner pro. Then starting at A000 is where the actual program starts:
lds: Load stack pointer
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
lds: Load stack pointer
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
#11
Member
Thread Starter
Re: New to source code editing
But when I looked in the code I couldn't find an address. All I could find is this and then later in the code it references it a few times but doesn't actually have a value.
And it only goes up to 0x02DE.
Does it not need that to function?
;NON BATTERY BACKED STATIC RAM 0x0100-0x01FF
;----------------------------------------------------------------------------------------
00FE L0100 = 0x0100 ;FACTORY TEST MODE WD
0100 L0101 = 0x0101 ;DECAY COUNTER FOR CRANK TO RUN
0101 L0103= 0x0103 ;O2 CROSS COUNTS
0103 L0104 = 0x0104 ;MALF 53 QUALIFICATION TIMER
0104 L0105 = 0x0105 ;TPS 4
;----------------------------------------------------------------------------------------
00FE L0100 = 0x0100 ;FACTORY TEST MODE WD
0100 L0101 = 0x0101 ;DECAY COUNTER FOR CRANK TO RUN
0101 L0103= 0x0103 ;O2 CROSS COUNTS
0103 L0104 = 0x0104 ;MALF 53 QUALIFICATION TIMER
0104 L0105 = 0x0105 ;TPS 4
Does it not need that to function?
#12
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
It may not be commented in whatever your looking at and its not going to be in the bin file since ram is separate from the prom.
The stack takes a lot of space so 02DE-02ff is probably all stack.
The stack takes a lot of space so 02DE-02ff is probably all stack.
#13
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
So in the .txt file I am assuming from line 0000 to 9FF0 are the values that are set to begin with like what you actually change in a tuner program like tuner pro. Then starting at A000 is where the actual program starts:
lds: Load stack pointer
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
lds: Load stack pointer
jsr: Jump to subrountine
ldd: Load double accumulator d
std: store accumulator d
But are the values that are right after them addresses for other lines to reference?
I guess this is where things start to get confusing for me.
I know from basic programming the LF160 is a label for line F160 where it jumps to do the factory subroutine so the lines that have an L in front of them make sense.
So does that mean the#01x01FF an integer that it loads to the stack pointer?
Code:
A000 ILOPRT: lds #0x01FF ; SET USER STACK
Code:
A003 jsr LF160 ; GO DO FACTORY TEST
Code:
A006 ldd #0xEB1A
Code:
A009 std L3FFC ; CPU CONTROL REG
Code:
3FFA L3FFC = 0x3FFC ; CPU CTL REG
Note that in front of the above lines of code are values such as: A000, A003, A006, A009, and 3FFA. To assemble this source they need to be removed.
RBob.
Last edited by RBob; 05-03-2016 at 12:36 PM.
#14
Member
Thread Starter
Re: New to source code editing
Ok this makes more sense now. So the program on the EEPROM tells the computer to store a certain value from earlier in the program to the RAM so then it can be manipulated in however it is supposed to.
Looking at table 2-4 of the M68HC11.pdf you have it lists all of the address's for the ram and they are noted as 0x0000-0xFFF but this ecm only uses up to 0x6000?
Next question:
How does the program reference the address or the values at that address in the program:
Where it later is referenced:
82D9 is referenced as #0x82D9 so does the program store those values in the ram momentarily while it compares values?
Looking at table 2-4 of the M68HC11.pdf you have it lists all of the address's for the ram and they are noted as 0x0000-0xFFF but this ecm only uses up to 0x6000?
Next question:
How does the program reference the address or the values at that address in the program:
Code:
ESC ATTACK RATE VS RPM RPM ------------------------------------- 82D9 06 400 08 1200 0A 2000 0B 3200 0E 4800
Code:
AF35 ldx #0x82D9 ;ESC ATTACK RATE VS RPM
Last edited by camaroyoungster; 05-03-2016 at 05:05 PM.
#15
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
RBob.
#16
Member
Thread Starter
Re: New to source code editing
Ok, I'll make sure to study that more. I guess moving forward, I have found the code for a "soft rev limiter". How exactly would I change the rpm value in the code so it has a lower rev limiter.
I think that there is actually more of this piece in regards to the rev limiter that goes into fuel cut but I am not sure. I just didn't want to copy all of the extra code.
Code:
;----------------------------------- ; ?? SOFT REV LIMIT ;----------------------------------- C1D5 LC1D5:ldy #0x864E ;1ST OPTN FLAG C1D9 brset 0x00,y,#0x10,LC1E1 ;BRANCH IF BIT SET 4 = ? (BIT CLEAR) C1DE jmp LC27C C1E1 LC1E1:ldy #0x8650 ;3RD OPTN FLAG C1E5 brset 0x00,y,#0x20,LC210 ;BRANCH IF BIT SET 5=?? (BIT CLEAR) C1EA brclr *L003D,#0x20,LC206 ;BRANCH IF NOT IN POWER ENRICHENT, ELSE C1EE ldaa L86C9 ;FF 6375 RPM C1F1 brclr *L002E,#0x08,LC1F8 ;BRANCH IF SPARK OFF, ELSE C1F5 ldaa L86C8 ;FF 6375 RPM C1F8 LC1F8:cmpa *L005F ;RPM/25 C1FA bcc LC206 ;BRANCH IF 86C9 OR 86C8 >= RPM/25, ELSE C1FC bset *L002E,#0x08 ;REV LIMITER? OVER 6350 RPM? VEH MOVING? C1FF ldd *L0088 ;GET THE PULSE WIDTH C201 jsr LC31A ;SET THE NEW BPW C204 bra LC20E ;BRANCH C206 LC206:bclr *L002E,#0x08 ;SPARK ON FLAG? C209 clra ;CLEAR A C20A clrb ;CLEAR B C20B std L1819 ;KILL SPARK C20E LC20E:bra LC248 ;BRANCH
#17
Senior Member
iTrader: (2)
Re: New to source code editing
See this link:
https://www.thirdgen.org/forums/diy-...thod-demo.html
To open a DOS type command window: Start->Run, then enter CMD and hit the enter key. Can then run AS11 and the patch utility.
As for assembling the source code, will need to edit it first. The code formatting varies some between different assemblers. And hacs that have the line numbers and addresses listed will need them removed.
RBob.
https://www.thirdgen.org/forums/diy-...thod-demo.html
To open a DOS type command window: Start->Run, then enter CMD and hit the enter key. Can then run AS11 and the patch utility.
As for assembling the source code, will need to edit it first. The code formatting varies some between different assemblers. And hacs that have the line numbers and addresses listed will need them removed.
RBob.
#18
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
Code:
C1EE ldaa L86C9 ;FF 6375 RPM C1F5 ldaa L86C8 ;FF 6375 RPM
RBob.
#19
Member
Thread Starter
Re: New to source code editing
Ok, so to change those values you actually have to use a tuning program? So I guess to actually learn how to add a patch to this program. I guess one thing that would be useful would be anti-lag when holding down a switch. Where would I start with that?
Drew
Drew
#21
Member
Thread Starter
Re: New to source code editing
I take it, it's not to easy? I guess I just need something simple to add so I can learn how it works.
#22
Senior Member
Re: New to source code editing
Hmm, this is a very interesting thread! Forgive me for intruding. I have experience programming a 6502 8-bit CPU in assembly/machine language.
If I understand correctly 'LDAA' is Load from A Accumulator with an 8-bit value(s) from Location(s) $86C9 & $86C8. The comments state that the value $FF is for 6375 RPMs. That is the highest RPM the CPU can deal with, so there is no rev limit from the ECM.
If I understand correctly 'LDAA' is Load from A Accumulator with an 8-bit value(s) from Location(s) $86C9 & $86C8. The comments state that the value $FF is for 6375 RPMs. That is the highest RPM the CPU can deal with, so there is no rev limit from the ECM.
#23
Member
Thread Starter
Re: New to source code editing
So if you change $FF to some other number it technically changes the highest the rpm can go? So does that also mean that if 255 corresponds to 6375 that if I changed $FF to $FE that would represent 254 which 254*25=6350?
#24
Senior Member
Re: New to source code editing
That is correct, but I would have rather thought of it like so: 6375-X*(6375/256)
#25
Member
Thread Starter
Re: New to source code editing
But you actually can't change that value in the code? When I looked through it and used ctl+f and typed in 86C9 it would bring you to that value but the code doesn't use that value since there is no address for it or what? That's what I am kind of confused about. Rob said that is a calibration value but I don't know if it is stored in ram or what?
#26
Senior Member
Re: New to source code editing
But you actually can't change that value in the code? When I looked through it and used ctl+f and typed in 86C9 it would bring you to that value but the code doesn't use that value since there is no address for it or what? That's what I am kind of confused about. Rob said that is a calibration value but I don't know if it is stored in ram or what?
#27
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
I'll gift you my anti lag code for a jump start.
Here: https://github.com/kerchakone/MerpMo.../MerpMod/ALS.c
#28
Member
Thread Starter
Re: New to source code editing
Thanks Vanilla, in the future I would love to do something like that but I guess in the moment I was trying to think of a feature I would like to add that isn't already in there that might be easy to add.
And ultroadwarrior, I guess it helps to understand things when you know where the values such as the max rpm come from since I really don't know how the cpu looks up values that are set to begin with.
I understand the basic operations that the computer can do for the most part. I also know that the cpu gets the values somehow and then stores them in RAM to be used later for other functions. I guess it's just learning how to piece them together to get the ECM to perform how you want it. But another thing is how does the computer read inputs change values compared to base values and then outputs those changes to change things such as pw or IAC.
I am sorry if it is a little frustrating trying to understand me but I guess it's how the cup works together with the memory as well as inputs and outputs.
Drew
And ultroadwarrior, I guess it helps to understand things when you know where the values such as the max rpm come from since I really don't know how the cpu looks up values that are set to begin with.
I understand the basic operations that the computer can do for the most part. I also know that the cpu gets the values somehow and then stores them in RAM to be used later for other functions. I guess it's just learning how to piece them together to get the ECM to perform how you want it. But another thing is how does the computer read inputs change values compared to base values and then outputs those changes to change things such as pw or IAC.
I am sorry if it is a little frustrating trying to understand me but I guess it's how the cup works together with the memory as well as inputs and outputs.
Drew
#29
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
Thanks Vanilla, in the future I would love to do something like that but I guess in the moment I was trying to think of a feature I would like to add that isn't already in there that might be easy to add.
And ultroadwarrior, I guess it helps to understand things when you know where the values such as the max rpm come from since I really don't know how the cpu looks up values that are set to begin with.
I understand the basic operations that the computer can do for the most part. I also know that the cpu gets the values somehow and then stores them in RAM to be used later for other functions. I guess it's just learning how to piece them together to get the ECM to perform how you want it. But another thing is how does the computer read inputs change values compared to base values and then outputs those changes to change things such as pw or IAC.
I am sorry if it is a little frustrating trying to understand me but I guess it's how the cup works together with the memory as well as inputs and outputs.
Drew
And ultroadwarrior, I guess it helps to understand things when you know where the values such as the max rpm come from since I really don't know how the cpu looks up values that are set to begin with.
I understand the basic operations that the computer can do for the most part. I also know that the cpu gets the values somehow and then stores them in RAM to be used later for other functions. I guess it's just learning how to piece them together to get the ECM to perform how you want it. But another thing is how does the computer read inputs change values compared to base values and then outputs those changes to change things such as pw or IAC.
I am sorry if it is a little frustrating trying to understand me but I guess it's how the cup works together with the memory as well as inputs and outputs.
Drew
It requires hacking at all levels of the rom. It doesn't get much more complicated.
Why don't you try making the ses flash when knock retard is greater than a certain threshold? Something easy like that.
#31
Member
Thread Starter
Re: New to source code editing
Ok I did some more researching. In the program there are multiple times where the spark is being retarded. Do I have to add code in each place to put the ses on or is there a way to have both jump to just one location and then return?
Drew
Drew
#32
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
Easy, Find a place to "hook" the code jumping to a subroutine that you fully write. In the subroutine: read knock amount, is knock greater than threshold?
If yes light on, return from subroutine.
If no light off, return from subroutine.
There may be more to this to get it to flash or stay lit. That's part of the fun. You probably need to add in a check prior to the knock check that sees if the light is already on.
Done.
Now you can use this subroutine jump to run any code you wish. Just replace the return from subroutine to a jump to another then return from that one.
If yes light on, return from subroutine.
If no light off, return from subroutine.
There may be more to this to get it to flash or stay lit. That's part of the fun. You probably need to add in a check prior to the knock check that sees if the light is already on.
Done.
Now you can use this subroutine jump to run any code you wish. Just replace the return from subroutine to a jump to another then return from that one.
Last edited by Vanilla Ice; 05-10-2016 at 05:56 PM.
#33
Supreme Member
iTrader: (1)
Join Date: Apr 2004
Location: Browns Town
Posts: 3,178
Likes: 0
Received 3 Likes
on
3 Posts
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
Here is the real issue when changing code...
Changing a variable/parameter value that is located at a particular address is easy. Find it, figure out its scale factor and then alter the value.
This only requires that the checksum of the program get updated (or put AA in there to ignore the checksum calculation.
To change the functionality there is a greater problem.
The code has some "lables" to points within the structure that are called by areas and routines. These "jump to" points are pretty clear once you begin to see them.
Problem is that there are "Indexed" addressing within the programs.
They call for a jump to a "number" of lines within the code, NOT an exact location.
If you were to add some lines of code to change the operation of one item, you could corrupt the entire program.
By editing ALL of the locations within the program and giving them all explicit "lables", then all jumps are handled correctly. Adding code does not cause a problem.
The alternative to this is "Patching".
This method requires you to insert changes so that the existing items do not shift and the placement or sequence remains the same. Counting hex character positions and manual figuring is required to pull that off.
Small changes can be done pretty easily this way but large formatting would be a nightmare.
The AUJP JP2 was made "Re-locatable" to allow changes as you are looking to do.
It took significant time to make the file that way so if you start with another BCC you can reference it to see what was done.
HTH,
Jp
Ps, I'd like to see boost added someday to $8D as well.
Changing a variable/parameter value that is located at a particular address is easy. Find it, figure out its scale factor and then alter the value.
This only requires that the checksum of the program get updated (or put AA in there to ignore the checksum calculation.
To change the functionality there is a greater problem.
The code has some "lables" to points within the structure that are called by areas and routines. These "jump to" points are pretty clear once you begin to see them.
Problem is that there are "Indexed" addressing within the programs.
They call for a jump to a "number" of lines within the code, NOT an exact location.
If you were to add some lines of code to change the operation of one item, you could corrupt the entire program.
By editing ALL of the locations within the program and giving them all explicit "lables", then all jumps are handled correctly. Adding code does not cause a problem.
The alternative to this is "Patching".
This method requires you to insert changes so that the existing items do not shift and the placement or sequence remains the same. Counting hex character positions and manual figuring is required to pull that off.
Small changes can be done pretty easily this way but large formatting would be a nightmare.
The AUJP JP2 was made "Re-locatable" to allow changes as you are looking to do.
It took significant time to make the file that way so if you start with another BCC you can reference it to see what was done.
HTH,
Jp
Ps, I'd like to see boost added someday to $8D as well.
#35
Supreme Member
iTrader: (1)
Join Date: Apr 2004
Location: Browns Town
Posts: 3,178
Likes: 0
Received 3 Likes
on
3 Posts
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
https://www.thirdgen.org/forums/diy-...mmies-ask.html
Its a long thread in the stickys but it is where many of us asked all the dumb questions we could until we saw "some" light at the end of the tunnel.
Helped to take the "starting" bin if it is one that hasn't been done before and start working with it.
Its a long thread in the stickys but it is where many of us asked all the dumb questions we could until we saw "some" light at the end of the tunnel.
Helped to take the "starting" bin if it is one that hasn't been done before and start working with it.
#36
Senior Member
Re: New to source code editing
Why was the 68HC11 documentation recommended reading?
#37
Member
Thread Starter
Re: New to source code editing
Ok I tried my best to kind of piece something together to show that I somewhat know what is going on. This is turning on a check engine light (assuming it is already off) if the knock counts go past a certain threshold. I feel like it should be longer but I don't know.
LF60B and LF613 would be at the end of the code so I know I have enough room for it.
L00FF is the last spot in the memory where the threshold for the knock counts would be held. please correct me if I am wrong
Drew
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b cmpb L0FF ;compare knock counts to knock threshold bhi LF613 ;branch if hi to LF613: bset *L0038,#0x01 ;turn on check engine light
L00FF is the last spot in the memory where the threshold for the knock counts would be held. please correct me if I am wrong
Drew
#38
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
Re: New to source code editing
Chapter 4 only, it documents the instruction set and how the CPU utilizes it:
https://www.thirdgen.org/forums/diy-...ml#post6034624
RBob.
https://www.thirdgen.org/forums/diy-...ml#post6034624
RBob.
#39
Senior Member
Re: New to source code editing
Don't mean to hijack the OP's thread, so just one more question because I am extremely interested into getting to know the lowest level functions of the 165 and 730 ECMs...
You said GM uses a custom uProc. Do these uProc's have a 68HC11 core on these ECMs?
Or should I start another thread on this topic?
EDIT: Woops, missed this post about the sticky. Checking it out...
You said GM uses a custom uProc. Do these uProc's have a 68HC11 core on these ECMs?
Or should I start another thread on this topic?
EDIT: Woops, missed this post about the sticky.
https://www.thirdgen.org/forums/diy-...mmies-ask.html
Its a long thread in the stickys but it is where many of us asked all the dumb questions we could until we saw "some" light at the end of the tunnel.
Helped to take the "starting" bin if it is one that hasn't been done before and start working with it.
Its a long thread in the stickys but it is where many of us asked all the dumb questions we could until we saw "some" light at the end of the tunnel.
Helped to take the "starting" bin if it is one that hasn't been done before and start working with it.
Last edited by UltRoadWarrior9; 05-12-2016 at 06:36 PM.
#40
Senior Member
Re: New to source code editing
Ok I tried my best to kind of piece something together to show that I somewhat know what is going on. This is turning on a check engine light (assuming it is already off) if the knock counts go past a certain threshold. I feel like it should be longer but I don't know.
LF60B and LF613 would be at the end of the code so I know I have enough room for it.
L00FF is the last spot in the memory where the threshold for the knock counts would be held. please correct me if I am wrong
Drew
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b cmpb L0FF ;compare knock counts to knock threshold bhi LF613 ;branch if hi to LF613: bset *L0038,#0x01 ;turn on check engine light
L00FF is the last spot in the memory where the threshold for the knock counts would be held. please correct me if I am wrong
Drew
1) How much RAM/ROM(EEPROM) does this ECM have? I guess a better way to ask this question nowadays, is how much volatile/non-volatile memory? Old school was RAM/ROM.
2) Where in the CPU memory do they reside? We have 64K here, correct? Meaning the memory map is from ($0000-$FFFF)
3) Where are the I/O locations inside that memory map?
Last edited by UltRoadWarrior9; 05-12-2016 at 06:48 PM.
#41
Member
Thread Starter
Re: New to source code editing
A couple questions:
1) How much RAM/ROM(EEPROM) does this ECM have? I guess a better way to ask this question nowadays, is how much volatile/non-volatile memory? Old school was RAM/ROM.
2) Where in the CPU memory do they reside? We have 64K here, correct? Meaning the memory map is from ($0000-$FFFF)
3) Where are the I/O locations inside that memory map?
1) How much RAM/ROM(EEPROM) does this ECM have? I guess a better way to ask this question nowadays, is how much volatile/non-volatile memory? Old school was RAM/ROM.
2) Where in the CPU memory do they reside? We have 64K here, correct? Meaning the memory map is from ($0000-$FFFF)
3) Where are the I/O locations inside that memory map?
Please teach me haha.
The ecm that I would use is a '7730
Drew
#43
Member
Thread Starter
Re: New to source code editing
Ok so those are the actual locations, that really helps out. I wasn't really sure to begin with. So I guess where in the actual part of the code should I put the knock threshold value? It looks like the code is divided up into parts and I really don't know where It would work.
0000-00FF is battery backed static ram.
0100-1FF is non battery back static ram.
Then it skips to 0400-04FF for the Gm Hud debugging stuff
Then in the text file it gets kind of confusing where labels are not necessarily lined up with line # in the text file. Then what are the values starting at line 8000?
here is the start just for an example. Is it here I can put threshold value? when I am looking in the actual code that does operations I can see that it references the values but don't the 8XXX values get removed from the code?
0000-00FF is battery backed static ram.
0100-1FF is non battery back static ram.
Then it skips to 0400-04FF for the Gm Hud debugging stuff
Then in the text file it gets kind of confusing where labels are not necessarily lined up with line # in the text file. Then what are the values starting at line 8000?
Code:
89GPT.BIN->K:\EPROM\GPTURBO\GPTRUBO.MAP 8000 1447 PROMID 8002 09E1 EPROM DATE CODE 8004 0412 PRODUCTION SEQUENCE NUMBER 8006 B1B8 CHECKSUM 8008 8F PROGRAM ID WORD 8009 C0 192 6 CYLS KNUM CYLINDERS 800A 0889 2185 600 RPM STARTUP RPM-SPARK 800C 0B61 2913 450 RPM STARTUP RPM-FUEL 800E 3C 60 6000 RPM REDLINE (REPORTED IN ALDL MODE __) 800F 01C0 448 5.6 SEC ECM SHUT DOWN TIME
#44
Supreme Member
iTrader: (1)
Join Date: Apr 2004
Location: Browns Town
Posts: 3,178
Likes: 0
Received 3 Likes
on
3 Posts
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
Code:
8039 5A 90 9 SEC WIDE OPEN THROTTLE A/C DISABLE 803A 28 40 4 SEC WIDE OPEN THROTTLE A/C DISABLE TIME WITH HI N/V 803B 68 104 WIDE OPEN THROTTLE A/C DISABLE N/V RATIO THRESH 803C 00 0 DELTA TPS A/C DISABLE N/V DISABLE THRESHOLD 803D F6 246 IF TPS > THIS DISABLE A/C 803E FF 255 99.8 %TPS IF POSITIVE DELTA TPS > THIS, DISABLE A/C 803F 20 32 3.2 SEC DISABLE A/C CLUTCH FOR THIS TIME AFTER HIGH POSITIVE DELTA TPS
Address(from bin)___HEX Value(from bin)___Conversion value (Someone manually added) ___Decimal value (someone manually made that number)___ Description (Someone manually made that too)
OPEN YOUR XDF AND EDIT THE ITEM TO VERIFY THE ADDRESS SHOWN
You will see how things come together there.
The program execution that uses those variables starts at $A000 (correct)
But are the values that are right after them addresses for other lines to reference?
Let me help you see what is there.
Execution line example:
Code:
A095 LA095:ldaa *L0016
As you can see by the beginning of the file, the actual address and the "Lable" of the addressed item are shifted by 1. (Confusion factor)
Code:
MEMORY LABLES 007E L007F = 0x007F ;BLINK ON/OFF PERIOD COUNTER 007F L0080 = 0x0080 ;MALF LOGGING COUNTER 0080 L0081 = 0x0081 ;ASYNCHRONOUS PW 0081 L0082 = 0x0082 ;INJ PW LSB (ALDL) 0082 L0083 = 0x0083 ;O2 SENSOR READY TIMER
The "label" should match the location address or the disassembler was told incorrectly where to start. Small error that has to be taken into account mentally. Not important to you yet.
Next we are looking at the execution part of the hac file,
2.) the next item (if there) is a "Label" or NAME of that location in the file.
It is designated by L***:
The colon ends the name.
Usually this is assigned during disassembly by the disassembling program if that location was called by another line in the program. Not all lines have a label assigned.
This is a "hard" jump to point as it is named and will always be the point the program goes to when that "NAME:" is used.
3.) Next is the actual command at that line of programming, STA, BEQ, STR, etc.
Here you need to reference that "Pink Book" to understand exactly what that command does and what type of addressing it is using.
The actual "OP" Code of the command is sometimes shown in disassemblies also.
4.) there is then the value or address to be acted upon by the command.
The "*" was placed by the disassembler to inform that this is a "low" address location that is directly accessed for high speed "possibly"
One of the wonderful things you will discover while tracing OP Codes of similar commands with different addressing uses.
HTH
Jp
Last edited by JP86SS; 05-16-2016 at 11:56 AM.
#45
Member
Thread Starter
Re: New to source code editing
So for my program for flashing the check engine light the "adjustable" value for the threshold for knock counts can be put here: between these two some where (8EE5-8EEE) since that is an extra spot that isn't used? So it would look something like this now?
Code:
BPW BOOST MULT VS 2BAR MAP INDEX 8EE4 80 90 KPA 84 100 88 110 8C 120 90 130 98 140 98 150 98 160 FF 170 FF 180 FF 190 THESE TWO TABLES ARE USED FOR FAN ON/OFF VS INVERSE CTS2 8EEF 04 06 06 06 08 08
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b cmpb 8EE5 ;compare knock counts to knock threshold bhi LF613 ;branch if hi to LF613: bset *L0038,#0x01 ;turn on check engine light important locations L00A2- Knock count threshold L0038-check engine light output 8EE5-knock count threshold
#46
Senior Member
Re: New to source code editing
Ok so those are the actual locations, that really helps out. I wasn't really sure to begin with. So I guess where in the actual part of the code should I put the knock threshold value? It looks like the code is divided up into parts and I really don't know where It would work.
0000-00FF is battery backed static ram.
0100-1FF is non battery back static ram...
0000-00FF is battery backed static ram.
0100-1FF is non battery back static ram...
#47
Supreme Member
iTrader: (1)
Join Date: Apr 2004
Location: Browns Town
Posts: 3,178
Likes: 0
Received 3 Likes
on
3 Posts
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
Your ideas are good and you should keep pursuing them.
As far as your example goes, it will need more tweaking.
That address is taken, must find open one.
The other thing to look into...
Is there anywhere else in the program that turns the light OFF?
Can't have two places where an output is controlled.
Also, As knock count rises, the light will turn on (if all the new code works)
You will need some kind of decrementing counter or timer to turn the light back off after the knock counts stop increasing.
Knock counts up to 255 then resets to zero. It could stay at a value above the threshold until a reset is done.
Jp
As far as your example goes, it will need more tweaking.
Code:
BPW BOOST MULT VS 2BAR MAP INDEX 8EE4 80 90 KPA 84 100 ------ This is 8EE5, can't use that address 88 110 8C 120 90 130 98 140 98 150 98 160 FF 170 FF 180 FF 190
The other thing to look into...
Is there anywhere else in the program that turns the light OFF?
Can't have two places where an output is controlled.
Also, As knock count rises, the light will turn on (if all the new code works)
You will need some kind of decrementing counter or timer to turn the light back off after the knock counts stop increasing.
Knock counts up to 255 then resets to zero. It could stay at a value above the threshold until a reset is done.
Jp
#49
Member
Thread Starter
Re: New to source code editing
JP86SS, Thank you for that insightful post haha. That makes even more sense now, so one address can't have multiple values so it takes up multiple addresses kind of. Are the addresses starting at 9000 good to use since there are many spaces it looks to be available from 9000 to 9FF0?
Ok so you mean I need to make sure the light is off and if it isn't off turn it off and then turn in back on for however long the knock counts are above a certain threshold?
Here is what I now have for turning the light off and then jumping to turning it on.
Now I just don't really know how to do an decrementing counter.
Could I possibly make another line of code that if the knock counts is lower than the threshold it will turn the light off?
The other thing to look into...
Is there anywhere else in the program that turns the light OFF?
Can't have two places where an output is controlled.
Is there anywhere else in the program that turns the light OFF?
Can't have two places where an output is controlled.
Here is what I now have for turning the light off and then jumping to turning it on.
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b cmpb XXXX ;compare knock counts to knock threshold bhi LF60C ;branch if hi to LF60C: clrb jsr LF60D LF60D: bset *L0038,#0x01 ;turn on check engine light
Could I possibly make another line of code that if the knock counts is lower than the threshold it will turn the light off?
#50
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
Yes you can as long as you test the light for activity prior and hook it properly. I need to look into this myself soon.
Last edited by Vanilla Ice; 05-17-2016 at 03:42 PM.