OK, you're right, it's a pointer.
So the program goes like this:
Code:
3789 B6 01 93 @34 ldaA l_0193_CoolTmp_fltrd_$f0_max_$e0 ; Load Coolant Temp to A
378C CE 26 91 ldX #$2691 ; Load pointer to 1st prime pulse table to X
378F BD 78 12 call l_7812_lkup2d_nooff_16spc ; Look up 1st prime pulse value from the table
3792 F6 01 8F ldaB L018F ; Load calculated Baro correction (128 - no correction)
3795 3D mul ; multiply
3796 05 lslD ; shift D left and use A (divide by 128)
3797 24 02 bcc @35 ; branch if no overflow
3799 86 FF ldaA #$FF ; if overflowed, load max prime pulse value (256)
379B CE 26 80 @35 ldX #$2680 ; load pointer to Base Prime PW
379E BD 77 81 call l_7781_A*X->D_8x16_Mult_sub ; Multiply 1st prime pulse and Base Prime PW
37A1 1A 83 7D F0 @36 cmpD #$7DF0 ; compare to 0x7DF0 (32240)
37A5 23 03 bls @37 ; branch if lower
37A7 CC 7D F0 ldD #$7DF0 ; if higher, limit the calculated 1st prime pulse to 0x7DF0 (32240)
37AA FD 01 A5 @37 stD L01A5 ; store the calculated 1st Prime Pulse
The same routine is used for 2nd and additional pulses.
The thing is that the Base Prime PW from 0x2680 is 0x6666 in most bins, and is limited in code to 0x7DF0. So when pulse multiplier from the table is >1, it will be already limited?? Something is off here.
I haven't been able to find how to convert the raw values to milliseconds yet.
It's also strange that the Baro correction is applied BEFORE multiplying the base PW, it makes little sense to scale as small values as those ( 2, 3, 4 etc...).
Bookmarks