EEC V file conversion

All hardware related, disassembly / programming and code discussions belong here.
tvrfan
Posts: 88
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 »

[Rec+c8] answer

Ford use certain registers as 'base' pointers. These point to a RAM or ROM address and then are used as [Register+offset]. SAD can detect these and automatically converts this to a fixed address (to look for a symbol name). There will be code somewhere that sets these up. SAD calls these RBASE registers, and there is an RBASE command to set these manually.

It seems that Ford did this to allow for new calibrations. Code-wise, it means Ford engineers can change the value of that register to point to a different data block without affecting anything else. Most bins have their data calibration setup this way. Single bank bins often use Rf0-Rfe, multibanks vary a lot more.

A9L version -

Code: Select all

2020: 08                  byte      8                             # 8 registers to set
2021: 01                  byte      1                             # 1 set to do
2022: 00,8c               word   8c00
2024: 5a,8e               word   8e5a
2026: d6,8f               word   8fd6
2028: a8,93               word   93a8
202a: 30,94               word   9430
202c: a8,97               word   97a8
202e: 7e,9a               word   9a7e
2030: 5a,9e               word   9e5a

84f5: a1,f0,00,18         ldw   R18,f0           R18 = f0;                               #start with register f0 
84f9: b3,01,20,20,1a      ldb   R1a,[R0+2020]    R1a = [2020];
84fe: a2,15,1c            ldw   R1c,[R14++]      R1c = [R14++];
8501: c2,19,1c            stw   R1c,[R18++]      [R18++] = R1c;
8504: e0,1a,f7            djnz  R1a,84fe         R1a--;
                                                 if (R1a != 0) goto 84fe;
but sometimes it's just set directly.............A9L RAM pointers are here

Code: Select all

2058: a1,80,01,72         ldw   R72,180          R72 = 180;
205c: a1,7e,02,74         ldw   R74,27e          R74 = 27e;
2060: a1,7a,03,76         ldw   R76,37a          R76 = 37a;
tvrfan
Posts: 88
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 »

More - I downloaded your eqe3 bin to have a look, and SAD 4.0.7.16
if you look in <eqe3...> _msg.txt file, you should see a list of RBASE commands. these are detected automatically by SAD

rbase d8 10480
rbase da 10680
rbase dc 10880
rbase de 10980
rbase e0 10a80
rbase e2 11080
rbase e4 11180
rbase e6 11280
rbase e8 11380
rbase ea 11480
rbase ec 11580
rbase ee 11680
rbase f0 12060
rbase f2 12310
rbase f4 1258a
rbase f6 13678
rbase f8 13ee0
rbase fa 148ba
rbase fc 14dea
rbase fe 1627a

so these are all used as 'fixed' pointers to data in Bank 1.

there is a block of register data at 82060 and the setup is at 8de4d, and that looks just like A9L , and the others are set directly at 823ca
BOOSTEDEVERYTHING
Posts: 235
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 what i have added so far while "busy" at work today. lol, I hope they are correct. I need to figure out how to separate by bank in the dir file still. Also need to look at adding cmt entries still. The 2 entries I have commented out produced an error when I added them in the msg file so I commented them out for now. I am sure I made a mistake somehow with the entry. I will look into the windows calculator for that, Thank you.

Code: Select all

# 20231016 Directive for use with SAD V4.012



# -----------Scalars Functions Tables Payloads ----------

SYM   180 "TP"	          		  #UW
SYM   182 "RATCH"			  #UW
SYM   184 "TP_REL"			  #UW

SYM   19C "iAICE_Ch8"                     # W
SYM   19E "iADC_Ch8"                      # W

SYM   1A0 "iADC_Ch9"                      # W
SYM   1A2 "iADC_ChF"                      # W
SYM   1A4 "iADC_Ch7"                      # W
SYM   1A6 "iADC_Ch2"                      # W
SYM   1A8 "iAICE_Ch2"                     # W
SYM   1AC "iAICE_Ch4"                     # W

SYM   1B0 "iAICE_Ch3"                     # W
SYM   1B4 "iAICE_Ch5"                     # W

SYM   1C0 "iADC_Ch0"                      # W
SYM   1C2 "iADC_Ch1"                      # W
SYM   1C4 "iAICE_ChF"                     # W
SYM   1C6 "iAICE_Ch11"                    # W

SYM   1CC "iMAF"                          # W
SYM   1CE "iADC_Ch6"                      # W

SYM   1D2 "iADC_ChC"                      # W
SYM   1D4 "iADC_Ch5"                      # W
SYM   1D6 "TP_CNT1"                       #UW # Throttle position counts 1
SYM   1D8 "TP_CNT2"                       #UW # Throttle position counts 2
SYM   1DA "TP_CNT3"                       #UW # Throttle position counts 3
SYM   1DC "TP_CNT4"                       #UW # Throttle position counts 4
SYM   1DE "TP_ENG"                        #UW # Average throttle position

SYM   1ea "LOAD"                          #UW

SYM   E1C "iADC_ChA"                      # W

#SYM   Rca "FLAGTEMP_BG"                   #UY
#SYM   R9a "CRKFLG"                        :B7


SYM   108de "RATKAM"                      #UW

SYM   10920 "P1120STATE"                  #UY
SYM   10922 "P0122STATE"                  #UY
SYM   10924 "P0123STATE"                  #UY

SYM   1112e "J1979_01_11"                 #UY

SYM   1154a  "P1120_FIL"                   #UY
SYM   1154b  "P0122_FIL"                   #UY
SYM   1154c  "P0123_FIL"                   #UY
SYM   1154d  "P0121_FIL"                   #UY

SYM   1154E "TPBAR_MT"                    #UW

SYM   11550 "RATCH_REP"                   #UW

SYM   11226 "iAICE_Ch9"                   # W

SYM   11362 "MAF"                         # W

SYM   11548 "TP_ENG_LAST"                 #UW # Previous average throttle position

SYM   11552 "TP_DIF_CTR"                  #UY

SYM   120a6 "RATIV"

SYM   120a8 "RATCH_MIN"                   #W

SYM   R1ea  "LOAD"                        #UW

SYM   1636e "ALT_PPM"                   #SW

FUN 12254 122CB "uuwFn036_MAF_Transfer" :W V 13107 :W V +1 P +5      # Mass Air Flow meter transfer function. CDAN 24-6
BOOSTEDEVERYTHING
Posts: 235
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 »

SO... On the [Rec+c8] question, Do I need to look up that register in the msg file to get the number in it and then add the offset, or do I add the ec+c8 when trying to find the address? And is the number in the msg file in hex or is it dec? I guess i am asking if I need to convert it to hex and then add the offset? Just a bit confused I guess. That may be why the calculators I have downloaded "aren't working" for me. I have been adding the "ec+c8" on all of them I am finding and not ending up with the results I am expecting. Thanks
Here is an example:
ldw R32,[Rd4+20] R32 = RATCH_REP
in msg file I have this
sym 3a0 "RATCH_REP"
in dir file I have this
SYM 03A0 "RATCH_REP" #UW
So, I get that the dir file is defining the location 03a0 as "ratch_rep" and msg file reflets it and so does the list file. I just dont understand how to get to the 03a0 from [Rd4+20].
also there is no RBase d4 in the msg file for RZASA. Well, in the msg file when not using a dir file anyways. So how do I come up with something usable on these types of examples? Thanks
BOOSTEDEVERYTHING
Posts: 235
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 am slightly confused on the HEGO_DATA_BFR areas here. In the EQE3 lst file there are different addresses (?) for the areas where they are the same in the RZASA lst file. I am assuming that they arent the same and probably not HEGO_DATA_BFR in EQE3?
Attachments
Annotation 2023-10-26 121617.png
decipha
Posts: 5052
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: EEC V file conversion

Unread post by decipha »

Thats not for the hego its a scalar. Those are obviously the time constant scalars for tp just SAD is assigning the value as an address.

Anytime you have a word assigned as a strict value you don't know if its a value or if it will be used for a lookup later.

TVRFAN- if you can have SAD reference the CMT file to see if that line is assigned a scalar name that would be significantly helpful.
BOOSTEDEVERYTHING
Posts: 235
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 »

Sorry, I am still slightly confused about this, are you saying that the RZASA lst file is not correct or it does not compare to the EQE3 file properly and I am not on the correct path at all? I'm sorry if these questions seem simple. You guys are very smart about this stuff and I really appreciate all of the help you are giving me.
I dont have a cmt file for the RZASA bin, just the dir file that jsa posted for me to use for comparison. Is SAD not correctly assigning the 400 value in the RZASA file as HEGO_DATA_BFR?
BOOSTEDEVERYTHING
Posts: 235
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 »

In the CRAI8 docs the TP_CNT strat starts on page 8-2, in the CDAN2 docs it is page 31-90. Also, if I am reading correctly, TTP_CNT is the actual input from the sensor and TP_ENG is the value that the pcm stores, but they are exactly the same value just named differently to separate a recorded value from an input value?
tvrfan
Posts: 88
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 »

Right.... [Rec+c8] question......using eqe3 listing
using THIS line as an example

Code: Select all

847d8: c3,ec,c8,2c        stw   R2c,[Rec+c8]     [11548] = R2c;
This is what's called an INDEXED ADDRESS.
because the second byte (847d9) is even, this is a BYTE offset. (see below for word example)
Note maths are all in HEX....

An important point to note is that byte offsets are SIGNED, so 'c8' is NEGATIVE (top bit set). In effect this is -0x38.
This takes the value of Rec (=1580) and adds 0xc8, but it's negative so 1580-38 = 1548.
As the 8061 and 8065 are still 16 bit CPUs, the bank doesn't change so it becomes 11548.

WORD OFFSET
if the second byte is odd, then this is a WORD offset and opcode would be one byte longer. here is an example (odd bit is dropped to get register)

Code: Select all

84953: 9b,ff,f7,00,44     cmpb  R44,[Rfe+f7]     
84958: db,02              jc    8495c            if (R44 < [16371])  {
This takes the value in Rfe (=627a) and adds 0x00f7. word offsets are UNSIGNED, which is why this is one is not done as a byte offset
so 627a+f7 = 6371 and in Bank 1 so 116371.

Hope that explains....
tvrfan
Posts: 88
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 »

decipha wrote: 2023 Oct 26, 16:13 Thats not for the hego its a scalar. Those are obviously the time constant scalars for tp just SAD is assigning the value as an address.

Anytime you have a word assigned as a strict value you don't know if its a value or if it will be used for a lookup later.

TVRFAN- if you can have SAD reference the CMT file to see if that line is assigned a scalar name that would be significantly helpful.
Decipha - Can I have a bit more detail on that please ? At the moment, a comment line has no knowledge of the code, and symbol names too are linked only to an address. jsa and I have discussed the idea of having more information in symbols, e.g. size or possible 'type', same with comments, but I wasn't sure how to do it/ what users would want..

Of course you can't tell directly for the code how any value is being used. I did have the idea that a register could have a temporary 'type' (e.g. when SAD knows data was read from an A/D input and stored in Rx, then Rx is a voltage, if Rx compared to IO_time then it's a time period, ) but it quickly gets mangled, so I don't think that will work.

An immediate value can of course be anything, scalar, time period, bit mask .... (as you said)

Any ideas/examples ??
Post Reply