EEC V file conversion

All hardware related, disassembly / programming and code discussions belong here.
BOOSTEDEVERYTHING
Posts: 413
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 find it best to put the default name at the bottom of the range set.
Ok, I did try to do this in several places but it wasn't working for me. Maybe that is why. It was throwing off the naming in other subroutines as well, so I was having to define it at every address and that was a pain. I'll try it with the default name at the bottom and see if that works for me.
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.
Not at all. I can use all of the help I can get. LOL. I have issues seeing the index of things, I guess. I know there has to be a way for it to say I add this amount to this base address for cyl number #. I just do not see it anywhere in this code. Maybe once I find it, I will understand it better.

I noticed there are 2 tables for each of the following and one set is shorter than the other, are these just not named properly, or is this correct?

Code: Select all

uyTb2x1327A
uyTb1327A
uyTb1329
"uyTb1329A"

I have not found references to 2 of each of these in the strategy docs, but have come to realize the strategy docs are not always correct.
jsa
Posts: 419
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 »

BOOSTEDEVERYTHING wrote: 2024 Dec 03, 07:59 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 ????
Yes, comment out the SCA or get rid of them altogether, most likely redundant because of Sub commands.

BOOSTEDEVERYTHING wrote: 2024 Dec 03, 08:38 Here is a good example of when it calls for multiple flags...

Code: Select all

   Sxx970D3_RZAxxxxx_:
970ea: 71,e3,48           an2b  R48,e3           FGTMP0L &= e3;                   <--------------------------------- 

I assume it matches with this....
[code]
   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 */
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?
Get your calculator out and set it to programming mode.
Set it to enter a hex number.
Enter E3.
Set it to show the Bin number.
You should see; 11100011
Lets assume all flags are set 11111111

Code: Select all

 11111111
&11100011
=11100011
E3 is called a mask, it masks the bits to be left unchanged and the bits to be cleared.
1 & 1 gives a 1 result.
1 & 0 gives a 0 result.
0 & 1 gives a 0 result.
0 & 0 gives a 0 result.
https://en.wikipedia.org/wiki/Bitwise_operation

So E3 will clear bits 2, 3 & 4, leaving bits 0, 1, 5, 6 & 7 as they were.
All you know now is that those three flags are bits 2, 3 or 4 in no particular order, though you could make assumptions about the order for further investigation.

Code: Select all

970d4: b3,01,d4,0d,48     ldb   R48,[R0+dd4]     FGTMP0L = MIS_FLG_FG1;
So investigating further, search LST for other uses of DD4;

Code: Select all

   Sub_96f13:
96f13: f2                 pushp                  push(PSW);
96f14: 9b,ff,04,01,00     cmpb  R0,[Rfe+104]     
96f19: d7,0f              jne   96f2a            if (S.0x17342 = 0)  {
96f1b: b3,01,d4,0d,48     ldb   R48,[R0+dd4]     R48 = [10dd4];  <-----
96f20: 71,f7,48           an2b  R48,f7           B3_R48 = 0;     <-----
96f23: c7,01,d4,0d,48     stb   R48,[R0+dd4]     [10dd4] = R48;  <-----
96f28: 20,05              sjmp  96f2f            goto 96f2f; }
Now find that code in the strategy document and you will be able to name Bit 3.
You could add to CMT;

Code: Select all

96F20 # [B3_DD4] \sDD4:3
Bits 2 & 4 seem a little more elusive.
jsa
Posts: 419
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 »

BOOSTEDEVERYTHING wrote: 2024 Dec 03, 08:08 Another question, which may be a stupid question, so please excuse me if it is... What is this sub actually doing?

Code: Select all

   Sxx994BA_RZAxxxxx_:
It's writing 4 bytes out through the low speed serial out to a peripheral chip, waiting some time with shrw, then reading the 4 reply bytes from the low speed serial in. If two reply bytes don't match the sent bytes, loop until they do and save the other two bytes.

Once these are understood, you would have a better idea of what to name it.

Code: Select all

     # Call  from L9870B                                                           Sub_983ae
     # SCall from L9954D                                                           Sub_99504
     # SCall from L99581                                                           Sub_99504
     # SCall from L995B6                                                           Sub_99504
     # SCall from L995EB                                                           Sub_99504
     # SCall from L9964E                                                           Sub_99606
     # SCall from L996B9                                                           Sub99673
These are fixed in V5.08, >>=

Code: Select all

994ce: 08,05,00           shrw  R0,5             ZERO = 5;
994d1: 08,05,00           shrw  R0,5             ZERO = 5;

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;
jsa
Posts: 419
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 »

BOOSTEDEVERYTHING wrote: 2024 Dec 03, 08:20 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.
37.1.6 speaks to calculations done by AICE, which is a peripheral chip external to the 8065 so you wont see the code for AICE calculations in LST.

AICE may/not have code, it could be hard wired silicon, anyone know?

This part of Sub98DA2 looks like 37.1.6.1

Code: Select all

98dac: b0,cd,48           ldb   R48,Rcd          FGTMP0L = SYNC_CTR_0;
98daf: 7b,01,78,0e,48     sb2b  R48,[R0+e78]     FGTMP0L -= HDR_AICE_DLY;
These two 37.1.6.1 lines are possibly segments as I don't see calls.

Code: Select all

                                           hdr_accels_from_aice();
                                           hdr_normalize_accels();
A lot of parameters used in 98DA2 need to be identified to confirm it is 37.1.6.1.
BOOSTEDEVERYTHING
Posts: 413
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 »

A lot of parameters used in 98DA2 need to be identified to confirm it is 37.1.6.1.
Sorry, to clarify, I was using it mainly as a general example. Just meaning that the segments of code and subroutines in the Documents are identified as 37.1.6 is the actual subroutine, and the sections that follow in the documentation, 37.1.6.1, 37.1.6.2, etc.. , are segments that need to be entered into the CMT file instead of the DIR file?
jsa
Posts: 419
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 »

In general it depends on if they are part of a subroutine or there is a whole subroutine for each .#

If part of a sub make it a comment. If a whole sub is doing each .# then rename the sub.
tvrfan
Posts: 119
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 »

This may sound terrible too, but - are you comfortable with numbers/math ? Not everyone is, so forgive me if this is too basic.

Some number/math tricks explained, and 'number bases'.

Multiply - what's the fastest multiply you can do for any number ? Times 10. Why ? Because you just add a zero. Same for divide, you just drop off the lowest digit (for whole numbers) or move the decimal point. These operations are really SHIFT (UP/DOWN) in computer terms. For 'normal' divide and multiply, you have to go through longhand, digit by digit....and so does a computer....which is why it takes a long time to do. And it's not even floating point math, which is a big complex pile of sh*t (and s-l-o-w) for a computer to do.

Computers work in BINARY, because it's just (0 = off, 1 = on) so divides/multiplies by 2,4,8,16 are just like 10,100,1000 and so on, so you SHIFT, which is very fast. In math terms binary is called BASE 2, decimal is BASE 10. Hexadecimal (16, 4 bits) is just grouping binary into a size our brains can deal with more easily, some older computer tools used octal (8, 3 bits) instead.

So, if you are a software designer with a requirement to make things quick, what do you do ? You try to make everything work in BINARY scaling, because then most things can be done with shifts up or down, and they are fast, and you mostly do things as (scaled) whole integers. You stay away from floating point, as that's horrid, so you stick with whole numbers or you use a fixed point trick instead. Probably one of the nearest things to fixed point used in everyday life is a percentage - you know that 5% is 5/100. A computer example of fixed point is to have a word where the top byte is a whole number, and the lower byte is value/256. This can be carried along through word math operations without scaling, and then adjusted at the end (with a shift), if necessary. For statuses (like something on/off, or 'event happened' or 'calc required') you use single bit flags, as the 806x has fast 'shortcut' JB/JNB instructions, so most EEC code has lots of flags in it.

So - to get to the point, you may well see load, cyl no, and then a shift left of say, 3 which is times 8, for a cell size of 8. (Yes it might have a spare byte unused in each cell, but it's worth it to get fast multiplies.)

Nearly everything in the EEC is SCALED in some way, to make the calculations faster and easier to do. Sensors like temperature are read as 12800 = 5.12 Volts for example, and rpm is stored as rpm*4 in many EECs (i.e. resolution to 0.25 rpm, NB. a fixed point value).

Unfortunately this code is all merged in with single bit flag operations, timers (also scaled) and so on... after a while you get to spot patterns in the code...

Hope this helps everyone
tvrfan
Posts: 119
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 »

Tools for sqlite -

There is a database explorer tool for SQlite which allows examination of table structures, and modification of data, running SQL and so on.

search for "db browser for SQLite" on web.
wwhite
Posts: 367
Joined: 2021 Feb 16, 15:53
Location: Victoria, BC, Canada
Vehicle Information: 1994 Flarside, XLT, 351w E4OD
SD48b, Quarter Horse, Burn2

Re: EEC V file conversion

Unread post by wwhite »

I use TablePlus and DBeaver is a good one as well.
Most hosting providers use PHPMyAdmin if the database is only accessible to localhost.
wwhite
Posts: 367
Joined: 2021 Feb 16, 15:53
Location: Victoria, BC, Canada
Vehicle Information: 1994 Flarside, XLT, 351w E4OD
SD48b, Quarter Horse, Burn2

Re: EEC V file conversion

Unread post by wwhite »

jsa wrote: 2024 Nov 22, 19:22 I've been checking out postgreSQL because it supports xml, is open source and has tools an end user can use to directly manipulate the data.

Excel is basic, has the processing tools needed, but not the relational capability to tie various data sources together.


Wwhite, what do you think of those options for tying the files from the SAD, SADx, BE and TP along with other data that helps the user through disassembly and definition build?
I've been thinking of having an online database for this subject.

To me, the database engine(sqlite, postgresql, maridb, etc.) is a moot point.
sqlite is great for a non-shared database, can be accessed locally.

Online database everyone could access.

PostgreSQL would be overkill, sure it can handle XML, but also GEO data and as well as SOUNDS LIKE expressions for searching.

MySQL and MariaDB both open source can easily handle this type of data, and if required can easily(relative) be transferred to another DB.

For the past 15 years, my full time job, I take lovely Excel files (as well as fillable PDFs) convert to database and then build front end user interfaces for them. The advantage of having the database, is the data can then be reported on, converted/exported to different file types using the right tools.. Just need to know the right questions to ask the data.

It's super easy to me when the data is well defined in the spreadsheet.

It's a little tricky pulling abstractions out to create something meaning full for all the different tuning platforms and file types to be consistent across hardware strategies.

More than likely a lot of duplication at first, and then normalization later on, just regular database admin stuff.

It can be done. I can host the DB.
Post Reply