EEC V file conversion

All hardware related, disassembly / programming and code discussions belong here.
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 have a quick question when looking for similarities. it is about the arg in the list file. The first example is from the eqe3 lst file second is the rzasa lst file that I think matches, but I am having problems defining it in the dir file. I first tried it at address 9a4, but obviously it is not correct because it does not define it in the lst file when i put that in the dir file. Please help me understand the arg code a little better? not sure what to do when there are 2 different arg in the same area. Thanks

Code: Select all

83113: ef,cb,b4           call  0e5e1            Sub_0e5e1 (
83116: a4,09                    #arg 1              9a4,
83118: 05                       #arg 2              5 );
83119: 91,40,89           orb   R89,40           EGR_MON = 1;

Code: Select all

84213: ef,71,b6           call  0f887            Sub_0f887 (
84216: 8a,0a                    #arg 1              P0400STATE );
84218: 91,40,88           orb   R88,40           EGR_MON = 1;
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 »

jsa wrote: 2023 Nov 14, 20:01 Lol, anything below 25°c is 'cold'.
Yeah.....That's not cold. LOL. It has been about 2 degrees c here at night lately and we aren't even all the way into the cold season yet. When I lived up north in New York, not too far from Niagra Falls, 2 degrees is even warm.LOL
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 »

Unfortunately at the current version 4, SAD does not always get the argument sizes right. A quick scan through eqe3, knowing nothing else, gives me -
0e5e1 calls 87e99, telling it to get 3 bytes. 87e99 puts those 3 bytes into R2a, R2b, R2c. Then looking a bit further along the code,

Code: Select all

0e5f3: a2,2a,46           ldw   R46,[R2a]        R46 = [R2a];
0e5f6: 3f,46,06           jb    B7,R46,0e5ff     if (B7_R46 = 0)  {
0e5f9: 91,80,46           orb   R46,80           B7_R46 = 1;
0e5fc: c2,2a,46           stw   R46,[R2a]        [R2a] = R46; }
0e5ff: 49,00,09,2a,46     sb3w  R46,R2a,900      R46 = R2a - 900;
0e604: 65,e6,6b,46        ad2w  R46,6be6         R46 += 6be6;
0e608: a2,46,26           ldw   R26,[R46]        R26 = [R46];
0e60b: 99,08,2c           cmpb  R2c,8            
This implies that R2a is a word (i.e. R2a and R2b) , and is used as a pointer (i.e. [R2a] ) and then code is doing some fiddling around, maybe a range check. I think this because the next bit uses R2a as some kind of offset against an absolute address of 6be6 which would be a (word) array or list of some type (in Bank 1).
It looks like R2a (= a4 ? note the -900 first..) is then some kind of index into data starting at 16be6. But it's not quite that simple, as [R2a] is updated too, implying that something is being stored at 109a4 as well, which will be RAM (KAM?) in Bank 1. Maybe this 'index' value is kept for something else.

Last opcode does a byte compare of R2c, so it's probably a byte. So those args, word+byte are probably right.
And that's about as far as I can get ...

I have skipped the gory detail... study the code lines for yourself and see if that makes sense.

NB. subr 87e99 is a 'remote argument getter', and it does the job of 'please get me x bytes as my arguments'. It takes quite a lot of explaining how that subroutine actually works, just note for now it uses the stack pointer and does a lot of pointer stuff. I'm telling you this so you don't get hung up with "what the F does THAT subroutine do ?". A while ago when we were all still learning, how those subroutines actually work in multibanks was the subject of a large discussion thread....

(Yep, hot and cold is all relative to where you live....)
Andy
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 think I get what you are saying somewhat. Except hoe to get to an actual solution, I guess? So does this mean it is 9a4 byte 5 or would this be 9a4 plus 5 bytes=9a9? That may be completely wrong both ways as well. LOL

Code: Select all

83116: a4,09                    #arg 1              9a4,
83118: 05                       #arg 2              5 );
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 a couple more examples of the arg in code.
Attachments
argsnippet1.png
jsa
Posts: 274
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 Nov 15, 16:29 I have a quick question when looking for similarities. it is about the arg in the list file. The first example is from the eqe3 lst file second is the rzasa lst file that I think matches, but I am having problems defining it in the dir file. I first tried it at address 9a4, but obviously it is not correct because it does not define it in the lst file when i put that in the dir file. Please help me understand the arg code a little better? not sure what to do when there are 2 different arg in the same area. Thanks
I've had very little time to dig into this, work's keeping me very busy.

The code appears to be doing similar things but in different ways.

What have you put in your DIR file?
Have you told SAD to name the arg with a :WN option?
Have a look at the lookup sub commands in the DIR I've posted previously.
If SAD has the ARG size right, it could look like;

Code: Select all

SUB 0E5E1 "SUB0E5E1_Name"         :WN   :YN
More detail on working through arg code later.
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 »

(sorry for delay - busy with other things...)
Those args will be connected, but probably not quite as closely as you are suggesting. For an example (A9L code)-

Code: Select all

73d0: ef,91,05            call  7964             Compare (
73d3: 14,01                     #arg 1              ACT_Raw,
73d5: 6a,90                     #arg 2              ACTmax );
 
This compares an A/D input (air charge temp = incoming air temp) with a value of ACTmax, which is a check to see if sensor reading is still valid.

Similarly -

Code: Select all

740f: ef,52,05            call  7964             Compare (
7412: 24,01                     #arg 1              MAF_Raw,
7414: 0e,91                     #arg 2              Maxmaf ); }
This does the same job for the mass airflow sensor. The subroutine at 7964 compares the first value with the second, and if first value is greater than the second, it sets an error code in a list (stored elsewhere). This is what subroutines are for, a job which when written once can be called for multiple cases.
This subroutine works for minimums too, by simply swapping the arguments over.... so the one above, MAF_raw has to be less than Maxmaf, or it's an error, and then mafmin must be less than MAF_raw... i.e. MAf_raw has to be greater than mafmin as in -

Code: Select all

7429: ef,38,05            call  7964             Compare (
742c: 10,91                     #arg 1              Mafmin,
742e: 24,01                     #arg 2              MAF_Raw ); } }
So that's how the coding is made simpler and more robust....
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 »

Code: Select all

83113: ef,cb,b4           call  0e5e1            Sub_0e5e1 (
83116: a4,09                    #arg 1              9a4,
83118: 05                       #arg 2              5 );
83119: 91,40,89           orb   R89,40           EGR_MON = 1;
For this one I was just trying to name the 9a4 address as p0400state. so I put this in my dir file.

Code: Select all

SYM  09A4 "P0400STATE"                #UY
But it doesn't seem to want to name that 9a4 address in the argument. I does appear elsewhere in the lst file, not as an arg, and names it as p0400state. Not sure what I am doing wrong. Is there something I am missing?

Code: Select all

   Sub_0e5e1:
0e5e1: f2                 pushp                  push(PSW);
0e5e2: 10,08              rombk 8
0e5e4: ef,b2,98           call  87e99            Sub_87e99 (
0e5e7: 03                       #arg 1              3 );
0e5e8: 00                 skip                   goto 0e5ea;
This is the subroutine it points to just before the arguments. it calls another subroutine for what seems to be rom bank control and then names another arg. So I am a little confused. I was looking at the sad docs and couldn't find an answer as to why it wouldn't name the address in the arg as I defined it in my dir file.
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 »

This is a bit of a problem, which doesn't have an easy solution.
Why -
Basically, there's no way for SAD to know what an argument is used for. So '9a4' might be an address, but it might be just a plain value, or an index into an array, as I think it is here, from code at 0e5f3 onwards. Sometimes those values are actually "flags (say bit 7) + value (B0-6)" . But it's worse than just that...it gets more complicated because banks are 'nailed on' and not integrated into opcodes. So it's HORRID!! to sort out, and need user commands.

In a single bank like A9L, if you declare a symbol at 9a4, then it can be checked against an argument value, and assumed it's an address, so the symbol name will get printed. But it still might be wrong. It's a best GUESS.

In a multibank, data is normally in Bank 1 (BUT NOT ALWAYS!) so 9a4 could be 109a4 (ie. in Bank 1), but in the case shown here it is seems NOT to be a simple address, so what to do ??? If I just force a bank 1 to be added to all argument values above 0x3ff, that can't be right...

The SYM command forces all 'bankless' addresses above 0x3ff (i.e. the registers) to be bank1, so the name will get saved as 109a4, because for a symbol it IS an address. But this will never match any argument value with a 'bare' 9a4.

And frankly I don't know how to solve that.
You can set the argument with a command to be an address and to look for a name, it will then match the sym, but it will still have to be a user command.
But here, I'm not convinced that's correct in the first place ?

NB. looking at that code again, my comments, but this is all guesswork

Code: Select all

0e5f3: a2,2a,46           ldw   R46,[R2a]        R46 = [R2a];                # get argument (the '9a4')
0e5f6: 3f,46,06           jb    B7,R46,0e5ff     if (B7_R46 = 0) {          #  if negative ??   or a flag to do rounding ? but bit is set for '9a4' so skips it
0e5f9: 91,80,46           orb   R46,80           R46 |= 80;                    #  this kind of thing is often used for rounding up (or down) 
0e5fc: c2,2a,46           stw   R46,[R2a]        [R2a] = R46; }             # store modified value back
0e5ff: 49,00,09,2a,46     sb3w  R46,R2a,900      R46 = R2a - 900;  # '9a4' jumps here, so  R46 = a4
0e604: 65,e6,6b,46        ad2w  R46,6be6         R46 += 6be6;         #6be6 + a4           =  758a
0e608: a2,46,26           ldw   R26,[R46]        R26 = [R46];             # this must be an address so  R26 = [1758a]     (= 'b2')
What's around that address ? A list of values, may be error codes? No obvious pattern, so don't know.

If you look further down at 0e62d onwards, there are blocks of code which say if (R2c = 8, if R2c = 5) which is second argument,
so that looks like subroutine is doing some kind of ' perform action <arg 2> with value of <arg 1>' and <arg1> may have extra flags, or may be signed?

Hope that helps.
wwhite
Posts: 320
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 »

Something I've found, but more to do with single bank, is that if an invalid op code happens in the lst, shows as !INV!, most of the code afterwards is in correct. Before I add symbols(sym), i fix all !INV! first throughout the bin.
Post Reply