EEC V file conversion

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

Tracking the ++ increments between pop and push gives the maximum possible args, but that jnb B7_Arg1 is a PITA.

Another type of encoded arg, arg1 top bit set...get another arg.

How to define the encoding as an option??

Is best dealt with as another signature case?

Otherwise plan F, fuzzy logic...are !inv! generated...are there jumps to operands...yes-must be a different arg count.
tvrfan
Posts: 84
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 »

Generally, but I reckon there's an exception to everything. Tracking increments on 'popped' registers DOES work, mostly, but then there's always something that screws it up, requiring extra check(s) to be done .... e.g. this little snippet (xdt2)

Code: Select all

84861: 9b,f6,29,46        cmpb  R46,[Rf6+29]     
84865: d3,02              jnc   84869            if (R46 >= [1333f]) {
84867: 20,d3              sjmp  8493c            goto 8493c; }
.....
(code with increments is in here somewhere)
....
8493c: a3,20,02,46        ldw   R46,[R20+2]      R46 = [StackPtr+2];
84940: 65,07,00,46        ad2w  R46,7            R46 += 7;                     # skip over the arguments
84944: c3,20,02,46        stw   R46,[R20+2]      [StackPtr+2] = R46; }
84948: f3                 popp                   PSW = pop();
84949: f0                 ret                    return;
So it's like every logic idea works for some bins, but not all, and then there's special cases everywhere....

(Hey - I hope for readers of this thread that it's useful for learning how the code works and stuff. That's always my intention. )
tvrfan
Posts: 84
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 »

I thought the EEC handbook was already in OpenEEC, but It wasn't there - have added it. It's a series of jpegs as scanned so it's big (18 megs) but it's really useful as a quick reference. I often have at least one of its pages on display...
jsa
Posts: 231
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: 2023 Dec 04, 22:17 Generally, but I reckon there's an exception to everything. Tracking increments on 'popped' registers DOES work, mostly, but then there's always something that screws it up, requiring extra check(s) to be done .... e.g. this little snippet (xdt2)

Code: Select all

(code with increments is in here somewhere)
So it's like every logic idea works for some bins, but not all, and then there's special cases everywhere....

(Hey - I hope for readers of this thread that it's useful for learning how the code works and stuff. That's always my intention. )
The bit in the middle

Code: Select all

84867: 20,d3              sjmp  8493c            goto 8493c; }


     # JNC   from L84865                                                           Sub_8484c
84869: b3,e2,c3,46        ldb   R46,[Re2+c3]     R46 = [11043];
8486d: 99,02,46           cmpb  R46,2            
84870: df,02              je    84874            if (R46 != 2)  {
84872: 20,c8              sjmp  8493c            goto 8493c; }

     # JE    from L84870                                                           Sub_8484c
84874: 2b,89              scall 84bff            Sub_84bff ();
84876: a2,20,30           ldw   R30,[R20]        R30 = [STACK];
84879: fa                 di                     interrupts OFF;
8487a: 18,02,31           shrb  R31,2            R31 >>= 2;
8487d: c4,11,31           stb   R31,R11          ROM_Bnk_Ctl = R31;
84880: a3,20,02,26        ldw   R26,[R20+2]      R26 = [STACK+2];
84884: b2,27,36           ldb   R36,[R26++]      R36 = [R26++];
84887: b2,27,37           ldb   R37,[R26++]      R37 = [R26++];
8488a: b2,27,38           ldb   R38,[R26++]      R38 = [R26++];
8488d: b2,27,39           ldb   R39,[R26++]      R39 = [R26++];
84890: b2,27,3a           ldb   R3a,[R26++]      R3a = [R26++];
84893: b2,27,3b           ldb   R3b,[R26++]      R3b = [R26++];
84896: ae,27,40           ldzbw R40,[R26++]      wR40 = [R26++];
Two conditions to jump arg loading.

Code: Select all

     # SJump from L84867                                                           Sub_8484c
     # SJump from L84872                                                           Sub_8484c
8493c: a3,20,02,46        ldw   R46,[R20+2]      R46 = [STACK+2];
84940: 65,07,00,46        ad2w  R46,7            R46 += 7;
84944: c3,20,02,46        stw   R46,[R20+2]      [STACK+2] = R46; }
This implies that the 7 args are always available, if the jumps do not take place.
This seems easier than the M0M2 example, as the args are there whether they are used or not.
If SAD does not capture it, the user can use a sub command with options for 7 byte args. Possibly as 4words and 1 byte.

Does SAD V5 get to emulate the multiple paths?

Special cases everywhere, proving to be be a constant source of frustration. Fix the two cases above and others will be found. Fir the one offs it gets down to the user applying the ARG command line by line.
Another option is a fairly open signature framework that allows users to add signatures without having to build new SAD versions.
jsa
Posts: 231
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: 2023 Dec 04, 07:30 I probably should have asked this a long time ago, What is PSW exactly?
From a long time ago I've repeated the need to read the manuals. Do so, then ask about the Program Status Word details.
I thought it was just shorthand for push command but now I am not so sure, looking at the spreadsheet. Also, correct me if I am wrong, any time the code uses call or push or scall or pushw, it is loading a return address on the stack of the address where the actual command is located?
All opcodes have explanations in the manuals. Read about those opcodes in the manuals then ask further questions.
My point is, me re-iterating what the manuals say would seem pointless, if the manuals are not being read, why would you read anything I write here?
I have several sections where there are 5 arg lines under a subroutine in the eqe3 bin. getting very confusing for me for sure, maybe wasn't the best bin to start with. LOL

Code: Select all

099e4: 24,00                    #arg 1              TEMP0L,
099e6: 60,10                    #arg 2              1060,
099e8: 01                       #arg 3              1,
099e9: 80                       #arg 4              80,
099ea: 19                       #arg 5              19 );
The idea of subs that take args is to eliminate having repeating blocks of code for every block of args. The solution is one common subroutine that processes each block of args.

Give me some time and I'll shed some light on it.

Thanks for linking that early bug post with DIR fix.
BOOSTEDEVERYTHING wrote: 2023 Dec 04, 07:37 Actually, here it is for now, please ignore the mess, still working on correcting a bunch of things and verifying others.
I see, it's not so bad.
Drop the bank 1 off the front of everything at address 0x*1FFF and below, then order sym names sequentially.
Get the columns to line up.
Put things like WOR commands in the relevant bank section after the SYM commands section.
The two external posts I linked above are part of a thread which also has a spreadsheet converting a DIR into a definition. Check it out, It'll help you understand the way you want the DIR set out. That one is for BE, I expect something similar could work for TP import.
BOOSTEDEVERYTHING
Posts: 171
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 »

From a long time ago I've repeated the need to read the manuals. Do so, then ask about the Program Status Word details.

All opcodes have explanations in the manuals. Read about those opcodes in the manuals then ask further questions.
My point is, me re-iterating what the manuals say would seem pointless, if the manuals are not being read, why would you read anything I write here?


I understand, and I apologize for asking such a stupid question. I don't know why it did not dawn on me to look in the software manual for this answer. It is a little overwhelming getting started in this from where I did, and you all have been very helpful. Momentary "brain fart" I think, but no excuse. Again, I apologize. I have been referencing the manuals when I have questions before wasting your time, I just had a momentary lapse on this one.

Give me some time and I'll shed some light on it.
Thank you, I know your time is valuable, and I appreciate the help. No rush at all.
Thanks for linking that early bug post with DIR fix.
No problem at all. I hope one day to be able to contribute something a bit more useful to the community, but for now I may have to do some small things like this, LOL.
Drop the bank 1 off the front of everything at address 0x*1FFF and below, then order sym names sequentially.
Get the columns to line up.
Put things like WOR commands in the relevant bank section after the SYM commands section.
The two external posts I linked above are part of a thread which also has a spreadsheet converting a DIR into a definition. Check it out, It'll help you understand the way you want the DIR set out. That one is for BE, I expect something similar could work for TP import.
Ok, I will give that a shot. Hopefully that may help me to order things properly a bit easier. The addressing is still a bit confusing for me to grasp and order properly, but I am working on it, I keep forgetting to include the a,b,c,d,e,f of it all, and ordering them properly.
BOOSTEDEVERYTHING
Posts: 171
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 my cleaned up a bit dir file. It still most likely has some errors in it but it is at least in order, I think.
Attachments
eqe3_ml2_8a1a_stock read burn1fnb.zip
(21.89 KiB) Downloaded 43 times
jsa
Posts: 231
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: 2023 Dec 04, 07:30

Code: Select all

099e1: ef,32,bf           call  85916            Sub_85916 (
TVRfan has dropped a big hint above with his XDT2 code sample, it is very close to the same.

Search RZASA for arg 5, what sub address do you find, does the sub match EQE3 Sub_85916?

More later.
BOOSTEDEVERYTHING
Posts: 171
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 »

Sub_85916, in EQE3, matches Sub_96cb3, in RZASA, exactly. It looks to me to be an Output State Control subroutine? I am looking into the software manual about this one this evening when I get home to see if I can figure out exactly what it is doing.
tvrfan
Posts: 84
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 is what I was saying, that there is code and complete subroutines which change rarely. If you can find a bin with comments from someone else, this will likely help with your analysis. The A9L listing in OpenEEC is well commented, and is still very useful, even for multibanks.

Standard software design everywhere uses subroutines often. They do a defined 'job' to make the coding smaller, easier and reuseable. Some require extra data (arguments) to do their job, some do not. As above in fact many are reused across different binaries

Please do read those manuals, they answer (almost) all questions, They are pretty big, but stick with it.
Post Reply