RomRaider Logo

RomRaider

Open Source ECU Tools
 FAQ •  Register •  Login 

RomRaider

Documentation

Community

Developers

It is currently Sat Feb 21, 2026 5:27 pm

All times are UTC




Post new topic Reply to topic  [ 203 posts ]  Go to page 1, 2, 3, 4, 5 ... 14  Next
Author Message
 Post subject: 32bit Speed Density Patches
PostPosted: Sun Oct 02, 2011 1:22 am 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
Just completed the initial testing of my SD rom patch for A8DH200X / A8DH201X. :mrgreen:

I'll be posting a short how-to video on rom patching sometime this week when I get my screencap software set up.

This patch should be available this month, and I will do more roms if there is enough interest/donations.

Special thanks to Freon, Merchgod, jcsbanks, dschultz, sasha, Tiny, and NSFW.

Update 11/4/11: A8DH201X SD Rom and TinyPatcher file released
viewtopic.php?t=7772

Update 2/10/12: Map building spreadsheet released
viewtopic.php?f=32&t=8080

All donations greatly appreciated.


Source Code:
Code:
finish_maf:

sts.l   pr, @-r15         ! store return addy to stack
mov.l   (pull2d), r3      ! Finish maf routine
jsr   @r3                  ! Pull MAF g/s value from scaling
nop

mov.l   (rpm), r0         ! Move rpm addy -> r0

fmov   fr0, fr9         ! MAF g/s value -> fr9

mov.l   (dmap), r1         ! Move dmap addy -> r1

fmov.s   @r0, fr15         ! RPM Value -> fr15

mov.l   (map), r2         ! Move MAP addy -> r2

fmov.s   @r1, fr14         ! deltaMAP value -> fr14

mova   (engdisp), r0         ! Displacement addy -> r0

fmov.s    @r2, fr13      ! MAP value -> fr13

mov.l   (airtemp), r1         ! IAT addy -> r1

fmov.s   @r0, fr12         ! Displacement value -> fr12

mova   (c2k), r0         ! C2K addy -> r0

fmov.s   @r1, fr11         ! IAT value -> r11

fmov.s   @r0, fr10         ! C2K value -> fr10

mova   (const_sd), r0         ! SD Constant addy -> r0

fadd   fr10, fr11         ! IAT in KELVIN value -> fr11

fmov.s   @r0, fr10         ! SD Constant value -> fr10

fmul   fr13, fr12         ! map * eng displacement -> fr12

mov.w   (rawflow_out), r12      ! rawflow addy -> r8

fmul   fr15, fr12         ! (map * eng displacement) * rpm -> fr12

mova   (dyn_def),r0         ! Dynamics Map Definition addy -> r0

fmul   fr10, fr12         ! (map * eng displacement * rpm) * constant ->

mov.l   (pull2d), r3

mov      r0, r4

fdiv   fr11, fr12         ! raw airflow calc -> fr12

jsr    @r3            ! Pull Dynamics Map!!

fmov   fr14, fr4         ! DeltaMAP -> fr4 for lookup

mova   (ve_def), r0         ! VE Map LUT addy -> r4

fmov    fr0, fr11         ! Dynamics Map Compensation Result ->

mov      r0, r4

mov.l   (pull3d), r9         ! Pull3D Subroutine addy -> r9

fmov   fr13, fr4         ! MAP value -> fr4 for lookup

jsr   @r9            ! Pull VE Map!!

fmov   fr15, fr5         ! RPM -> fr5 for lookup

mov.w   (ve_out), r0         ! VE_out RAM addy -> r0 = 0xFFFFC400

fmov.s   fr12, @r12         ! store raw airflow @ FFFFC404

fmov.s   fr0, @r0         ! store VE @ FFFFC400

mov.w   (dmapcomp_out), r1      ! MAP_comp RAM addy -> r1 = 0xFFFF????

fmul   fr0, fr12         ! calculate in VE to final SD VE flow

fmov.s   fr11, @r1         ! Store MAP Comp @ 0xFFFF????

mov.w   (maf_out), r0         ! MAF_out RAM addy -> r0 = 0xFFFF????

fmov.s   fr9, @r0         ! Store MAF output @ 0xFFFF????


fmul   fr11, fr12         ! calculate in MAP dynamics map to sd flow

mov.w   (sd_out), r1         ! sd_out addy -> r1 = 0xFFFF????

mova   (switch), r0         ! Switch addy -> r0

fmov.s   fr12, @r1         ! store final SD calculated airflow

!Check output switch

mov.b    @r0, r2            ! Move Switch Value to r1

extu.b   r2, r0

cmp/eq   #1, r0         ! Check switch
bt/s   sd_output         ! IF TRUE, delayed branch to maf_output
nop


maf_output:

bra   end

fmov   fr9, fr0         ! Stores MAF value to output

sd_output:

fmov   fr12, fr0         ! Stores SD Flow to output

end:

lds.l   @r15+, pr
rts
nop


airtemp:
.long 0xFFFF5C9C      ! airtemp (should be manifold airtemp, but IAT will work for now)

map:
.long 0xFFFF6698      ! manifold absolute pressure, 32bit float, mmHG, unfiltered is 0xFFFF5CB4

pull3d:
.long 0x2150      ! pull3d subroutine location

engdisp:
.float 2.33         ! engine displacement (2.457 liters)
 
c2k:
.float 273.15      ! number to add to celsius to get kelvin (required for ideal gas law)

pull2d:
.long 0x209C      ! location of pull_2d subroutine

rpm:
.long 0xFFFF6A18   ! engine RPM, 32bit float

dmap:
.long 0xFFFF668C      ! delta MAP

ct:
.long 0xFFFF67C4      ! coolant temp, 32bit float, degrees celsius

ve_out:
.word 0x97A4      ! free memory spot to store ve (32bit float)

.align 2
switch:
.byte 0x00      ! free ROM space for output switch

.align 2
rawflow_out:
.word 0x97A8      ! free memory spot to store intermediate raw airflow (32bit float)

sd_out:
.word 0x97AC      ! free memory spot to store SD calculated airflow (32bit float)

maf_out:
.word 0x97B0      ! free memory spot to store MAF

dmapcomp_out:
.word 0x97B4      ! free memory spot to store current dmap comp

.align 2

const_sd:      
.float 0.003871098   ! constant needed to wrap up other conversion constants for Ideal Gas Law to ECU units of measure
         ! saves a lot of cycles, see spreadsheet for proof
         ! g/s = (Liter*mmHG*RPM / (Celsius+273) * k * VE
         ! then multiply by any other compensations desired



! ******************** MAPS BELOW ********************

ve_def:         ! volumetric efficiency map, manifold pressure col, rpm row
.word 13      ! 12 columns
.word 18      ! 18 rows
.long ve_col
.long ve_row
.long ve_data
.long 0x8000000      ! 16bit data
.float 4.57763672e-5   ! gradient for 16bit to float conv
         ! 1.5/32768  (0-1.50 range, 16bit precision)
.float 0      ! offset for 16bit to float conv (+ 0)

ve_col:
.float 165,285,385,500,625,725,875,1025,1250,1400,1600,1800,2000

ve_row:
.float 800,1200,1600,2000,2400,2800,3200,3600,4000,4400,4800,5200,5600,6000,6400,6800,7200,7600

ve_data:
.word 7150,7449,9958,10351,10665,10794,10943,11089,11177,11242,11307,11383,11383
.word 7398,7646,9694,10132,10499,10716,10956,11076,11190,11255,11320,11396,11396
.word 8081,8447,9658,10002,10486,10716,10813,10959,11207,11272,11346,11422,11422
.word 8456,8796,9659,10001,10497,10742,10853,10998,11229,11301,11385,11474,11474
.word 8627,8928,9659,10042,10499,10768,10917,11037,11281,11371,11474,11578,11578
.word 8749,9024,9676,10121,10512,10795,10995,11186,11468,11668,11864,12058,12058
.word 8854,9128,9793,10224,10537,10848,11152,11475,11805,12323,12580,12710,12710
.word 9073,9334,9946,10365,10653,10986,11398,11864,12388,12983,13176,13240,13240
.word 9383,9620,10233,10738,11191,11716,12322,12721,13043,13291,13410,13501,13501
.word 9576,9821,10422,10978,11481,11999,12439,12800,13095,13305,13410,13501,13501
.word 9538,9777,10396,10953,11441,11968,12369,12749,13008,13199,13305,13370,13370
.word 9488,9736,10316,10884,11359,11860,12261,12607,12875,13047,13099,13139,13139
.word 9428,9668,10238,10789,11265,11740,12115,12435,12677,12815,12854,12842,12842
.word 9374,9593,10152,10682,11157,11606,11956,12220,12414,12517,12531,12454,12454
.word 9308,9528,10061,10572,11022,11420,11733,11936,12090,12130,12080,11951,11951
.word 9242,9464,9972,10452,10853,11215,11477,11630,11706,11679,11564,11435,11435
.word 9166,9375,9856,10312,10653,10966,11149,11240,11227,11151,11035,10906,10906
.word 9078,9298,9741,10160,10461,10684,10814,10817,10752,10659,10530,10402,10402


dyn_def:         ! dynamics table (enrich/impoverish fuel on Delta MAP)
.word 7         ! 7 elements
.word 0x800      ! 16 bit data
.long dyn_col      
.long dyn_data      
.float 6.1037e-5   ! 2.00/32767  (0-2.00 range, 16bit precision)
.float 0      ! + 0

dyn_col:
.float -150,-60,20,0,20,60,150

dyn_data:
.word 11000,14000,16300,16384,16500,18000,20000

herp_derp:
.word 0xABCD,0xEFFF      !marks the end of code


You do not have the required permissions to view the files attached to this post.

_________________
Please do not send me support questions via PM, use the forum instead!


Last edited by Merp on Fri Feb 10, 2012 6:18 pm, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Sun Oct 02, 2011 11:29 am 
Offline
Moderator

Joined: Thu May 20, 2010 8:01 am
Posts: 3117
Location: Johannesburg, South Africa
Brilliant... Been thinking of going SD but not keen to go aftermarket ecu.

_________________
He who dies with the most gadgets wins.

Please do not PM me - use the email option.


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Mon Oct 03, 2011 12:01 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
Sweet! I'm looking forward to your how-to as I'm very interested in doing this for my LGT ROM (A2WC522N).

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Tue Oct 04, 2011 3:39 am 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
Video is up http://www.youtube.com/watch?v=eSrOQF6Hthc

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Tue Oct 04, 2011 9:28 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
Have you tried building your code in HEW? I think that should be possible, and if it is then I think I can remove some manual steps from the patching process.

Or, if you can just assemble one additional file (containing patch start/end addresses) and tell the linker to include that file and generate an s-record output file, then that should work as well. However if you can make your code work in HEW I think you might like the convenience of having the build tools integrated with the simulator. :)

Anyway, keep an eye on this thread, I hope to have a patching utility written in the next couple/few days:
viewtopic.php?f=25&t=7680

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Tue Oct 04, 2011 2:40 pm 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
It would certainly streamline the whole process. I'll have a crack at it sometime this week.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Fri Oct 14, 2011 7:28 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
Is this basically a direct port of Freon's SD patch to your ROM, or have you made other changes to it as well?

Can you describe where (in the stock ROM code) you inserted the jsr to his "finish_maf" routine?

I was just looking at his patch, and thinking about how to integrate this with the HEW project that I've been working on. I'm getting anxious to test my LC/FFS patch, and if that doesn't brick my ECU, this would be pretty cool to try next. :)

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Wed Oct 19, 2011 5:56 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
NSFW wrote:
Can you describe where (in the stock ROM code) you inserted the jsr to his "finish_maf" routine?


Nevermind, I watched the video again and saw the hook being placed in the pull2d for MAF scaling.

That would seem to require setting fr0 to the SD-calculated MAF value so that the code that called pull2d will store it for you... am I right?

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Wed Oct 19, 2011 5:51 pm 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
Bingo.

It's almost a direct port. I rewrote a couple things, implemented the dynamics table, added the ability to switch it on/off with a flash, and the ability to log the old maf g/s value.

I'm still fine tuning everything, and I may try to implement a MAF sliding table for hybrid MAF/SD.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Thu Oct 20, 2011 9:01 pm 
Offline
Newbie

Joined: Wed Oct 31, 2007 1:10 am
Posts: 33
Location: California
sweet...you have an 06 STi with a dom4....so i should be able to just use your final :)


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Thu Oct 20, 2011 9:28 pm 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
phatron wrote:
sweet...you have an 06 STi with a dom4....so i should be able to just use your final :)


I'm using the wrx ecu, but I have had the most requests for the 06sti so I will probably start work there after the wrx release.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Thu Oct 20, 2011 11:49 pm 
Offline
Experienced

Joined: Sun Jun 01, 2008 2:14 am
Posts: 125
Location: Quebec
+1 here for the 06 STI here :)


Merp wrote:
phatron wrote:
sweet...you have an 06 STi with a dom4....so i should be able to just use your final :)


I'm using the wrx ecu, but I have had the most requests for the 06sti so I will probably start work there after the wrx release.


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Fri Oct 21, 2011 12:21 am 
Offline
Experienced
User avatar

Joined: Thu Jul 23, 2009 5:46 pm
Posts: 863
I'll start digging into the 06sti rom tonight, and I'll send you guys a PM when I need some test logs and RAM dumps.

_________________
Please do not send me support questions via PM, use the forum instead!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Fri Oct 21, 2011 4:24 am 
Offline
Moderator

Joined: Thu Nov 23, 2006 2:23 am
Posts: 2565
Is A2ZJE11J the latest 06 STI ROM? If not, what is, and where can I get a copy?

If it is, I'll define the delta-load tables for it. I just don't want to have to do it twice. :) I have a hunch that those tables might be what cause the "rich during shifting" issues that Freon was trying to fix with that "dyn-def" table.

I can also add a couple of logger parameters that make tip-in easier to understand.

_________________
2005 Legacy GT w/ ATP 3076, IWG, MBC, BCS, BC 272, LC, FFS, OMG
Please don't send questions via PM. Post a thread and send me a link to it instead. Thanks!


Top
 Profile  
 
 Post subject: Re: 32bit Speed Density Patches
PostPosted: Fri Oct 21, 2011 11:48 am 
Offline
Experienced

Joined: Sun Jun 01, 2008 2:14 am
Posts: 125
Location: Quebec
NSFW,

I have never seem another ROM for the 06 STI and that is what I am kinda of running :)

Mart

NSFW wrote:
Is A2ZJE11J the latest 06 STI ROM? If not, what is, and where can I get a copy?

If it is, I'll define the delta-load tables for it. I just don't want to have to do it twice. :) I have a hunch that those tables might be what cause the "rich during shifting" issues that Freon was trying to fix with that "dyn-def" table.

I can also add a couple of logger parameters that make tip-in easier to understand.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 203 posts ]  Go to page 1, 2, 3, 4, 5 ... 14  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subsilver by phpBBservice.nl