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

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

Re: Why auto disassembly is tough

Post by jsa » Sat Apr 14, 2018 5:22 pm

tvrfan wrote:
Fri Apr 13, 2018 7:37 pm
Thanks jsa - you spot the details I miss !!
I can honestly say I completely missed INC and DEC as possibly being used with carry ... DUH ! Stupid error.
No worries, It is used sparingly, and I know how easy it is to overlook errors having worked on something for a period. Who knows what other little tricks are being used that have yet to be noticed.

Flag/bit names - again another slight catch 22 here - and an idea...

For scratch registers (typically R30 - R40 seem to be used a lot), sometimes it's several flags at once,
and sometimes its a genuine number mask (like for example A/D reads are only 10 bits). So where the AND and OR is done
with an immediate value, SAD looks for any bit names.
I was wondering whether to have a TYPE of variable as 'FLAGS' to define this behaviour, but it still wouldn't work for scratch/temp registers.
A 'FLAGS' type seems like a very good idea to cover BITS in addition to the bytes and words.

In the small number of bins I have looked at, the flags seem to be given pride of place below 0xff, so address range seems viable.

Yeah, scratch registers are unruly beasts, chopping and changing between bits, bytes and words.
Really need to define multiple subr address ranges where the scratch has a particular purpose for each range.

BUT also have in the background the idea that you can declare data types and they would be tracked/transferable.....
- i.e Types
Plain Word, Byte, Flags (word,byte) Nothing. perhaps signed/unsigned ?
I don't follow how this would differ from adding BITS to bytes and words.
IOtime (word/byte. long?) autoconvert to millisecs, but would require clock speed, unless I can spot a way to get it from code. (Timers subroutine?)
I think it would be possible to deduce clock speed from the code.

Code: Select all

ADvalue (word),   auto convert to volts 0-5
I don't know that 0-5 really gives anything more. The final units by way of divisor or formula seems like the goal to me.
RPM (word) auto convert (divide by 4) all are x4 as far as I can see. seems to be a standard
In CARD I have x/4, x*8, x*16, x*32 & x*64
Temp ? trickier, as Euro tend to use C and US ones use F (well, A9L does, don't know if later ones went metric)
Yeah, needs a formula. I have CARD (Euro) pegged at Fº, but converted to Cº would be best.

After that so far I see other variables don't have a common calibration, but perhaps could declare them .
or perhaps allow the idea of a divisor/multiplier factor on all SYM (only on tables/funcs to 3.05) which get used in print phase ?

The the idea that when you do R34 = R36, or R34 = [1234] the TYPE (or divisor) of the variable gets transferred to R34 as well as its value.
Yes SYM would work mostly. Could do with formulas and more than two decimal places for divisors, for all of S F T.

Yes tracking it through makes sense.

But then I can't decide if it's too complex....what if two different types get added ?
Do they though? Are you aware of any instances where it happens? I am not, but have I been paying enough attention!

Thank you for the Flag examples, I shall add some later today.
Cheers

John

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Sat Apr 14, 2018 6:02 pm

tvrfan wrote:
Sat Apr 14, 2018 3:34 pm
motorhead1991 wrote:
Sat Apr 14, 2018 12:19 am
So uh, I did a thing.... Testing it here in a second
The image is blurry AF, stupid Linux. Anyways, tvrfan your code is so good it's portable to Android.
Well, from what techie stuff I read, Android is supposed to have a Linux kernel/core !
I am trying to keep the code 'clean' C/C++, so a certified compiler should make it runnable on any environment which has the standard 'C' libraries.
Code does expect at least a 32 bit compiler and environment.
As per Github, I use exactly the same code for Win32 and Linux 64.

Good to know though ..... see the advert .....!!! SAD NOW RUNS ON MOBILE DEVICES !!!
That's exactly right, but it's not identical. I'm looking into adapting it to the Android C libraries and shells. It also takes some special permissions and other nonsense, since read/writing to the SD card is privileged.
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by jsa » Sat Apr 14, 2018 6:05 pm

motorhead1991 wrote:
Sat Apr 14, 2018 12:19 am
tvrfan your code is so good it's portable to Android.
Niiiiiice, what are you using to build it?
Would you put it on the play store?
Cheers

John

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Sat Apr 14, 2018 6:11 pm

jsa wrote:
Sat Apr 14, 2018 6:05 pm
motorhead1991 wrote:
Sat Apr 14, 2018 12:19 am
tvrfan your code is so good it's portable to Android.
Niiiiiice, what are you using to build it?
Would you put it on the play store?
Right now, it's just a binary, so you'd run it from a command terminal (not something the average Android user does). Eventually, I'd like to design a UI for it and make a release candidate, but I'll need to figure out how to bind it to the binary.

I built it within the Android build system, with only a couple edits to the source material (available on OpenEEC)
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by tvrfan » Sat Apr 14, 2018 6:52 pm

Motorhead
Does Android provide for calling a console prog from the GUI ? if it's Linux based you should be able to.
This way the actual SAD code stays identical and the GUI is a separate wrapper (which is what I did for Win32).
[which reminds me, must look at a Linux GUI / Xwin wrapper ]

glad that SAD works anyway - extra validation my code is clean!

jsa - 3.06 I have now changed for prints to be 3 decimal places in floats as per request. I want to stay fixed number of digits so it makes table and func layout easier to control (i.e. in neat columns) The command read in 3.05 is already (or should be) a full float, so can use more digits. Can't remember for sure if std C library rounds the floats (I think it does).


timel is a Timer list structure. half developed - may work, works on AA and A9L, but not on multibanks. Should have dropped this command off !!

Allowing divisor/multiplier on all variables (via SYM) so that user can calibrate whatever makes sense to him/her.
The types idea was really just a kind of predefined way of specifying that divisor anyway.

[edit] Oops ! when I check the code, 3.05 should ALREADY allow divisors ( :V) on all word and byte cmds - not tested, but should work as I use a generic print routine for all data. Will add to SYM as well for 3.06

Will put these in 3.06 to assess also

:B (:F ?) for flags word/byte to force individual bits to be displayed with AND and OR

See if i can come up with a simpler rule for the example PUSH(R34) to generate a SCAN....
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Sat Apr 14, 2018 8:20 pm

tvrfan wrote:
Sat Apr 14, 2018 6:52 pm
Motorhead
Does Android provide for calling a console prog from the GUI ? if it's Linux based you should be able to.
This way the actual SAD code stays identical and the GUI is a separate wrapper (which is what I did for Win32).
[which reminds me, must look at a Linux GUI / Xwin wrapper ]

glad that SAD works anyway - extra validation my code is clean!

jsa - 3.06 I have now changed for prints to be 3 decimal places in floats as per request. I want to stay fixed number of digits so it makes table and func layout easier to control (i.e. in neat columns) The command read in 3.05 is already (or should be) a full float, so can use more digits. Can't remember for sure if std C library rounds the floats (I think it does).


timel is a Timer list structure. half developed - may work, works on AA and A9L, but not on multibanks. Should have dropped this command off !!

Allowing divisor/multiplier on all variables (via SYM) so that user can calibrate whatever makes sense to him/her.
The types idea was really just a kind of predefined way of specifying that divisor anyway.

[edit] Oops ! when I check the code, 3.05 should ALREADY allow divisors ( :V) on all word and byte cmds - not tested, but should work as I use a generic print routine for all data. Will add to SYM as well for 3.06

Will put these in 3.06 to assess also

:B (:F ?) for flags word/byte to force individual bits to be displayed with AND and OR

See if i can come up with a simpler rule for the example PUSH(R34) to generate a SCAN....
I'd probably build an app out of it, actually. The JNI in Android makes that easier.

EDIT:
Hey, while I'm staring at this, I'm tempted to fix this "cmdline" error. What are you ascertaining from pathchar? I'm trying to determine the android equivalent.
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by jsa » Sat Apr 14, 2018 11:39 pm

tvrfan wrote:
Sat Apr 14, 2018 6:52 pm
jsa - 3.06 I have now changed for prints to be 3 decimal places in floats as per request. I want to stay fixed number of digits so it makes table and func layout easier to control (i.e. in neat columns) The command read in 3.05 is already (or should be) a full float, so can use more digits.
It was the command read that I had issue with, but then it was a V0.5 era, so likely invalid issue now.
timel is a Timer list structure. half developed - may work, works on AA and A9L, but not on multibanks. Should have dropped this command off !!
On the surface at least, it seems to work automatically. I have not pasted the MSG command to DIR.
Leave it in please, it does some good.
[edit] Oops ! when I check the code, 3.05 should ALREADY allow divisors ( :V) on all word and byte cmds - not tested, but should work as I use a generic print routine for all data. Will add to SYM as well for 3.06
Ok cool, I only have it in DIR for Func and Table, at the moment.
Will put these in 3.06 to assess also
:B (:F ?) for flags word/byte to force individual bits to be displayed with AND and OR
See if i can come up with a simpler rule for the example PUSH(R34) to generate a SCAN....
Capitol B is Byte in geek speak, so maybe I ....... bYte....bIt. Don't want to change F's purpose.

There are a few subr that are called by pushes, so yeah if something comes to mind, all good.

At this point I have nothing else for you and won't get a chance until next week to look further. So load up 3.06 when you like.
Cheers

John

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Sun Apr 15, 2018 11:22 pm

Darn it... These dos/Unix differences are messing up my modifications... Guess I'll have to fix them again...

(Don't merge those pull requests yet)
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by tvrfan » Mon Apr 16, 2018 2:24 pm

motorhead1991 wrote:
Sun Apr 15, 2018 11:22 pm
Darn it... These dos/Unix differences are messing up my modifications... Guess I'll have to fix them again...

(Don't merge those pull requests yet)
Like what ? Not used Android, but I only have a couple of DEFINES in SAD for the differences between DOS and UNIX, which are

1. File access - DOS + Win requires an extra letter in the open mode for 'Text'.
2. Case insensitive string match has different names in some versions of stdlib (but Codelite and Code:Blocks use the same name)

Can I help, or are you going for a more Android centric solution ??
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Mon Apr 16, 2018 3:39 pm

tvrfan wrote:
Mon Apr 16, 2018 2:24 pm
motorhead1991 wrote:
Sun Apr 15, 2018 11:22 pm
Darn it... These dos/Unix differences are messing up my modifications... Guess I'll have to fix them again...

(Don't merge those pull requests yet)
Like what ? Not used Android, but I only have a couple of DEFINES in SAD for the differences between DOS and UNIX, which are

1. File access - DOS + Win requires an extra letter in the open mode for 'Text'.
2. Case insensitive string match has different names in some versions of stdlib (but Codelite and Code:Blocks use the same name)

Can I help, or are you going for a more Android centric solution ??
You're more than welcome to help. I was more griping about Linux' sensitivity to dos' lack of caring for newline markers.

My terminal setup isn't 100% yet either so it's all goofy. I'll have to redo it on the other machine (with an established OS.)
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by tvrfan » Mon Apr 16, 2018 5:19 pm

Ah right......understand.

Just in case it helps ......

I agree there is some weird combination of the two characters CR and LF at the end of each line.
Dos and Linux do seem to deal with these differently (can't remember, but I think DOS always inserts a CR ? or other way round ? Um...)

Anyway, I typically search for both both CR '\r' and LF '\n' separately to check the end of each input line, then any comment char,
then do the processing... so both cases catered for. But as for Android... no idea....
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Mon Apr 16, 2018 6:27 pm

I'm seeing more ^M than anything, and lots of magically appearing spaces 😆
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Mon Apr 16, 2018 9:12 pm

Updated the OpenEEC source, so I need the Windows guys to give it a run and make sure I didn't break anything.
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Tue Apr 17, 2018 11:37 am

tvrfan wrote:
Mon Apr 16, 2018 2:24 pm
motorhead1991 wrote:
Sun Apr 15, 2018 11:22 pm
Darn it... These dos/Unix differences are messing up my modifications... Guess I'll have to fix them again...

(Don't merge those pull requests yet)
Like what ? Not used Android, but I only have a couple of DEFINES in SAD for the differences between DOS and UNIX, which are

1. File access - DOS + Win requires an extra letter in the open mode for 'Text'.
2. Case insensitive string match has different names in some versions of stdlib (but Codelite and Code:Blocks use the same name)

Can I help, or are you going for a more Android centric solution ??
I don't think I mentioned this, but you can leave comments on code through github, so if you have any pointers or recognize a subroutine that isn't labeled, you can point it out (or push the change yourself).
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

SAD 3.06 released

Post by tvrfan » Tue Apr 17, 2018 6:11 pm

I was planning to make some more changes, but in the process found and fixed quite a few little bugs, so have decided to release as 3.06
See 'versions.txt' for all the fixes.
Have gone to jsa's suggested idea of 'LR' for long register (and so on).

--------------------------------------------

Also - got straight in my head the idea of a 'type' or 'class' of object.

WHY? - a LOT of symbols are just ways of defining a min or max value etc. in a human readable way, like say "TPS_MIN_0.0065V"

So - if SAD has the idea of a 'class', for example "TPS_Raw" as an A/D voltage, whenever the code sees an immediate value, or
indexed direct (i.e. always resolves to a 'fixed' address) it can automatically convert that value to a matching type to the AD_raw value.
this would save a lot of symbols, and might help understand stuff quicker.

code examples from AA

Code: Select all

31e8: db,03               jc    31ed             if ((uns) TPS_val < TPS_Min )  {
31ea: a0,ec,c8            ldw   Rc8,Rec          TPS_Min = TPS_val; }
31ed: 48,c8,8c,aa         sb3w  Raa,R8c,Rc8      TPS_Posn = TPS_raw - TPS_Min;
31f1: d9,02               jgtu  31f5             if ((uns) TPS_Posn <= 0)  {
31f3: 01,aa               clrw  Raa              TPS_Posn = 0; }                   # Throttle must be closed if equal/lower

### Throttle closed ###
31f5: 8b,01,48,24,aa      cmpw  Raa,[R0+2448]    
31fa: d9,08               jgtu  3204             if ((uns) TPS_Posn <= 0.065V)  {
31fc: 91,03,20            orb   R20,3            TPS_Closed = 1;
                                                 TPS_TClosed = 1;                  # TPS_TClosed used in test (STI) sequence
31ff: 71,fb,20            an2b  R20,fb           TPS_Wide = 0;
3202: 20,12               sjmp  3216             goto 3216; }

### Part throttle, small difference  (< 3.25v) ###
3204: 8b,01,4a,24,aa      cmpw  Raa,[R0+244a]    
3209: d9,05               jgtu  3210             if ((uns) TPS_Posn <= 3.25V)  {
320b: 71,f8,20            an2b  R20,f8           TPS_Closed = 0;
                                                 TPS_TClosed = 0;
                                                 TPS_Wide = 0;
320e: 20,06               sjmp  3216             goto 3216; }
At the moment, '0.0065V' and 3.25V' are symbols ( at 2448 and 244a) -
but there's enough here to say "if TPS_raw is an AD voltage, then so is TPS_posn.
TPS_posn is a AD voltage, so [2448] and [244a] are ALSO AD voltages....and can be converted automatically to a voltage.
so defining a class with the symbol TPS_Raw might be a neat trick....

also RPM.
Think what this could do for the timing stuff, which is everywhere.....and would spot stuff otherwise missed....

to make this portable, a class would define a divisor , and perhaps a trailing char or three (for 'V' or 'mS' or 'RPM')

Anyway - thoughts welcome.
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Tue Apr 17, 2018 10:07 pm

So, here's an strace dump of the segmentation fault:
SAD for Android #1

I've tried a couple different configurations so far, and they all segfault in the same spot

If either of you more experienced C programmers can see anything, that'd be dandy :biggrin:
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

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

Re: Why auto disassembly is tough

Post by tvrfan » Tue Apr 17, 2018 11:44 pm

A suggestion - I wouldn't be surprised if I've forgotten to fully check if a file is correctly opened/created.

I note in the dump there is a 'file not found' in a few places....
typically it does segv as the file handle (a pointer) will be zero (or -1)
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

motorhead1991
Gear Head
Posts: 51
Joined: Tue Nov 21, 2017 2:32 am

Re: Why auto disassembly is tough

Post by motorhead1991 » Wed Apr 18, 2018 12:29 am

tvrfan wrote:
Tue Apr 17, 2018 11:44 pm
A suggestion - I wouldn't be surprised if I've forgotten to fully check if a file is correctly opened/created.

I note in the dump there is a 'file not found' in a few places....
typically it does segv as the file handle (a pointer) will be zero (or -1)
I actually picked up on that correlation as well. I added Androids "string.h" to Core to add some more defines, though it might take an ifneq or two to narrow things down.
1990 Ford Ranger FLH2 conversion. Ford forged/dished pistons, Total Seal file-fit rings, Clevite rod and main bearings, Clevite cam bearings, IHI turbo, Siemens Deka 60lb/hr injectors, Ford slot MAF in custom 3" housing. Moates Quarterhorse with Binary Editor, using the PAAD6 database.

OpenEEC Telegram Chat:
Telegram

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest