EEC V file conversion

All hardware related, disassembly / programming and code discussions belong here.
jsa
Posts: 437
Joined: 2021 Feb 16, 15:46
Location: Australia
Vehicle Information: 95 Escort RS Cosworth
2.0 YBP
CARD / QUIK / COSY / ANTI
GHAJ0
SMD-190 / SMD-490 EEC-IV

Binary Editor
ForDiag

Re: EEC V file conversion

Unread post by jsa »

F0 converted to bits is 1111 0000.
1111 1111 & 1111 0000 = 1111 0000
0000 0000 & 1111 0000 = 0000 0000
& is for clearing bits, in this case bits zero to three.

0000 0000 | 1111 0000 = 1111 0000
| is for setting bits, in this case bits four to seven.

SAD is for 8061 and 8065 processors, more modern processors are different, so they require a different disassebler. Ghidra is free. Winols is supposed to be payed for I think.

Yes the database is involved, hence no instant solution, it'll take time. A spreadsheet can be imported to a database easy enough.

Which SAD version gives those invalid bank errors?
The command over lap means you have another command within that address range.
jsa
Posts: 437
Joined: 2021 Feb 16, 15:46
Location: Australia
Vehicle Information: 95 Escort RS Cosworth
2.0 YBP
CARD / QUIK / COSY / ANTI
GHAJ0
SMD-190 / SMD-490 EEC-IV

Binary Editor
ForDiag

Re: EEC V file conversion

Unread post by jsa »

tvrfan wrote: 2024 Nov 27, 13:40
Databases (etc.)
It's not a standalone database as such, more of a library, but does come with lots of tools where you can examine structure and contents of its databases. Also tools to help with actually making the database itself.

What tools do you suggest?



I think a difficult issue is how to actually combine/merge the data itself, as SAD is primarily focused on disassembly of code, but BE and TP are primarily focused on tuning and modification, and so on.

I think the common link is the PID name or SYMbol name, though with aliases in some cases.
Then at more detailed levels, as you say, things like naming, strategies, even ordinary comments will also have to follow agreed rules, but still remain useful for everyone. Not easy, can be surprisingly tricky to do.
Yeah, inconsistent source data is the first hurdle.
BOOSTEDEVERYTHING
Posts: 427
Joined: 2023 Sep 06, 13:11
Location: Charlotte NC , USA
Vehicle Information: 1999 Ford Ranger with 2000 Explorer v8 swap, FLN0
2003 Ford F150 Harley Davidson, Built 5.4L SOHC with 3.4L Whipple and Built 4R100

Re: EEC V file conversion

Unread post by BOOSTEDEVERYTHING »

Which SAD version gives those invalid bank errors?
The command over lap means you have another command within that address range.
I found the overlap and commented it out. I had commanded a range for word values to try and figure some things out and never deleted it.
SAD v 4.07.16b is the version I have been using lately.
jsa
Posts: 437
Joined: 2021 Feb 16, 15:46
Location: Australia
Vehicle Information: 95 Escort RS Cosworth
2.0 YBP
CARD / QUIK / COSY / ANTI
GHAJ0
SMD-190 / SMD-490 EEC-IV

Binary Editor
ForDiag

Re: EEC V file conversion

Unread post by jsa »

Yeah, same here for 16B, something that got fixed for 4.012.

If you wish to keep using 16B without the error change it to WOR or STR commands and drop the bank option if need be.

I look forward to the day where we have a V5 that supersedes both those.
BOOSTEDEVERYTHING
Posts: 427
Joined: 2023 Sep 06, 13:11
Location: Charlotte NC , USA
Vehicle Information: 1999 Ford Ranger with 2000 Explorer v8 swap, FLN0
2003 Ford F150 Harley Davidson, Built 5.4L SOHC with 3.4L Whipple and Built 4R100

Re: EEC V file conversion

Unread post by BOOSTEDEVERYTHING »

F0 converted to bits is 1111 0000.
1111 1111 & 1111 0000 = 1111 0000
0000 0000 & 1111 0000 = 0000 0000
& is for clearing bits, in this case bits zero to three.

0000 0000 | 1111 0000 = 1111 0000
| is for setting bits, in this case bits four to seven.
Yep....Way over my head!!! LOL. Maybe I asked the wrong question though. I will look for another example of what I am asking about. It is mainly about what flags the code is referring to when it calls multiple from a byte sized flag address. I will see if I can find a better example.

Also, I will switch back to SAD V 4.012. I was using 16B because it named the arguments correctly. Maybe I will move back and forth if I need to when I encounter an argument.
When using v4.012 I get a ton of errors for duplicate commands. Is this due to one of the vector commands? Should I just comment these out for "resolved with vector commands" as the reason ????

Code: Select all

SCA 057A7 << Warning - Duplicate Command Ignored

SCA 0B33A << Warning - Duplicate Command Ignored

SCA 0B344 << Warning - Duplicate Command Ignored

SCA 0B34E << Warning - Duplicate Command Ignored

SCA 0B430 << Warning - Duplicate Command Ignored

SCA 0B482 << Warning - Duplicate Command Ignored

SCA 0B6D8 << Warning - Duplicate Command Ignored

SCA 0B6DF << Warning - Duplicate Command Ignored

SCA 0B6EA << Warning - Duplicate Command Ignored

SCA 0B6EE << Warning - Duplicate Command Ignored

SCA 0B6F2 << Warning - Duplicate Command Ignored

SCA 0B6F6 << Warning - Duplicate Command Ignored

SCA 0B6FA << Warning - Duplicate Command Ignored

SCA 825DD << Warning - Duplicate Command Ignored

SCA 825FE << Warning - Duplicate Command Ignored

SCA 8260E << Warning - Duplicate Command Ignored

SCA 82628 << Warning - Duplicate Command Ignored

SCA 82630 << Warning - Duplicate Command Ignored

SCA 8263C << Warning - Duplicate Command Ignored

SCA 82644 << Warning - Duplicate Command Ignored

SCA 8F8F1 << Warning - Duplicate Command Ignored

SCA 8F8F7 << Warning - Duplicate Command Ignored

SCA 8FA05 << Warning - Duplicate Command Ignored

SCA 8FA0B << Warning - Duplicate Command Ignored

SCA 8FA17 << Warning - Duplicate Command Ignored

SCA 8FA23 << Warning - Duplicate Command Ignored
BOOSTEDEVERYTHING
Posts: 427
Joined: 2023 Sep 06, 13:11
Location: Charlotte NC , USA
Vehicle Information: 1999 Ford Ranger with 2000 Explorer v8 swap, FLN0
2003 Ford F150 Harley Davidson, Built 5.4L SOHC with 3.4L Whipple and Built 4R100

Re: EEC V file conversion

Unread post by BOOSTEDEVERYTHING »

I wish there was an easy way to get it to populate the flag labels in the temp registers correctly. That would make things much easier as well. I am sure that would be a major pain to implement though. Also, is there a way to tell what number the code would add to a word value for a cylinder location or bank? Like, when it says to add 3 words and one is a cylinder or bank number, how would I actually do that to find the actual location of the table or function it would be pointing out for each bank, cyl, gear, etc???


Another question, which may be a stupid question, so please excuse me if it is... What is this sub actually doing? I am still a bit confused on some of the names and subroutines that are not in the strategy documents.

Code: Select all

   Sxx994BA_RZAxxxxx_:
994ba: f2                 pushp                  push(PSW);
994bb: fa                 di                     interrupts OFF;
994bc: b0,34,35           ldb   R35,R34          TMP1H = TMP1L;
994bf: 91,80,35           orb   R35,80           B7_TMP1H = 1;
994c2: c4,15,35           stb   R35,R15          LSSO_A = TMP1H;
994c5: c4,1d,38           stb   R38,R1d          LSSO_D = TMP3L;
994c8: c4,19,37           stb   R37,R19          LSSO_C = TMP2H;
994cb: c4,17,36           stb   R36,R17          LSSO_B = TMP2L;
994ce: 08,05,00           shrw  R0,5             ZERO = 5;
994d1: 08,05,00           shrw  R0,5             ZERO = 5;
994d4: 95,80,35           xorb  R35,80           B7_TMP1H ^= 1;
994d7: c4,15,35           stb   R35,R15          LSSO_A = TMP1H;
994da: 08,09,00           shrw  R0,9             ZERO = 9;
994dd: 08,09,00           shrw  R0,9             ZERO = 9;
994e0: 08,0d,00           shrw  R0,d             ZERO = d;
994e3: 08,0d,00           shrw  R0,d             ZERO = d;
994e6: b0,15,40           ldb   R40,R15          TMP7L = LSI_EXP_A;
994e9: 71,7f,40           an2b  R40,7f           B7_TMP7L = 0;
994ec: 98,34,40           cmpb  R40,R34          
994ef: d7,cb              jne   994bc            if (TMP7L != TMP1L) goto 994bc;
994f1: b0,1d,41           ldb   R41,R1d          TMP7H = LSI_EXP_D;
994f4: 71,7f,41           an2b  R41,7f           B7_TMP7H = 0;
994f7: 98,38,41           cmpb  R41,R38          
994fa: d7,c0              jne   994bc            if (TMP7H != TMP3L) goto 994bc;
994fc: b0,19,3f           ldb   R3f,R19          TMP6H = LSI_EXP_C;
994ff: b0,17,3e           ldb   R3e,R17          TMP6L = LSI_EXP_B;
99502: f3                 popp                   PSW = pop();
99503: f0                 ret                    return;
BOOSTEDEVERYTHING
Posts: 427
Joined: 2023 Sep 06, 13:11
Location: Charlotte NC , USA
Vehicle Information: 1999 Ford Ranger with 2000 Explorer v8 swap, FLN0
2003 Ford F150 Harley Davidson, Built 5.4L SOHC with 3.4L Whipple and Built 4R100

Re: EEC V file conversion

Unread post by BOOSTEDEVERYTHING »

To clarify subroutine naming, Is the below the actual subroutine?

Code: Select all

37.1.6  HIGH DATA RATE MISFIRE DETECTION (CRAI0)
Or is it this?

Code: Select all

 37.1.6.1  Hdr_misfire_foreground_main
If it is the first one, The second is the code segment that should be called out in the cmt file, correct?

To clarify, the above, I would suspect, Go to Sxx98DA2 in CRAI8.
BOOSTEDEVERYTHING
Posts: 427
Joined: 2023 Sep 06, 13:11
Location: Charlotte NC , USA
Vehicle Information: 1999 Ford Ranger with 2000 Explorer v8 swap, FLN0
2003 Ford F150 Harley Davidson, Built 5.4L SOHC with 3.4L Whipple and Built 4R100

Re: EEC V file conversion

Unread post by BOOSTEDEVERYTHING »

Here is a good example of when it calls for multiple flags...

Code: Select all

   Sxx970D3_RZAxxxxx_:
970d3: f2                 pushp                  push(PSW);
970d4: b3,01,d4,0d,48     ldb   R48,[R0+dd4]     FGTMP0L = MIS_FLG_FG1;
970d9: b3,01,c2,0d,4c     ldb   R4c,[R0+dc2]     FGTMP2L = [10dc2];
970de: a3,01,c0,0d,4a     ldw   R4a,[R0+dc0]     FGTMP1L = [10dc0];
970e3: 9b,ff,05,01,00     cmpb  R0,[Rfe+105]     
970e8: d7,05              jne   970ef            if (S.0x17343 = ZERO)  {
970ea: 71,e3,48           an2b  R48,e3           FGTMP0L &= e3;                   <--------------------------------- 
970ed: 20,51              sjmp  97140            goto 97140; }

970ef: 3a,48,0e           jb    B2,R48,97100     if (B2_FGTMP0L = 0)  {
970f2: 9b,ff,06,01,cd     cmpb  Rcd,[Rfe+106]    
970f7: d7,56              jne   9714f            if (SYNC_CTR_0 != S.0x17344) goto 9714f;
970f9: 91,04,48           orb   R48,4            B2_FGTMP0L = 1;
970fc: 11,4c              clrb  R4c              FGTMP2L = 0;
970fe: 01,4a              clrw  R4a              FGTMP1L = 0; }
I assume it matches with this....

Code: Select all

 37.1.12.1  Mis_generator_box

   void mis_generator_box(void)

   BEGIN_FUNC                              /* BEGIN:  mis_generator_box */
   U32 num_tmp;
   U32 sync_tmp;


   IF (MGB_KILL_SW == 0)                           /* not inducing misfire */
   THEN
                                           mgb_kill_flg = 0;
                                           mgb_sync_flg = 0;
                                           mgb_det_flg = 0;
                                           return;                 /* skip this process */
   END_IF


   IF (   (mgb_sync_flg == 0)
      AND (sync_ctr_0 == MGB_CYL) )
   THEN
                                           mgb_sync_flg = 1;       /* start inducing misfires */
                                           mgb_kill_cnt = 0;       /* reset misfire rate counter */
                                           mgb_dly_cnt = 0;
                                           mgb_det_cnt = 0;
   ELSE_IF (mgb_sync_flg == 0)
How would I tell which flag number (bit number?, maybe I am not using the correct term) it is referring to so I can define them in my DIR file?
tvrfan
Posts: 130
Joined: 2023 Oct 22, 22:13
Location: New Zealand
Vehicle Information: Several Kit cars, Ford (Europe), EEC-IV, TVR Vixen, Tasmin (a.k.a Wedge),
Engine - Cologne 2.8 V6 (Europe) catch code 'AA'.

EEC_Disassembler https://github.com/tvrfan/EEC-IV-disassembler

Re: EEC V file conversion

Unread post by tvrfan »

SAD is an ongoing project, and so bugs do happen. I did have a bug with bank numbers at one point, but I thought it was fixed in latest stable version (in Github). I'm currently trying to sort out a new version (V5), which was a nice, elegant, simple design and new, better commands....and released in development branch....but it doesn't work right, so a redesign in progress.

Temp registers and names.
Although it's not very neat to do , you can set a limit on symbol names with address ranges, so that say R30 has a name only within a defined subroutine, and has a different name in another subroutine. I designed it to be 'nested' so that you can have a 'default' name which is overridden in a certain address range. It got 'nailed on' from original design, and I couldn't think of a better way at the time
e.g.

sym 30 "default_name"
sym 30 2234 2256 “Calc_result”
sym 30 2279 2303 "Fuel_charge"

so outside of the address ranges given R30 will be 'default_name' and R30 in the given address ranges will have the specified names.

I tend to not bother naming temps, but that approach doesn't suit everyone (fair enough..)

You were asking is how to get to something via cylinder number, which links to how lookup data is organized.

Data indexing - 'data structures' are a foundation of coding. There are all sorts of different types of data structures used for a huge range of things things in all programs. They can be linked together (or not) and ordered in lots of different ways. There's some VERY clever designs out there.

For EEC, AA has examples of lists (values and pointers), tables (2 dimension structure, X and Y), functions (1 dimension), and so on.

When there is a data structure, you need to 'index' it by something, e.g cyl no. There are several ways to do this in code. Imagine the idea that there is a list of 'cells' where each cell is an identical layout collection of the same things, so to get to say cell 3 , code has to add (3 * cell_size) to the beginning (address) of structure. Once you get this idea, you will see it all over the code. In EEC code this is typically done by POINTERS, where a value in a register is saying effectively "this data starts right THERE" and then you add an index to it to get to the actual entry you want.

This is one of the basics to understanding how computer code works...

Note - If that sounds condescending, sorry, just trying to help that you need to be able to 'get' how low level code works for this kind of stuff. Mostly it's NOT complex, once you understand the 'pointer+index' idea it applies everywhere in all sort of programs. I haven't seen anything really complex data-wise in EEC probably because it can be slow, which is not what you want for an engine. Ford stayed away from complex math for the same reason, multiplies and divides take *FOREVER* in computer time... but there are many 'tricks' to do approximate calculations quickly.

I am qualified to say this as a retired IT guy of 30+ years, done custom programming/databases/etc, but I've never done a web server front end !
jsa
Posts: 437
Joined: 2021 Feb 16, 15:46
Location: Australia
Vehicle Information: 95 Escort RS Cosworth
2.0 YBP
CARD / QUIK / COSY / ANTI
GHAJ0
SMD-190 / SMD-490 EEC-IV

Binary Editor
ForDiag

Re: EEC V file conversion

Unread post by jsa »

I find it best to put the default name at the bottom of the range set.

Code: Select all

sym 30  2234 2256  “Calc_result”
sym 30  2279 2303  "Fuel_charge"
sym 30  "default_name"   
Post Reply