1D (Function) lookup code

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

1D (Function) lookup code

Post by tvrfan » Fri Nov 20, 2015 4:14 pm

As it's been quiet for a week, here is another nugget for you.

This is the entire 1D/Function byte lookup code from the early 'AA' box. This is the simplest I've seen, but still is the exact same technique used throughout all single bank bins. I've even labelled the signed/unsigned flag for you. This contains all the lookup loop logic and maths necessary to do a 1d lookup, both for signed and unsigned functions.
( Later bins have 4 options, signed in/out, unsigned in/out, and have a bit more code....but not that much extra.)

On entry - R32 is address of function, R34 is input (lookup) value. Answer is returned in R38.
See if you can sort out how this works, it's fairly straightforward and doesn't have any nasty tricks.

Code: Select all


   SBFuncLu:                                                                      #signed
2f9c: 91,02,f6         orb   Rf6,2          SIGNED = 1;
   UBFuncLu:                                                                      #unsigned
2f9f: 9b,32,02,34      cmpb  R34,[R32+2]    
2fa3: 31,f6,04         jnb   B1,Rf6,2faa    if (!SIGNED) goto 2faa;
2fa6: db,0a            jc    2fb2           if (CYflag) goto 2fb2;
2fa8: 20,02            sjmp  2fac           goto 2fac;

2faa: d6,06            jge   2fb2           if (R34 < [R32+2])  {
2fac: 65,02,00,32      ad2w  R32,2          R32 += 2;
2fb0: 27,ed            sjmp  2f9f           goto UBFuncLu; }

2fb2: b2,33,36         ldb   R36,[R32++]    R36 = [R32++];
2fb5: b2,33,38         ldb   R38,[R32++]    R38 = [R32++];
2fb8: 7a,32,36         sb2b  R36,[R32]      R36 -= [R32];
2fbb: 7a,33,34         sb2b  R34,[R32++]    R34 -= [R32++];
2fbe: 7a,32,38         sb2b  R38,[R32]      R38 -= [R32];
2fc1: 31,f6,04         jnb   B1,Rf6,2fc8    if (!SIGNED) goto 2fc8;
2fc4: db,09            jc    2fcf           if (CYflag) goto 2fcf;
2fc6: 20,02            sjmp  2fca           goto 2fca;

2fc8: d6,05            jge   2fcf           if (R38 < [R32])  {
2fca: 91,01,f6         orb   Rf6,1          Rf6 |= 1;
2fcd: 13,38            negb  R38            R38 = -R38; }
2fcf: 7c,34,38         ml2b  R38,R34        R38 *= R34;
2fd2: 9c,36,38         divb  R38,R36        R38 = R38 / R36;
2fd5: 30,f6,02         jnb   B0,Rf6,2fda    if (B0 Rf6)  {
2fd8: 13,38            negb  R38            R38 = -R38; }
2fda: 76,32,38         ad2b  R38,[R32]      R38 += [R32];
2fdd: 71,fc,f6         an2b  Rf6,fc         B0_Rf6 = 0;
                                            SIGNED = 0;
2fe0: f0               ret                  return;

TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

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

Re: 1D (Function) lookup code

Post by jsa » Mon Nov 23, 2015 4:09 am

I'll will have a go at this in time.

Part way through sorting out the hardware required to add a couple sensor inputs to COSY & ANTI, so I'd like to tidy that up 1st.
Cheers

John

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

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

Re: 1D (Function) lookup code

Post by tvrfan » Mon Nov 23, 2015 1:59 pm

Thanks jsa - no rush, good to know it will be attempted !!
TVR, Triumph (cars), kit cars, classics. Ex IT geek, development and databases.

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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests