Unsigned to Signed

All hardware related, disassembly / programming and code discussions belong here.
decipha
Posts: 4953
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Unsigned to Signed

Unread post by decipha »

I changed the input to FN810 for delta-n so I don't have to update it each time I change idle rpm and as a bonus it'll chase the rpm adders.

These are the two equations already in the code.

NOTE: //dsdrpm [50] *16 == 800 rpm. rpm [3200] /4 == 800 rpm.

OPTION A

Code: Select all

4ddd: 11,18             clrb  R18            R18 = 0;
4ddf: b3,72,e6,19       ldb   R19,[R72+e6]   R19 = DSDRPM;
4de3: 08,02,18          shrw  R18,2          R18 = R18 / 4;
4de6: 48,18,ae,18       sb3w  R18,Rae,R18    R18 = N_RPM - R18;
--------------------------------------------------------------------------
OPTION B

Code: Select all

505a: af,72,e6,30       ldzbw R30,[R72+e6]   temp6l = (uns)DSDRPM;
505e: 09,06,30          shlw  R30,6          temp6l *= 40; // 40 hex== *64 decimal
5061: 48,30,ae,30       sb3w  R30,Rae,R30    temp6l = N_RPM - temp6l;
--------------------------------------------------------------------------
Option B is what I'm currently using.

Neither of the two options have signed variables so what would be the easiest way to make it roll over and actually be a signed equation?
tvrfan
Posts: 84
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: Unsigned to Signed

Unread post by tvrfan »

I don't see any difference from a look at the changes. What comes next ? (or which bin is it?)

Oh wait.... is DSDRPM signed ? If it is, you should to load it with ldsbw, not ldzbw. ldsbw preserves correct signed value byte->word.

the rest after that could be either - what comes next? the conditional jumps will confirm it....
decipha
Posts: 4953
Joined: 2021 Feb 15, 12:23
Location: Metairie, LA
Vehicle Information: Work Truck
'19 F-150 3.3L

Re: Unsigned to Signed

Unread post by decipha »

GUFX

Nothing comes next, it calls out does the error calc and returns for the look up.

DSDRPM is unsigned as its the commanded idle rpm.

Code: Select all

5cce: 45,b0,02,f4,32    ad3w  R32,Rf4,2b0    temp7l = 9286;                 // FN810 ISCDC RPM Adder
5cd3: ef,98,44          call  a16e           subr_R34_RPMERROR();           // X Input changed to RPM ERROR decipha 23-11-27
5cd6: ef,33,d9          call  360c           IntWdLU_fu32w_in34w_ou38b();

Code: Select all

  subr_R34_RPMERROR:
a16e: af,72,e6,34       ldzbw R34,[R72+e6]   tmp1l = (uns)DSDRPM;
a172: 09,06,34          shlw  R34,6          tmp1l *= 40;
a175: 48,34,ae,34       sb3w  R34,Rae,R34    tmp1l = N_RPM - tmp1l;
a179: f0                ret                  return;
I figured out my problem, I was having a brain fart from having one of my lookups labelled wrong in my directive.

If N_RPM is a lower value than DSDRPM something was preventing r34 from rolling back.

ex: r34== 500 - 800
== -300

It helps when you use the correct lookup.

All good thanks.
Post Reply