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
User avatar
tvrfan
Tuning Addict
Posts: 534
Joined: Sat May 14, 2011 11:41 pm
Location: New Zealand

redundant ops, proves compiler was used ?

Post by tvrfan » Fri May 14, 2021 4:38 pm

I just spotted this in DOAV654 bin....

Code: Select all

031d8: 3c,7b,1e           jb    B4,R7b,031f9     if (B4_R7b = 1) goto 031f9;
031db: b3,01,56,03,90     ldb   R90,[R0+356]     R90 = R356;
031e0: 3b,90,16           jb    B3,R90,031f9     if (B3_R90 = 1) goto 031f9;
031e3: fd                 regbk 3                
031e4: 91,08,56           orb   R356,8           B3_R356 = 1;
031e7: f4                 regbk 0                
031e8: fd                 regbk 3                
031e9: 91,04,56           orb   R356,4           B2_R356 = 1;
031ec: f4                 regbk 0                
031ed: fd                 regbk 3                
031ee: 71,df,56           an2b  R356,df          B5_R356 = 0;
031f1: f4                 regbk 0                
031f2: 20,05              sjmp  031f9            goto 031f9; }

031f4: fd                 regbk 3                
031f5: 91,20,56           orb   R356,20          B5_R356 = 1;
031f8: f4                 regbk 0                 } }
031f9: 9b,01,76,02,00     cmpb  R0,[R0+276]     
Just for everyone's info. I think this pretty much proves that this code was compiled, as a typical compiler does a "for each opcode" kind of analysis, so switching register (ram) bank for each opcode and returning to zero (obviously defined as 'home' for the compiler), whereas a human programmer would do this kind of thing instead -

Code: Select all

031e3: fd                 regbk 3                
031e4: 91,08,56           orb   R356,8           B3_R356 = 1;     
031e7: 91,04,56           orb   R356,4           B2_R356 = 1;
031ea: 71,df,56           an2b  R356,df          B5_R356 = 0;
031ed: f4                 regbk 0                
I have seen this kind of ram bank sequence in other bins too, so it's not unusual, so don't worry that there's any special reason for it.

Note that also at 031db, the opcode is an indexed address mode which goes to an internal register, which was a previous question (somewhere in EEC Geeks) about how the address map works....this shows it's legal to use indexed mode into internal register/ram bank of CPU.

Compilers in use today often have a separate check/pass, after the compile run, to remove redundant operations to make the code faster....looks like the Ford EEC one did not....
TVR, kit cars, classic cars. Ex IT geek, development and databases.
https://github.com/tvrfan/EEC-IV-disassembler

ollopa
Gear Head
Posts: 48
Joined: Tue May 18, 2010 2:02 am

Re: redundant ops, proves compiler was used ?

Post by ollopa » Fri May 14, 2021 4:48 pm

It could also be a macro from a macro assembler. Imagine some poor soul kept mismanaging the bank switches and decided to just make a macro that guaranteed a return to a known context.

The best signature of a compiler would probably be an (inefficient) convention for parameter passing either by use of the stack or reserved registers.
1994 Mustang GT, 351w (377 stroker), TFS heads, hydraulic roller lifters, 1.7 roller rockers, explorer intake, T4M0, Quarterhorse, SLC-DIY wideband AFR meter

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

Re: redundant ops, proves compiler was used ?

Post by tvrfan » Fri May 14, 2021 6:12 pm

Yep, agree totally, could be a macro type construct too.

and the old programming rule -- "make it work first before you make it work fast" is always wise...
TVR, kit cars, classic cars. Ex IT geek, development and databases.
https://github.com/tvrfan/EEC-IV-disassembler

User avatar
cgrey8
Administrator
Posts: 10913
Joined: Fri Jun 24, 2005 5:54 am
Location: Acworth, Ga (Metro Atlanta)
Contact:

Re: redundant ops, proves compiler was used ?

Post by cgrey8 » Mon May 17, 2021 6:11 am

tvrfan wrote: Fri May 14, 2021 6:12 pm...and the old programming rule -- "make it work first before you make it work fast"...
That philosophy is still alive-n-well where I work.
...Always Somethin'

89 Ranger Supercab, 331 w/GT40p heads, ported Explorer lower, Crane Powermax 2020 cam, 1.6RRs, FMS Explorer (GT40p) headers, Slot Style MAF, aftermarket T5 'Z-Spec', 8.8" rear w/3.27s, Powertrax Locker, Innovate LC-1, GUFB, Moates QuarterHorse tuned using BE&EA

Member V8-Ranger.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests