Why auto disassembly is tough

This is where the BIN Hackers and definition junkies discuss the inner workings of the EEC code and hardware. General tuning questions do not go here. Only technical/hardware-specific/code questions and discussions belong here.

Moderators: cgrey8, EDS50, Jon 94GT, 2Shaker

Post Reply
jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Tue May 01, 2018 6:22 pm

tvrfan wrote:
Tue May 01, 2018 2:49 pm
My original idea was to show a whole ENTRY (or CELL) as one printed row, which matches my IT programming view. This matches up with a TABLE which is a 2D structure with rows and columns.

For a command , you specify one entry of a struct and then SAD then fills in the following entries automatically until END address. Seems logical to me, but then I admit my strong IT bias. Not sure how one on each line would identify it as a structure, but I'm open to ideas.
As it is SAD does a good job too note a block of code as a structure, then commands are added to the DIR manually to give the structure context.
From your A9L DIR and LST

Code: Select all

word 862a 862d
strct 862e 864f : Y N :Y
word 8650 865d
strct 865e 868d : Y N D 100:Y
word 868e 869b :
strct 869c 86c9 : Y N D 200:Y
word 86ca 86d7
strct 86d8 86e5 : Y N D 300:Y
word 86e6 86e7

Code: Select all

863e: b0,1e   struct            ECT, 1e                                            #ECT
8640: b1,1e   struct            ACT, 1e                                            #ACT
8642: c2,28   struct            Saf, 28                                            #Saf
Take it further and individual cells can be calculated

Code: Select all

word 862a 862d
strct 862e 863d : Y N :Y
strct 863e 863f  : Y N :Y V 1
strct 8640 8641  : Y N :Y V 1
strct 8642 8643  : Y N :Y V 4
strct 8644 864f : Y N :Y
To give

Code: Select all

863e: b0,1e   struct            ECT, 30                                            #ECT

8640: b1,1e   struct            ACT, 30                                            #ACT

8642: c2,28   struct            Saf, 10  
Straight up, I would like to have a formula, as an option, to convert to Cº. This equally applies to all SFT. Quickly skimming through a DEF I see 4 different formulas that can not be covered by divisor. So free form formulas could be avoided by having something like;

Code: Select all

strct 863e 863f  : Y N :Y F 1
F 1 tells SAD to run hard coded Formula 1 against that byte (W or Y_Y or Y^ word). In this case it is hex Fº to dec Cº.

A multiplier would also be nice to avoid untidy 1/ numbers.

Bung on a units option for good measure, again for all SFT

Code: Select all

strct 863e 863f  : Y N :Y F 1 U Cº
Or
                              U PSI
                              U Hg"
                              U Advº
                              U thingamejigs
Again A9L

Code: Select all

866e: 16,c0   struct            EVP_Raw, c0                                        #EVP_Raw = 0x4cc0
8670: 17,4c   struct            117, 4c                                            #
How about an option to tell SAD this is all a word loaded as 2 bytes, something like;

Code: Select all

strct 866e 8671  :Y_Y N :Y_Y V 12800
_ signifies pass over a byte to get the next part of the word.

For loading a high byte (low byte is a byte), something like;

Code: Select all

strct bcde bcdf  :Y' N :Y V 12800 U Volts
or
strct acde acdf  :Y N :Y^ V 12800 U Volts
' or ^ tells SAD to calculate a word with the value as the high byte. SAD also picks up the SYM name from the low byte, but would SAD need an explicit Hi byte option for both address and value........
Did I miss that in the doc ? OK.....
Thanks for the explanation, Q did not make a difference for the structure I tried against. It had the 0xFF, but I probably camouflaged it with a FILL elsewhere.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

tvrfan
Tuning Addict
Posts: 313
Joined: Sat May 14, 2011 11:41 pm
Location: New Zealand

Re: Why auto disassembly is tough

Post by tvrfan » Tue May 01, 2018 10:50 pm

I think I see what you are getting at , e.g. where an initialise list loads the two bytes separately, and your formula suggestion fits right in with my "class" idea.

Your example - if you specify a register as a temperature, everything related to it gets scaled as a temperature too.

My idea was to simply specify a divisor (or multiplier) and do it that way. hmm... I could also add a little units text or a preset list
multiplier instead of divisor - yes probably should do that.
Hmm.... thoughts on your multiples....if I'm understanding it right....
How about I add the ability to define what size a symbol is ? (at the moment it's only ever an address)
if you can specify a Y or a W as a size qualifier, then what you are asking could perhaps get done this way with a simpler command syntax ??
I'll have to move the 'W' (which means write in a SYM), but that's no big deal....

[ interesting aside - this could be fun if you specify a 24 or 32 bit value (e.g. Time), and SAD could then allow for the 32 bit adds....for later on !! ]

Then the struct printout could automatically put 4 bytes on that line..... with a char to switch it on or off , or perhaps if you do a 'N' (=name) it happens
automatically ... Hmmm... something like that - Anyway - I reckon that's simpler for the same outcome ??

I'll have a think about those ideas - good one.
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Wed May 02, 2018 6:48 pm

tvrfan wrote:
Tue May 01, 2018 10:50 pm
I think I see what you are getting at , e.g. where an initialise list loads the two bytes separately, and your formula suggestion fits right in with my "class" idea.

Your example - if you specify a register as a temperature, everything related to it gets scaled as a temperature too.

My idea was to simply specify a divisor (or multiplier) and do it that way. hmm... I could also add a little units text or a preset list
multiplier instead of divisor - yes probably should do that.
Indeed, your class approach is good. I'm thinking all 3 multiplier, divisor and preset equation.

I went through all the BE defs I have here and distilled out all the equations that can't be done with a simple multiplier or divisor. Obviously some can be boiled down.

Code: Select all

(X*2-32)/1.8
(X/128-32)/1.8
(X/2.56)+50
(X/256)+0.5
(X/128)+1
X/2+1
((X/512)*14.64)+14.64
(X/236.25255)*14.74-14.74
X/239*14.7-14.7
1-(X/128)
2.56-(X/25600)
This worst case example can be boiled down to a divisor, but easier as a multiplier

Code: Select all

X/0.000002400*3600/2.204623/(2^31)
X/0.000005333*3600/2.204623/(2^31)
Hmm.... thoughts on your multiples....if I'm understanding it right....
How about I add the ability to define what size a symbol is ? (at the moment it's only ever an address)
if you can specify a Y or a W as a size qualifier, then what you are asking could perhaps get done this way with a simpler command syntax ??
I'll have to move the 'W' (which means write in a SYM), but that's no big deal....
Sym more or less behaves as a bYte by default at the moment and it has biT as an option, so adding Word makes sense. Alternatively make Sym behave as a word by default and add Y to the T option.

Write is one of those undocumented features. :surprised: I see it in the MSG though and have just let SAD do that automatically.

I don't mind if it is coded this way or some other way. Defining a sym size is much easier than picking apart structures and what not. Hopefully it all works out.
[ interesting aside - this could be fun if you specify a 24 or 32 bit value (e.g. Time), and SAD could then allow for the 32 bit adds....for later on !! ]
Hmmm....... what to name those options. .......don't want to break existing DIR. Do they always follow endian layout???

For the sake of backwards compatibility, existing W and Y command options would have to take precedence over SYM options.
Then the struct printout could automatically put 4 bytes on that line..... with a char to switch it on or off , or perhaps if you do a 'N' (=name) it happens
automatically ... Hmmm... something like that - Anyway - I reckon that's simpler for the same outcome ??

I'll have a think about those ideas - good one.
Yeah, the N option triggering the printing of class information is a neat solution, run with that.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Sat May 05, 2018 5:56 pm

tvrfan wrote:
Tue May 01, 2018 2:49 pm
Did I miss that in the doc ? OK.....
Sorry, found Q in V3.06 help file. Too many files with the same name.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Sun May 06, 2018 3:11 am

Another to ponder

Code: Select all

b9d3: b1,20,3e            ldb   R3e,20           R3e = 20;                     # B5 Set 1
.
.
b9eb: 91,40,3e            orb   R3e,40           R3e |= 40;                    # B6 Set 1
.
.
ba06: 91,80,3e            orb   R3e,80           R3e |= 80; } }                # B7 Set 1
.
.
ba09: b2,31,3c            ldb   R3c,[R30++]      R3c = [R30++];                # [R30++} is x20 B5 Set 1
.
.
ba2c: 50,3c,3e,00         an3b  R0,R3e,R3c       R0 = R3e & R3c;               # B5 is 1, Z flag not set
ba30: df,d7               je    ba09             if (R0 = 0) goto ba09;
I find this more informative;

Code: Select all

ba30: df,d7               je    ba09             if (Z_PSW = 1) goto ba09;
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Sun May 13, 2018 1:41 am

I am seeing LOAD in immediate address mode having names applied to the immediate value.

In some cases the immediate value does get used as an address of a named variable.

In other cases it appears to be coincidence that the value is the same as an address elsewhere.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

tvrfan
Tuning Addict
Posts: 313
Joined: Sat May 14, 2011 11:41 pm
Location: New Zealand

Re: Why auto disassembly is tough

Post by tvrfan » Thu May 17, 2018 4:17 pm

Hah !!

Just discovered why I couldn't get signed/unsigned to work reliably in SAD. Would you believe there were THREE minor bugs.
Each bug on its own didn't affect anything, even though it was wrong, but acting together they screwed up the reliable logging of the bit flags used
to mark signed/unsigned functions and tables. No wonder I had trouble finding it.

Even after 30-odd years in IT...... this stuff still surprises me !

OK, will fix issues raised (thanksagain jsa) and release a 3.07 soon.
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

jsa
Tuning Addict
Posts: 419
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

Re: Why auto disassembly is tough

Post by jsa » Thu May 17, 2018 4:53 pm

Haha, gotta love those seemingly unrelated fault combo's. Great that you have found them.

Looking forward to the next version, thank you.
Cheers

John

95 Escort RS Cosworth - GHAJ0 / ANTI on a COSY box code
Moates QH & BE
ForDiag

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests