Pages: 1 ... 5 6 [7] 8 9 ... 12
Author Topic: Multi map selection using cruz control  (Read 165640 times)
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #90 on: October 22, 2012, 09:33:09 PM »

A DIY is going to be time consuming. I am attaching the ASM file which I have developed which I use as the basic file for switching between boxes. This one is for 8D0907551f and switches 10 maps, I have written comments where you need to change for different boxes. You can search for matching codes in other box files using winols or idapro. Also attaching a similar file for 8D0907551c (with less maps switched as I had developed it earlier) , so you can see what changes have to be made.
Logged
automan001
Full Member
***

Karma: +47/-0
Offline Offline

Posts: 153


« Reply #91 on: October 23, 2012, 05:32:12 AM »

Reding of code could have been much easier if you had used simpler instructions, such as bclear and bset instead of moving the value from bit register into intermediate register, then and-ing/or-ing the value and only then moving value back into bit register. There are direct asm instructions.
For example when you flash the light:

Instead of
       mov  r4,B_mil
        jb   r4.2,resisset               ;<-------------------------------------------------------- change B_mil
        or   r4, #0010h
        mov  B_mil,r4

I would write
   jb   12H.4, resisset   ; check if b_mil is set, 12H is word address, byte address is 12H*2=24H, bit 4
   bset   12H.4      ; set b_mil

Another example
resisset:
   and  r4,#0ffefh                 ;<-------------------------------------------------------- change B_mil   
   mov  b_mil,r4

I would write as 1 instruction
   bclr 12H.4
Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #92 on: October 23, 2012, 05:41:59 AM »

Thanks I knew there was some instruction to set and clear bits , i was too lazy to lookup so did this instead  Grin.
Logged
automan001
Full Member
***

Karma: +47/-0
Offline Offline

Posts: 153


« Reply #93 on: October 23, 2012, 05:52:26 AM »

I've got another idea for improvement
Instead of code duplication for each new map, wouldn't it be better to just store array of offsets for each set of maps and then switch index of row within array and make  switching of the map within one function?
For example I would keep offsets of maps which need to be switched in multi-dimension array somewhere in free space. I would hard limit it for example to maximum 10 sets (to make things simpler, it would be enought for everybody) with maximum 3-5 different maps at once (for example LDRXN, LAMFA, KFZW, etc...). We could discus list of top maps which need to be switched, and fit them into matrix like 10x10:
set1: map11_offset, map12_offset, ..., map1N_offset
set2: map21_offset, map22_offset, ..., map2N_offset
setM: mapM1_offset, mapM2_offset, ..., mapMN_offset

When user presses switch map key/pedal combination you just rotate (increase/decrease) the index of current set within the matrix. Each intercepted map handler would read the index at first and then would take offset from respective cell. This might be easy configurable in WinOls or TunerPro.
Logged
littco
Hero Member
*****

Karma: +52/-7
Offline Offline

Posts: 903


« Reply #94 on: October 23, 2012, 11:17:29 AM »

I've successfully managed to transfer over your multi map onto my ecu's. at the moment just running the ldrxn map switching and all works well via cruise however I get 2 blips of the mil for each switch . Ie map 4 gives 8 blips and 5 gives 10. Any ideas? It's not an issue but would be nice to get 1:1.

Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #95 on: October 23, 2012, 11:34:33 AM »

somewhere in the code at two places there is  "shl    r4,#1H" replace it with nop or in the hex file replace it with cc 00 (hex code for nop).
« Last Edit: October 23, 2012, 02:11:41 PM by rajivc666 » Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #96 on: October 23, 2012, 11:44:38 AM »

 Automan it is a nice idea but I guess you should limit your no. of map sets to 3 or max 5 as above that it is not fun. If you can improve the code and do a DIY it would be nice.   
Logged
phila_dot
Hero Member
*****

Karma: +173/-11
Offline Offline

Posts: 1709


« Reply #97 on: October 23, 2012, 12:12:13 PM »

What assembler are you using?

Where are you linking in your function (not address, logically)?

Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #98 on: October 23, 2012, 12:17:21 PM »

What assembler are you using? ------------  Reads166   

Where are you linking in your function (not address, logically)?
I dont understand...


Logged
phila_dot
Hero Member
*****

Karma: +173/-11
Offline Offline

Posts: 1709


« Reply #99 on: October 23, 2012, 12:31:17 PM »



The comment in your code says calls from 0x87B31A and 0x87B362.

Why these locations? What leads to the call to your function?

Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #100 on: October 23, 2012, 01:19:05 PM »

Well you Will have to reWrite the Code at the add mentioned and plaCe a Call instruCtion there. Why these locations? beause in stock file these locations call the subroutine which looksup the respective stock maps.
Edit: So the custom code gets control instead and we can decide which map to lookup.
« Last Edit: October 23, 2012, 01:25:50 PM by rajivc666 » Logged
littco
Hero Member
*****

Karma: +52/-7
Offline Offline

Posts: 903


« Reply #101 on: October 23, 2012, 01:43:45 PM »

somewhere in the code at two places there is  "shl    r4,#1H" replace it with nop or in the hex file replace it with 00 cc (hex code for nop).

mmm ... can't find that "shl"....
I've attached the file that's currently running.. It's just running LDRXN and LDRXNZK on the Cruise set button to switch maps. Any clues please :-)

« Last Edit: October 23, 2012, 02:26:47 PM by littco » Logged
rajivc666
Full Member
***

Karma: +23/-2
Offline Offline

Posts: 127



« Reply #102 on: October 23, 2012, 02:10:12 PM »

change
0xfeaac and 0xfeb8a to "cc"
0xfeaad and 0xfeb8b to "00"

Logged
littco
Hero Member
*****

Karma: +52/-7
Offline Offline

Posts: 903


« Reply #103 on: October 23, 2012, 02:26:05 PM »

Thank you. I spent the best part of an hour looking for those! And couldn't see them for the life of me:-) but they where there!

Now done, will test and report back..

Logged
littco
Hero Member
*****

Karma: +52/-7
Offline Offline

Posts: 903


« Reply #104 on: October 24, 2012, 02:29:27 AM »

change
0xfeaac and 0xfeb8a to "cc"
0xfeaad and 0xfeb8b to "00"



That worked perfectly thank you.

Sorry to ask more questions.

When using the Brake/acclerator instead of cruise/clutch I replace the Brake FD address for the cruise FD address but I noticed that when it comes to the acclerator can I just replace the jnb 0xfd4eh.3(clutch), Exit1 with jnb (wped_w in my case 0x381C18) address, exit 1.

Logged
Pages: 1 ... 5 6 [7] 8 9 ... 12
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.022 seconds with 17 queries. (Pretty URLs adds 0s, 0q)