l_002d ; from tside status byte ;; b2 1 = ENGINE CLOSED LOOP l_002e ; from tside status byte ;; b0 fan 1 ;; b1 fan 2 ;; b67 ShiftAB l_0046 ; fts status byte ;; b2 1 = ENGINE CLOSED LOOP l_012a ;from l_01d3_fts_ADMAP l_0160 ; rpm - 25 rpm/bit 335E 1 ; b2 1 = ENGINE CLOSED LOOP 3364 1 ; 1 = turn fuel off!!! 33B2 1 ; b2 1 = ENGINE CLOSED LOOP 3446 8 ;0000 0001 into init 3448 B ;ram[3:0] = 0000, ram from $0000-$03ff ;; reg[3:0] = 0001, registers from $1000-$105f 344B 8 ;1001 1001 344D B ; ADPU = 1 a/d sys power enabled ;; CSEL = 0 Clock Sel - a/d & eeprom use sys E clock ;; IRQE = 0 IRQ edge - low level sensitive operation ;; DLY = 1 Start UP delay 4000 E clk cycles ;; CME = 1 clock monitor enabled ;; FCME = 0 monitor follows CME state ;; CR[1:0] = 01 Divide E by 2^17 for COP timeout reset 3452 B ;PR[1:0] = 11 Timer prescaler = 16 345E C ; = 85 m0200 - 85 3460 2 ; br if m0200 = 85 3462 8 ; else 0001 0000 Config locked, all eeprom unlocked 3464 C ; = 170 3468 8 ;0001 1011 346A B ;Block Protect Register - CONFIG locked, ;; BPRT0,1,3 locked - what's here? ;; BPRT2 unlocked - what's here? 35EB C ; ??? ;;7FEE db $FF, $FF, $FF, $FE, $ED, $E1, $D7, $CF, $C9, $C3 ;;7FF8 db $BE, $B9, $B5, $B2, $AE, $AB, $A8, $A6, $A3, $A1 366C 8 ; ADMAP - 13 366E C ; 151 3671 8 ; A = (ADMAP-13)*151/256 3673 8 ; 143 3677 8 ; limit to 143 36D8 F ; $56 =86 36DB 3 ; (L012b-L01d6)*86 36DF 0 ; *2 36E2 0 ; *2 36E7 B ; (L012b-L01d6)*344/256 (1.34375) 37C7 B ;$a7 = 85degC 37CA 2 ;br if temp < mintemp 37CC F ; $30 3819 C ;; shortened lkup3d_sub ; A row, B col, X tbl addr, A returned val 381C A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 3820 4 ; ... ELSE 3821 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 3825 5 ; ... ELSE 3826 3 ; XFER TABLE ADDR TO Y REG 3829 3 ; SAVE ROW ADDRESS 382A 8 ; SPLIT COL ARG INTO TABLE OFFSET 382C 3 ; & INTERP PORTION 382D 3 ; SAVE INTERP PORTION TO STACK 384E 3 ; *** end lkup3d, result in A 3A85 F ; $33 3B3C 8 ;vats switch bit 3B3E 2 ;br if vats disabled 3B40 1 ; 1=vats disabled or passed freq test 3B58 1 ; max vats frequency? 3B5E 1 ; min vats freq? 3B64 1 ; 1=vats disabled or passed freq test 3B67 1 ; 1=vats disabled or passed freq test 3B6A 1 ; 1=vats NOT disabled & NOT passed freq test 3B8C 1 ; 1=vats NOT disabled & NOT passed freq test 3CD7 C ;; lkup2d_nooff_16spc 3CD9 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 3CDA 3 ; set aside B 3CDB 1 ; A -> B, (index*16)/256, A stays in A 3CDC 3 ; X=X+(index*16)/256 3CDD E ; load X,X+1 table entry above & below 3CDF 1 ; A-B -> A, get slope*-1 of table 3CE0 3 ; bring back B=remainder 3CE1 2 ;br if table is decreasing 3CE3 4 ;else increasing table 3CE4 3 ; interpolate -1*-slope * delta 3CE5 A ; added interpolated part to initial 3CE7 2 ; done A=result 3CE9 3 ; interpolate -slope * delta 3CEC 4 ; subtract interpolated part to initial 3CED A ; done A=result 3D0C 8 ; ADMAP - 13 3D0E C ; 151 3D11 8 ; A = (ADMAP-13)*151/256 3D13 8 ; 143 3D17 8 ; limit to 143 3E2C F ; lsb of D = (ADMAP-26)*151*2 3E59 F ; D = (ADMAP-26)*151*2 3F1E 3 ; SAVE A A*X->D 8 x 16 Multiply 3F1F E ; LSB OF X with 16 bit result result 3F21 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 3F22 8 ; ROUND same as anht.hac 3F24 3 ; get back multiplier EXcept X is not 3F25 3 ; SAVE PARTIAL PRODUCT preserved. 3F26 A ; GET MSB OF MULTIPLICAND 3F28 3 ; MSB PARTIAL PRODUCT 3F2A E ; ADD IN LSB PARTIAL PROD 3F2C 8 ; ROUND 3F2E 3 ; Result of A*X is left in D 3F43 8 ;tcs switch bit 3F9D C ; bt17_TcsSpkRetVsRPM 3FA0 C ;; lkup2d_nooff_16spc 3FA2 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 3FA3 3 ; set aside B 3FA4 1 ; A -> B, (index*16)/256, A stays in A 3FA5 3 ; X=X+(index*16)/256 3FA6 E ; load X,X+1 table entry above & below 3FA8 1 ; A-B -> A, get slope*-1 of table 3FA9 3 ; bring back B=remainder 3FAA 2 ;br if table is decreasing 3FAC 4 ;else increasing table 3FAD 3 ; interpolate -1*-slope * delta 3FAE A ; added interpolated part to initial 3FB0 2 ; done A=result 3FB2 3 ; interpolate -slope * delta 3FB5 4 ; subtract interpolated part to initial 3FB6 A ; done A=result 3FC0 B ;previous 3FC3 B ; ramp out rate 3FCC 2 ; br if TcsSpkRet=0 3FCE 1 ; else set TcsSpkRetActive 3FD3 1 ; done with it, TcsSpkRetActive=0 401E C ;; lkup2d_nooff_16spc 4020 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4021 3 ; set aside B 4022 1 ; A -> B, (index*16)/256, A stays in A 4023 3 ; X=X+(index*16)/256 4024 E ; load X,X+1 table entry above & below 4026 1 ; A-B -> A, get slope*-1 of table 4027 3 ; bring back B=remainder 4028 2 ;br if table is decreasing 402A 4 ;else increasing table 402B 3 ; interpolate -1*-slope * delta 402C A ; added interpolated part to initial 402E 2 ; done A=result 4030 3 ; interpolate -slope * delta 4033 4 ; subtract interpolated part to initial 4034 A ; done A=result 40E1 C ; bt17_TPSforWotVsRPM(LowCool) 40EC C ; bt17_TPSforWotVsRPM(HighCool) 40F2 C ;; lkup2d_nooff_16spc 40F4 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 40F5 3 ; set aside B 40F6 1 ; A -> B, (index*16)/256, A stays in A 40F7 3 ; X=X+(index*16)/256 40F8 E ; load X,X+1 table entry above & below 40FA 1 ; A-B -> A, get slope*-1 of table 40FB 3 ; bring back B=remainder 40FC 2 ;br if table is decreasing 40FE 4 ;else increasing table 40FF 3 ; interpolate -1*-slope * delta 4100 A ; added interpolated part to initial 4102 2 ; done A=result 4104 3 ; interpolate -slope * delta 4107 4 ; subtract interpolated part to initial 4108 A ; done A=result 4142 C ; bt17_%AFRvsRPMatWOT 4148 8 ; 160 * 25 = 4000 rpm 415C C ;; lkup2d_nooff_16spc 415E 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 415F 3 ; set aside B 4160 1 ; A -> B, (index*16)/256, A stays in A 4161 3 ; X=X+(index*16)/256 4162 E ; load X,X+1 table entry above & below 4164 1 ; A-B -> A, get slope*-1 of table 4165 3 ; bring back B=remainder 4166 2 ;br if table is decreasing 4168 4 ;else increasing table 4169 3 ; interpolate -1*-slope * delta 416A A ; added interpolated part to initial 416C 2 ; done A=result 416E 3 ; interpolate -slope * delta 4171 4 ; subtract interpolated part to initial 4172 A ; done A=result 41BE C ;; lkup2d_nooff_16spc 41C0 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 41C1 3 ; set aside B 41C2 1 ; A -> B, (index*16)/256, A stays in A 41C3 3 ; X=X+(index*16)/256 41C4 E ; load X,X+1 table entry above & below 41C6 1 ; A-B -> A, get slope*-1 of table 41C7 3 ; bring back B=remainder 41C8 2 ;br if table is decreasing 41CA 4 ;else increasing table 41CB 3 ; interpolate -1*-slope * delta 41CC A ; added interpolated part to initial 41CE 2 ; done A=result 41D0 3 ; interpolate -slope * delta 41D3 4 ; subtract interpolated part to initial 41D4 A ; done A=result DFCOMinTPS_vs_RPM 41D6 1 ; 1=DFCO enabled 41E5 B ; old-new = delta rpm 41E8 2 ; br if rpm increasing 41EA B ; $0A 125 rpm/X time 41ED 2 ; br if decreasing less than threshold 41F4 1 ; 1=skip DFCO min Map test 41F8 F ; $22 23 kPa 41FB 1 ; 1=DFCO enabled 41FF F ; $1a 20 kPa 4202 1 ; 1=DFCO enable command 4206 F ; $02 .74 kPa 4212 F ; $23 575 rpm 4215 1 ; 1=DFCO enabled 4219 F ; $35 875 rpm 421C 1 ; 1=DFCO enable command 4220 F ; $04 100 rpm 4239 1 ; 1=DFCO enable command 424B 1 ; 1=DFCO enable command 424E F 2;0166->0167 four loops old 4251 F 3;0165->0166 three loops old 4257 B 2;0164->0165 two loops old 425D B 1;0162->0164 one loop old 4283 1 ; at idle (or closed throttle) status bit 42D2 C ;; lkup2d_nooff_16spc 42D4 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 42D5 3 ; set aside B 42D6 1 ; A -> B, (index*16)/256, A stays in A 42D7 3 ; X=X+(index*16)/256 42D8 E ; load X,X+1 table entry above & below 42DA 1 ; A-B -> A, get slope*-1 of table 42DB 3 ; bring back B=remainder 42DC 2 ;br if table is decreasing 42DE 4 ;else increasing table 42DF 3 ; interpolate -1*-slope * delta 42E0 A ; added interpolated part to initial 42E2 2 ; done A=result 42E4 3 ; interpolate -slope * delta 42E7 4 ; subtract interpolated part to initial 42E8 A ; done A=result 4405 B ; Coef of Var RPM 1/10.24 %/bit 464B 3 ; SAVE A A*X->D 8 x 16 Multiply 464C E ; LSB OF X with 16 bit result result 464E 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 464F 8 ; ROUND same as anht.hac 4651 3 ; get back multiplier EXcept X is not 4652 3 ; SAVE PARTIAL PRODUCT preserved. 4653 A ; GET MSB OF MULTIPLICAND 4655 3 ; MSB PARTIAL PRODUCT 4657 E ; ADD IN LSB PARTIAL PROD 4659 8 ; ROUND 465B 3 ; Result of A*X is left in D 4668 3 ; SAVE A A*X->D 8 x 16 Multiply 4669 E ; LSB OF X with 16 bit result result 466B 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 466C 8 ; ROUND same as anht.hac 466E 3 ; get back multiplier EXcept X is not 466F 3 ; SAVE PARTIAL PRODUCT preserved. 4670 A ; GET MSB OF MULTIPLICAND 4672 3 ; MSB PARTIAL PRODUCT 4674 E ; ADD IN LSB PARTIAL PROD 4676 8 ; ROUND 4678 3 ; Result of A*X is left in D 4685 3 ; SAVE A A*X->D 8 x 16 Multiply 4686 E ; LSB OF X with 16 bit result result 4688 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 4689 8 ; ROUND same as anht.hac 468B 3 ; get back multiplier EXcept X is not 468C 3 ; SAVE PARTIAL PRODUCT preserved. 468D A ; GET MSB OF MULTIPLICAND 468F 3 ; MSB PARTIAL PRODUCT 4691 E ; ADD IN LSB PARTIAL PROD 4693 8 ; ROUND 4695 3 ; Result of A*X is left in D 46A2 3 ; SAVE A A*X->D 8 x 16 Multiply 46A3 E ; LSB OF X with 16 bit result result 46A5 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 46A6 8 ; ROUND same as anht.hac 46A8 3 ; get back multiplier EXcept X is not 46A9 3 ; SAVE PARTIAL PRODUCT preserved. 46AA A ; GET MSB OF MULTIPLICAND 46AC 3 ; MSB PARTIAL PRODUCT 46AE E ; ADD IN LSB PARTIAL PROD 46B0 8 ; ROUND 46B2 3 ; Result of A*X is left in D 46C0 F ;; 16x16mult: ; X*D->D ;; 16 * 16 FIXED POINT MULTIPLY exactly from anht_hac ;; ROUNDING IS FORM LOW ORDER BYTE OF RESULT THE MIDDLE 2 BYTES RETURNED IN A & B REG'S 46C4 3 ; MULTIPLICAND TO STACK 46C5 3 ; LSB OF MULTIPLIER 46C6 3 ; MSB OF MULTIPLIER 46C8 A ; GET LSB OF MULTIPLICAND 46CA 3 ; LSB OF MULT'ER * LSB OF MULT'CND 46CB 8 ; UPPER PART OF BYTE W/ROUNDING 46CD A ; TEMP SAVE LSB OF FINAL RESULT 46CF E ; LSB MULT'ER->A & MSB MULT'CND->B 46D1 3 ; LSB MULT'ER * MSB MULT'ER 46D2 E ; ADD LSB OF RESULT TO TEMP LSB OF FINAL RESULT 46D6 E ; SAVE FOR LATER 46D8 A ; GET MSB OF MULT'ER 46DA E ; GET LSB OF MULT'CND 46DC 3 ; MSB MULTP'ER * LSB MULT'CND 46DD E ; ADD RESULT TO TEPM LSB OF FINAL RESULT 46DF 2 ; jump to end if overflow 46E3 A ; GET MSB OF MULT'ER 46E5 E ; GET MSB OF MULT'CND 46E7 3 ; MSB MULT'ER * MS MULT'CND 46E9 2 ; jump to end if overflow 46F6 3 ; end of 16x16, result in D 4AC7 C ;bt17_2df2_what_f(CoolTmp) 4ACA C ;; lkup2d_nooff_16spc 4ACC 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4ACD 3 ; set aside B 4ACE 1 ; A -> B, (index*16)/256, A stays in A 4ACF 3 ; X=X+(index*16)/256 4AD0 E ; load X,X+1 table entry above & below 4AD2 1 ; A-B -> A, get slope*-1 of table 4AD3 3 ; bring back B=remainder 4AD4 2 ;br if table is decreasing 4AD6 4 ;else increasing table 4AD7 3 ; interpolate -1*-slope * delta 4AD8 A ; added interpolated part to initial 4ADA 2 ; done A=result 4ADC 3 ; interpolate -slope * delta 4ADF 4 ; subtract interpolated part to initial 4AE0 A ; done A=result 4AE7 F ; $10 4AF2 0 ;*16 4AF7 3 ; set aside msb 4AF9 4 ; /256 or put msb-> lsb of D 4AFA F ; 00a9*16/256 = msb(00a9*16) 4AFE F ; lsb (00a9*16) 4C23 C ;; lkup2d_nooff_16spc 4C25 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4C26 3 ; set aside B 4C27 1 ; A -> B, (index*16)/256, A stays in A 4C28 3 ; X=X+(index*16)/256 4C29 E ; load X,X+1 table entry above & below 4C2B 1 ; A-B -> A, get slope*-1 of table 4C2C 3 ; bring back B=remainder 4C2D 2 ;br if table is decreasing 4C2F 4 ;else increasing table 4C30 3 ; interpolate -1*-slope * delta 4C31 A ; added interpolated part to initial 4C33 2 ; done A=result 4C35 3 ; interpolate -slope * delta 4C38 4 ; subtract interpolated part to initial 4C39 A ; done A=result 4C92 C ;; lkup2d_nooff_16spc 4C94 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4C95 3 ; set aside B 4C96 1 ; A -> B, (index*16)/256, A stays in A 4C97 3 ; X=X+(index*16)/256 4C98 E ; load X,X+1 table entry above & below 4C9A 1 ; A-B -> A, get slope*-1 of table 4C9B 3 ; bring back B=remainder 4C9C 2 ;br if table is decreasing 4C9E 4 ;else increasing table 4C9F 3 ; interpolate -1*-slope * delta 4CA0 A ; added interpolated part to initial 4CA2 2 ; done A=result 4CA4 3 ; interpolate -slope * delta 4CA7 4 ; subtract interpolated part to initial 4CA8 A ; done A=result 4CB7 C ;; lkup2d_nooff_16spc 4CB9 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4CBA 3 ; set aside B 4CBB 1 ; A -> B, (index*16)/256, A stays in A 4CBC 3 ; X=X+(index*16)/256 4CBD E ; load X,X+1 table entry above & below 4CBF 1 ; A-B -> A, get slope*-1 of table 4CC0 3 ; bring back B=remainder 4CC1 2 ;br if table is decreasing 4CC3 4 ;else increasing table 4CC4 3 ; interpolate -1*-slope * delta 4CC5 A ; added interpolated part to initial 4CC7 2 ; done A=result 4CC9 3 ; interpolate -slope * delta 4CCC 4 ; subtract interpolated part to initial 4CCD A ; done A=result 4CDB C ;; lkup2d_nooff_16spc 4CDD 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4CDE 3 ; set aside B 4CDF 1 ; A -> B, (index*16)/256, A stays in A 4CE0 3 ; X=X+(index*16)/256 4CE1 E ; load X,X+1 table entry above & below 4CE3 1 ; A-B -> A, get slope*-1 of table 4CE4 3 ; bring back B=remainder 4CE5 2 ;br if table is decreasing 4CE7 4 ;else increasing table 4CE8 3 ; interpolate -1*-slope * delta 4CE9 A ; added interpolated part to initial 4CEB 2 ; done A=result 4CED 3 ; interpolate -slope * delta 4CF0 4 ; subtract interpolated part to initial 4CF1 A ; done A=result 4CFC C ; bt15_%AFRvsCoolantAtWOT 4CFF C ;; lkup2d_nooff_16spc 4D01 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4D02 3 ; set aside B 4D03 1 ; A -> B, (index*16)/256, A stays in A 4D04 3 ; X=X+(index*16)/256 4D05 E ; load X,X+1 table entry above & below 4D07 1 ; A-B -> A, get slope*-1 of table 4D08 3 ; bring back B=remainder 4D09 2 ;br if table is decreasing 4D0B 4 ;else increasing table 4D0C 3 ; interpolate -1*-slope * delta 4D0D A ; added interpolated part to initial 4D0F 2 ; done A=result 4D11 3 ; interpolate -slope * delta 4D14 4 ; subtract interpolated part to initial 4D15 A ; done A=result 4D2E C ;; lkup2d_nooff_16spc 4D30 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4D31 3 ; set aside B 4D32 1 ; A -> B, (index*16)/256, A stays in A 4D33 3 ; X=X+(index*16)/256 4D34 E ; load X,X+1 table entry above & below 4D36 1 ; A-B -> A, get slope*-1 of table 4D37 3 ; bring back B=remainder 4D38 2 ;br if table is decreasing 4D3A 4 ;else increasing table 4D3B 3 ; interpolate -1*-slope * delta 4D3C A ; added interpolated part to initial 4D3E 2 ; done A=result 4D40 3 ; interpolate -slope * delta 4D43 4 ; subtract interpolated part to initial 4D44 A ; done A=result 4D50 C ;; lkup2d_nooff_16spc 4D52 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4D53 3 ; set aside B 4D54 1 ; A -> B, (index*16)/256, A stays in A 4D55 3 ; X=X+(index*16)/256 4D56 E ; load X,X+1 table entry above & below 4D58 1 ; A-B -> A, get slope*-1 of table 4D59 3 ; bring back B=remainder 4D5A 2 ;br if table is decreasing 4D5C 4 ;else increasing table 4D5D 3 ; interpolate -1*-slope * delta 4D5E A ; added interpolated part to initial 4D60 2 ; done A=result 4D62 3 ; interpolate -slope * delta 4D65 4 ; subtract interpolated part to initial 4D66 A ; done A=result 4D78 C ;; lkup2d_nooff_16spc 4D7A 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4D7B 3 ; set aside B 4D7C 1 ; A -> B, (index*16)/256, A stays in A 4D7D 3 ; X=X+(index*16)/256 4D7E E ; load X,X+1 table entry above & below 4D80 1 ; A-B -> A, get slope*-1 of table 4D81 3 ; bring back B=remainder 4D82 2 ;br if table is decreasing 4D84 4 ;else increasing table 4D85 3 ; interpolate -1*-slope * delta 4D86 A ; added interpolated part to initial 4D88 2 ; done A=result 4D8A 3 ; interpolate -slope * delta 4D8D 4 ; subtract interpolated part to initial 4D8E A ; done A=result 4D9F C ;; lkup2d_nooff_16spc 4DA1 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4DA2 3 ; set aside B 4DA3 1 ; A -> B, (index*16)/256, A stays in A 4DA4 3 ; X=X+(index*16)/256 4DA5 E ; load X,X+1 table entry above & below 4DA7 1 ; A-B -> A, get slope*-1 of table 4DA8 3 ; bring back B=remainder 4DA9 2 ;br if table is decreasing 4DAB 4 ;else increasing table 4DAC 3 ; interpolate -1*-slope * delta 4DAD A ; added interpolated part to initial 4DAF 2 ; done A=result 4DB1 3 ; interpolate -slope * delta 4DB4 4 ; subtract interpolated part to initial 4DB5 A ; done A=result 4DCF F ; $56 =86 4DD2 3 ; (L012b-L01d6)*86 4DD6 0 ; *2 4DD9 0 ; *2 4DF7 C ;; lkup2d_nooff_16spc 4DF9 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4DFA 3 ; set aside B 4DFB 1 ; A -> B, (index*16)/256, A stays in A 4DFC 3 ; X=X+(index*16)/256 4DFD E ; load X,X+1 table entry above & below 4DFF 1 ; A-B -> A, get slope*-1 of table 4E00 3 ; bring back B=remainder 4E01 2 ;br if table is decreasing 4E03 4 ;else increasing table 4E04 3 ; interpolate -1*-slope * delta 4E05 A ; added interpolated part to initial 4E07 2 ; done A=result 4E09 3 ; interpolate -slope * delta 4E0C 4 ; subtract interpolated part to initial 4E0D A ; done A=result 4E1B 3 ; SAVE A A*X->D 8 x 16 Multiply 4E1C E ; LSB OF X with 16 bit result result 4E1E 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 4E1F 8 ; ROUND same as anht.hac 4E21 3 ; get back multiplier EXcept X is not 4E22 3 ; SAVE PARTIAL PRODUCT preserved. 4E23 A ; GET MSB OF MULTIPLICAND 4E25 3 ; MSB PARTIAL PRODUCT 4E27 E ; ADD IN LSB PARTIAL PROD 4E29 8 ; ROUND 4E2B 3 ; Result of A*X is left in D 4EA0 C ;; lkup2d_nooff_16spc 4EA2 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4EA3 3 ; set aside B 4EA4 1 ; A -> B, (index*16)/256, A stays in A 4EA5 3 ; X=X+(index*16)/256 4EA6 E ; load X,X+1 table entry above & below 4EA8 1 ; A-B -> A, get slope*-1 of table 4EA9 3 ; bring back B=remainder 4EAA 2 ;br if table is decreasing 4EAC 4 ;else increasing table 4EAD 3 ; interpolate -1*-slope * delta 4EAE A ; added interpolated part to initial 4EB0 2 ; done A=result 4EB2 3 ; interpolate -slope * delta 4EB5 4 ; subtract interpolated part to initial 4EB6 A ; done A=result 4F2E C ;; lkup2d_nooff_16spc 4F30 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4F31 3 ; set aside B 4F32 1 ; A -> B, (index*16)/256, A stays in A 4F33 3 ; X=X+(index*16)/256 4F34 E ; load X,X+1 table entry above & below 4F36 1 ; A-B -> A, get slope*-1 of table 4F37 3 ; bring back B=remainder 4F38 2 ;br if table is decreasing 4F3A 4 ;else increasing table 4F3B 3 ; interpolate -1*-slope * delta 4F3C A ; added interpolated part to initial 4F3E 2 ; done A=result 4F40 3 ; interpolate -slope * delta 4F43 4 ; subtract interpolated part to initial 4F44 A ; done A=result 4F4E C ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 4F51 A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 4F55 4 ; ... ELSE 4F56 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 4F5A 5 ; ... ELSE 4F5B 3 ; XFER TABLE ADDR TO Y REG 4F5E 3 ; SAVE ROW ADDRESS 4F5F 8 ; SPLIT COL ARG INTO TABLE OFFSET 4F61 3 ; & INTERP PORTION 4F62 3 ; SAVE INTERP PORTION TO STACK 4F66 3 ; GET ROW ARG 4F68 C ; SPLIT ROW ARG INTO R 4F6A 3 ; TABLE NUMBER 4F6B 3 ; (MAX RESULT IS 255D) 4F80 4 ; ... else 4F84 2 ;; INTERP Y2, RND DOWN 4F96 4 ; ... else 4F9A 2 ;; Interp Y & round down if nesessary 4FA4 1 ; Y1 - Y2 4FA5 1 ; FRACTION MULT 4FA8 2 ; BR IF D >= 0 4FAA 4 ;ELSE INTERP Y (RND UP IF Req) 4FAF 2 ; TO EXIT ROUTINE ;; INTERP Y, & ROUND DOWN IF NECESSARY 4FB9 3 ; ******end of lkup3d, result in A 4FCF C ;; lkup2d_nooff_16spc 4FD1 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 4FD2 3 ; set aside B 4FD3 1 ; A -> B, (index*16)/256, A stays in A 4FD4 3 ; X=X+(index*16)/256 4FD5 E ; load X,X+1 table entry above & below 4FD7 1 ; A-B -> A, get slope*-1 of table 4FD8 3 ; bring back B=remainder 4FD9 2 ;br if table is decreasing 4FDB 4 ;else increasing table 4FDC 3 ; interpolate -1*-slope * delta 4FDD A ; added interpolated part to initial 4FDF 2 ; done A=result 4FE1 3 ; interpolate -slope * delta 4FE4 4 ; subtract interpolated part to initial 4FE5 A ; done A=result 500F 1 ; b2 1 = ENGINE CLOSED LOOP 5123 F ; $56 =86 5126 3 ; (L012b-L01d6)*86 512A 0 ; *2 512D 0 ; *2 5150 1 ; at idle (or closed throttle) status bit 515A 1 ; at idle (or closed throttle) status bit 515F 1 ; at idle (or closed throttle) status bit 5168 C ;; lkup2d_nooff_16spc 516A 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 516B 3 ; set aside B 516C 1 ; A -> B, (index*16)/256, A stays in A 516D 3 ; X=X+(index*16)/256 516E E ; load X,X+1 table entry above & below 5170 1 ; A-B -> A, get slope*-1 of table 5171 3 ; bring back B=remainder 5172 2 ;br if table is decreasing 5174 4 ;else increasing table 5175 3 ; interpolate -1*-slope * delta 5176 A ; added interpolated part to initial 5178 2 ; done A=result 517A 3 ; interpolate -slope * delta 517D 4 ; subtract interpolated part to initial 517E A ; done A=result 5251 7 ; jump to reti, return from interrupt 5276 7 ; jump to reti, return from interrupt 52A5 7 ; jump to reti, return from interrupt 5322 8 ;speed density switch bit 5441 7 ; jump to reti, return from interrupt 5458 7 ; jump to reti, return from interrupt 54B4 F ; $56 =86 54B7 3 ; (L012b-L01d6)*86 54BB 0 ; *2 54BE 0 ; *2 54D6 C ;; lkup2d_nooff_16spc 54D8 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 54D9 3 ; set aside B 54DA 1 ; A -> B, (index*16)/256, A stays in A 54DB 3 ; X=X+(index*16)/256 54DC E ; load X,X+1 table entry above & below 54DE 1 ; A-B -> A, get slope*-1 of table 54DF 3 ; bring back B=remainder 54E0 2 ;br if table is decreasing 54E2 4 ;else increasing table 54E3 3 ; interpolate -1*-slope * delta 54E4 A ; added interpolated part to initial 54E6 2 ; done A=result 54E8 3 ; interpolate -slope * delta 54EB 4 ; subtract interpolated part to initial 54EC A ; done A=result 54FA 3 ; SAVE A A*X->D 8 x 16 Multiply 54FB E ; LSB OF X with 16 bit result result 54FD 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 54FE 8 ; ROUND same as anht.hac 5500 3 ; get back multiplier EXcept X is not 5501 3 ; SAVE PARTIAL PRODUCT preserved. 5502 A ; GET MSB OF MULTIPLICAND 5504 3 ; MSB PARTIAL PRODUCT 5506 E ; ADD IN LSB PARTIAL PROD 5508 8 ; ROUND 550A 3 ; Result of A*X is left in D 57CD C ; (1536) 57D2 0 ;$0600 / X -> X, remainder -> D 57D3 8 ; X->D 57D4 C ; round off 57D9 8 ;; 982400 / 1536 / 256 = 2.498 57DB B ; 2.5 rpm / bit 57E0 0 ; mult x 2 57E3 C ; limit to $ffff 57E6 8 ; D->X 57E7 C ; $0133->D $133 = 307 57EA 0 ; $0133 / X -> X, remainder -> D 57EB 8 ; X->D 57ED 3 ; push D to stack 57EE C ; D+128 -> D, rounds off A 57F3 8 ; limit to 255, 6375 rpm ;; 307/2 * 256 *25 = 982400 ;; 2950400 / 982400 = 3 ;; 3*4=12 increments / rev on 00a1 ;; rpm=982400/N ;; msec=N*.001693 57F5 B ; 25 rpm / bit 57F9 3 ; get back unlimited rpm 57FA 0 ; *2 57FD C ; round off msb 5802 8 ; limit to 255, 3188 rpm 5804 B ; 12.5 rpm / bit 5809 8 ;why not just ldX...? 580A C ; 123 580D 0 ; D/X -> X, remain -> D 580E 8 ; 123/X -> D, remain -> X 580F C ; D+128 -> D, rounds off A 5814 8 ; 307/2 / 123 * 25 = 31.20 5816 B ; 31.25 rpm / bit 581E 0 ; 15 / X -> X ;; .001693/15/1000 = 581F F ; 180x rate 8.86 Hz/bit ;; ; 2.95 let's say 3 rpm/bit 5825 8 ; speed density switch bit 5858 F ; $56 =86 585B 3 ; A*B -> D (L012b-L01d6)*86 585C C ; round off msb 585F 0 ; *2 5862 0 ; *2 5867 B ; (L012b-L01d6)*344/256 (1.34375) 5884 0 ; D = ADMAP * 256 / 2 5885 C ;44418 5888 0 ; X= ADMAP*128/44418 5889 8 ; D= ADMAP*128/44418 (fraction 0 to 1) 588A 0 ; D= ADMAP*128/44418/2 588B C ; + 2645 5894 8 ; ADMAP - 26 5896 2 ;br if ADMAP > 26 5898 4 ; else min zero 589B 3 ; (ADMAP-26)*151 589C 0 ; * 2 58A1 8 ; round up D to whole msb A ? 58A7 B ; (ADMAP-26)*151*2/256 5950 1 ; 1 = TcsSpkRetActive 5996 3 ; SAVE A A*X->D 8 x 16 Multiply 5997 E ; LSB OF X with 16 bit result result 5999 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 599A 8 ; ROUND same as anht.hac 599C 3 ; get back multiplier EXcept X is not 599D 3 ; SAVE PARTIAL PRODUCT preserved. 599E A ; GET MSB OF MULTIPLICAND 59A0 3 ; MSB PARTIAL PRODUCT 59A2 E ; ADD IN LSB PARTIAL PROD 59A4 8 ; ROUND 59A6 3 ; Result of A*X is left in D 59CD 3 ; SAVE A A*X->D 8 x 16 Multiply 59CE E ; LSB OF X with 16 bit result result 59D0 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 59D1 8 ; ROUND same as anht.hac 59D3 3 ; get back multiplier EXcept X is not 59D4 3 ; SAVE PARTIAL PRODUCT preserved. 59D5 A ; GET MSB OF MULTIPLICAND 59D7 3 ; MSB PARTIAL PRODUCT 59D9 E ; ADD IN LSB PARTIAL PROD 59DB 8 ; ROUND 59DD 3 ; Result of A*X is left in D 5A4C 3 ; SAVE A A*X->D 8 x 16 Multiply 5A4D E ; LSB OF X with 16 bit result result 5A4F 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 5A50 8 ; ROUND same as anht.hac 5A52 3 ; get back multiplier EXcept X is not 5A53 3 ; SAVE PARTIAL PRODUCT preserved. 5A54 A ; GET MSB OF MULTIPLICAND 5A56 3 ; MSB PARTIAL PRODUCT 5A58 E ; ADD IN LSB PARTIAL PROD 5A5A 8 ; ROUND 5A5C 3 ; Result of A*X is left in D 5A83 3 ; SAVE A A*X->D 8 x 16 Multiply 5A84 E ; LSB OF X with 16 bit result result 5A86 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 5A87 8 ; ROUND same as anht.hac 5A89 3 ; get back multiplier EXcept X is not 5A8A 3 ; SAVE PARTIAL PRODUCT preserved. 5A8B A ; GET MSB OF MULTIPLICAND 5A8D 3 ; MSB PARTIAL PRODUCT 5A8F E ; ADD IN LSB PARTIAL PROD 5A91 8 ; ROUND 5A93 3 ; Result of A*X is left in D 5ADE C ;; lkup2d_nooff_16spc 5AE0 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5AE1 3 ; set aside B 5AE2 1 ; A -> B, (index*16)/256, A stays in A 5AE3 3 ; X=X+(index*16)/256 5AE4 E ; load X,X+1 table entry above & below 5AE6 1 ; A-B -> A, get slope*-1 of table 5AE7 3 ; bring back B=remainder 5AE8 2 ;br if table is decreasing 5AEA 4 ;else increasing table 5AEB 3 ; interpolate -1*-slope * delta 5AEC A ; added interpolated part to initial 5AEE 2 ; done A=result 5AF0 3 ; interpolate -slope * delta 5AF3 4 ; subtract interpolated part to initial 5AF4 A ; done A=result 5B75 C ;; lkup2d_nooff_16spc 5B77 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5B78 3 ; set aside B 5B79 1 ; A -> B, (index*16)/256, A stays in A 5B7A 3 ; X=X+(index*16)/256 5B7B E ; load X,X+1 table entry above & below 5B7D 1 ; A-B -> A, get slope*-1 of table 5B7E 3 ; bring back B=remainder 5B7F 2 ;br if table is decreasing 5B81 4 ;else increasing table 5B82 3 ; interpolate -1*-slope * delta 5B83 A ; added interpolated part to initial 5B85 2 ; done A=result 5B87 3 ; interpolate -slope * delta 5B8A 4 ; subtract interpolated part to initial 5B8B A ; done A=result 5B9C C ;; lkup2d_nooff_16spc 5B9E 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5B9F 3 ; set aside B 5BA0 1 ; A -> B, (index*16)/256, A stays in A 5BA1 3 ; X=X+(index*16)/256 5BA2 E ; load X,X+1 table entry above & below 5BA4 1 ; A-B -> A, get slope*-1 of table 5BA5 3 ; bring back B=remainder 5BA6 2 ;br if table is decreasing 5BA8 4 ;else increasing table 5BA9 3 ; interpolate -1*-slope * delta 5BAA A ; added interpolated part to initial 5BAC 2 ; done A=result 5BAE 3 ; interpolate -slope * delta 5BB1 4 ; subtract interpolated part to initial 5BB2 A ; done A=result 5BDF B ; lsb of D = (ADMAP-26)*151*2 5C18 C ;; lkup2d_nooff_16spc 5C1A 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5C1B 3 ; set aside B 5C1C 1 ; A -> B, (index*16)/256, A stays in A 5C1D 3 ; X=X+(index*16)/256 5C1E E ; load X,X+1 table entry above & below 5C20 1 ; A-B -> A, get slope*-1 of table 5C21 3 ; bring back B=remainder 5C22 2 ;br if table is decreasing 5C24 4 ;else increasing table 5C25 3 ; interpolate -1*-slope * delta 5C26 A ; added interpolated part to initial 5C28 2 ; done A=result 5C2A 3 ; interpolate -slope * delta 5C2D 4 ; subtract interpolated part to initial 5C2E A ; done A=result 5C37 C ;; lkup2d_nooff_16spc 5C39 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5C3A 3 ; set aside B 5C3B 1 ; A -> B, (index*16)/256, A stays in A 5C3C 3 ; X=X+(index*16)/256 5C3D E ; load X,X+1 table entry above & below 5C3F 1 ; A-B -> A, get slope*-1 of table 5C40 3 ; bring back B=remainder 5C41 2 ;br if table is decreasing 5C43 4 ;else increasing table 5C44 3 ; interpolate -1*-slope * delta 5C45 A ; added interpolated part to initial 5C47 2 ; done A=result 5C49 3 ; interpolate -slope * delta 5C4C 4 ; subtract interpolated part to initial 5C4D A ; done A=result 5C5B C ;; lkup2d_nooff_16spc 5C5D 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5C5E 3 ; set aside B 5C5F 1 ; A -> B, (index*16)/256, A stays in A 5C60 3 ; X=X+(index*16)/256 5C61 E ; load X,X+1 table entry above & below 5C63 1 ; A-B -> A, get slope*-1 of table 5C64 3 ; bring back B=remainder 5C65 2 ;br if table is decreasing 5C67 4 ;else increasing table 5C68 3 ; interpolate -1*-slope * delta 5C69 A ; added interpolated part to initial 5C6B 2 ; done A=result 5C6D 3 ; interpolate -slope * delta 5C70 4 ; subtract interpolated part to initial 5C71 A ; done A=result 5C86 C ; bt17_MaxSpkRetVsMap 5C89 C ;; lkup2d_nooff_16spc 5C8B 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5C8C 3 ; set aside B 5C8D 1 ; A -> B, (index*16)/256, A stays in A 5C8E 3 ; X=X+(index*16)/256 5C8F E ; load X,X+1 table entry above & below 5C91 1 ; A-B -> A, get slope*-1 of table 5C92 3 ; bring back B=remainder 5C93 2 ;br if table is decreasing 5C95 4 ;else increasing table 5C96 3 ; interpolate -1*-slope * delta 5C97 A ; added interpolated part to initial 5C99 2 ; done A=result 5C9B 3 ; interpolate -slope * delta 5C9E 4 ; subtract interpolated part to initial 5C9F A ; done A=result 5CA6 C ; bt17_MaxRetVsRPM(InWOT) 5CA9 C ;; lkup2d_nooff_16spc 5CAB 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5CAC 3 ; set aside B 5CAD 1 ; A -> B, (index*16)/256, A stays in A 5CAE 3 ; X=X+(index*16)/256 5CAF E ; load X,X+1 table entry above & below 5CB1 1 ; A-B -> A, get slope*-1 of table 5CB2 3 ; bring back B=remainder 5CB3 2 ;br if table is decreasing 5CB5 4 ;else increasing table 5CB6 3 ; interpolate -1*-slope * delta 5CB7 A ; added interpolated part to initial 5CB9 2 ; done A=result 5CBB 3 ; interpolate -slope * delta 5CBE 4 ; subtract interpolated part to initial 5CBF A ; done A=result 5CE3 1 ; at idle (or closed throttle) status bit 5CF1 8 ; limit to 192, 4800 rpm 5CF3 C ; bt13_CloseThrotSpkAdvVSRPM 5CF6 C ;; lkup2d_nooff_16spc Amax=C, 5CF8 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5CF9 3 ; set aside B 5CFA 1 ; A -> B, (index*16)/256, A stays in A 5CFB 3 ; X=X+(index*16)/256 5CFC E ; load X,X+1 table entry above & below 5CFE 1 ; A-B -> A, get slope*-1 of table 5CFF 3 ; bring back B=remainder 5D00 2 ;br if table is decreasing 5D02 4 ;else increasing table 5D03 3 ; interpolate -1*-slope * delta 5D04 A ; added interpolated part to initial 5D06 2 ; done A=result 5D08 3 ; interpolate -slope * delta 5D0B 4 ; subtract interpolated part to initial 5D0C A ; done A=result 5D11 C ;217D bt112_ExtSpkAdvVsRPM&MAP 5D17 8 ;4000 rpm 5D19 2 ; use main table if rpm<4000 5D1B 8 ;7000 5D1F 8 ; limit to 7000 rpm 5D25 2 ; look up spkadv if L00a5=0 5D27 B ; else use existing spdadv 5D2A 7 ; and skip spkadv lkup 5D2D C ;208A bt240_MainSpkAdvVsRPM&MAP 5D33 8 ; -400 rpm 5D38 8 ; 2000 rpm, ie > 2400 rpm 5D3F 8 ; +1600 rpm 5D41 F ;map_variable 26-104 kpa..? ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 5D44 A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 5D48 4 ; ... ELSE 5D49 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 5D4D 5 ; ... ELSE 5D4E 3 ; XFER TABLE ADDR TO Y REG 5D51 3 ; SAVE ROW ADDRESS 5D52 8 ; SPLIT COL ARG INTO TABLE OFFSET 5D54 3 ; & INTERP PORTION 5D55 3 ; SAVE INTERP PORTION TO STACK 5D59 3 ; GET ROW ARG 5D5B C ; SPLIT ROW ARG INTO R 5D5D 3 ; TABLE NUMBER 5D5E 3 ; (MAX RESULT IS 255D) 5D97 1 ; Y1 - Y2 5D98 1 ; FRACTION MULT 5D9B 2 ; BR IF D >= 0 5D9D 4 ;ELSE INTERP Y (RND UP IF Req) 5DAC 3 ; end of lkup3d, result in A 5DAD B ; lkdup_MainSpkAdvVsRPM&MAP ;; OR!!! closed throttle advance 5DB5 1 ; lkdup spkadv -> Y 5DBA 8 ; 4000 rpm 5DBC 2 ; br if rpm<4000, do next lkup 5DBE 9 ; else 5DC2 2 ; do lkup 5DC4 F ;else use old 5DC7 2 ; and skip lkup 5DCF C ; 21f1 bt208?_WarmupSpkAdvVsCoolant&MAP 5DD2 1 ; set aside lkdup MainSpkAdvVsRPM&MAP ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 5DD4 A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 5DD8 4 ; ... ELSE 5DD9 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 5DDD 5 ; ... ELSE 5DDE 3 ; XFER TABLE ADDR TO Y REG 5DE1 3 ; SAVE ROW ADDRESS 5DE2 8 ; SPLIT COL ARG INTO TABLE OFFSET 5DE4 3 ; & INTERP PORTION 5DE5 3 ; SAVE INTERP PORTION TO STACK 5DE9 3 ; GET ROW ARG 5DEB C ; SPLIT ROW ARG INTO R 5DED 3 ; TABLE NUMBER 5DEE 3 ; (MAX RESULT IS 255D) 5E27 1 ; Y1 - Y2 5E28 1 ; FRACTION MULT 5E2B 2 ; BR IF D >= 0 5E2D 4 ;ELSE INTERP Y (RND UP IF Req) 5E3C 3 ; end of lkup3d, result in A 5E3D B ; 21f1 bt208?_WarmupSpkAdvVsCoolant&MAP 5E40 1 ; get back lkdup MainSpkAdvVsRPM&MAP 5E43 1 ; add warmup spkadv to mainspkadv 5E4C F ;$28 (40) 5E50 3 ; spkadv main bias + warmup bias 5E51 1 ; main + warmup spk 5E56 2 ; do lookup if EGR dc != 0 5E58 5 ; else 5E59 7 ; skip lookup 5E62 C ; 2000 rpm 5E66 C ; limit to 2000 rpm 5E68 C ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 5E6B A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 5E6F 4 ; ... ELSE 5E70 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 5E74 5 ; ... ELSE 5E75 3 ; XFER TABLE ADDR TO Y REG 5E78 3 ; SAVE ROW ADDRESS 5E79 8 ; SPLIT COL ARG INTO TABLE OFFSET 5E7B 3 ; & INTERP PORTION 5E7C 3 ; SAVE INTERP PORTION TO STACK 5E80 3 ; GET ROW ARG 5E82 C ; SPLIT ROW ARG INTO R 5E84 3 ; TABLE NUMBER 5E85 3 ; (MAX RESULT IS 255D) 5EBE 1 ; Y1 - Y2 5EBF 1 ; FRACTION MULT 5EC2 2 ; BR IF D >= 0 5EC4 4 ;ELSE INTERP Y (RND UP IF Req) 5ED3 3 ; end of lkup3d, result in A 5ED7 3 ;egrDC*lkup f(vac&rpm)/256 -> A 5EDA F ; previous 5EDD F ; egr spk ramp in rate...? 5EE2 C ; limit to $ff 5EE7 3 ; egrDC*lkup f(vac&rpm)/256 * ramp 5EEA B ; egrDC*lkup f(vac&rpm)/256 * ramp/256 5EEE 1 ; main + warmup spk 5EF0 1 ; Y = main + warmup + egr spk 5EF2 3 ; X = spkadv main bias + warmup bias 5EF3 F ; knock retard (.5 deg/bit) 5EF8 5 ; knock retard / 8 5EFB 3 ; spkadv main bias + warmup bias + retard bias 5EFE 3 ; +L0002 SpkAdvVsCoolant 5F03 3 ; +L0158/2 TcsSpkRet 5F07 3 ; +L0159 5F12 3 ; +L28c3*L01e1/256 ;; retard items X= spkadv main bias + warmup bias +L0002 +L0158/2 +L0159 +L28c3*L01e1/256 5F13 1 ; Y->D D=main + warmup + egr spk ;; D = advance items 5F15 3 ; X = retard items 5F17 A ; D - X -> D = total spk adv 5F19 3 ; X = retard items 5F1A 1 ; 0=aldl mode 4 SpkAdv is an Offset 5F1E F ; else aldl mode 4 SpkAdv is total SpkAdv 5F23 F ; total spk adv + this 5F26 F ; + this 5F29 F ; + this -> D 5F32 B ;$2000 120 rpm=982400/$2000 5F35 2 ; br if rpm>120 5F37 F ;else (if rpm<120) 5F63 C ; bt17_MinSpkAdvVsRPM 5F69 C ;; lkup2d_nooff_16spc 5F6B 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 5F6C 3 ; set aside B 5F6D 1 ; A -> B, (index*16)/256, A stays in A 5F6E 3 ; X=X+(index*16)/256 5F6F E ; load X,X+1 table entry above & below 5F71 1 ; A-B -> A, get slope*-1 of table 5F72 3 ; bring back B=remainder 5F73 2 ;br if table is decreasing 5F75 4 ;else increasing table 5F76 3 ; interpolate -1*-slope * delta 5F77 A ; added interpolated part to initial 5F79 2 ; done A=result 5F7B 3 ; interpolate -slope * delta 5F7E 4 ; subtract interpolated part to initial 5F7F A ; done A=result 5F9C F ; $0510 (1296) 5F9F 0 ; integer 1296/00a1 -> X 5FA0 8 ; -> D 5FA1 0 ; / 2 5FE4 3 ; SAVE A A*X->D 8 x 16 Multiply 5FE5 E ; LSB OF X with 16 bit result result 5FE7 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 5FE8 8 ; ROUND same as anht.hac 5FEA 3 ; get back multiplier EXcept X is not 5FEB 3 ; SAVE PARTIAL PRODUCT preserved. 5FEC A ; GET MSB OF MULTIPLICAND 5FEE 3 ; MSB PARTIAL PRODUCT 5FF0 E ; ADD IN LSB PARTIAL PROD 5FF2 8 ; ROUND 5FF4 3 ; Result of A*X is left in D 6047 C ;; shortned lkup3d ; A row, B col, X tbl addr, A returned val 604A A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 604E 4 ; ... ELSE 604F E ; CALC COL ARG OFFSET, (LIMITED TO 0) 6053 5 ; ... ELSE 6054 3 ; XFER TABLE ADDR TO Y REG 6057 3 ; SAVE ROW ADDRESS 6058 8 ; SPLIT COL ARG INTO TABLE OFFSET 605A 3 ; & INTERP PORTION 605B 3 ; SAVE INTERP PORTION TO STACK 607C 3 ; *** end lkup3d, result in A 6086 C ;; shortened lkup3d ; A row, B col, X tbl addr, A returned val 6089 A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 608D 4 ; ... ELSE 608E E ; CALC COL ARG OFFSET, (LIMITED TO 0) 6092 5 ; ... ELSE 6093 3 ; XFER TABLE ADDR TO Y REG 6096 3 ; SAVE ROW ADDRESS 6097 8 ; SPLIT COL ARG INTO TABLE OFFSET 6099 3 ; & INTERP PORTION 609A 3 ; SAVE INTERP PORTION TO STACK 60BB 3 ; *** end lkup3d, result in A 60DF C ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 60E2 A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 60E6 4 ; ... ELSE 60E7 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 60EB 5 ; ... ELSE 60EC 3 ; XFER TABLE ADDR TO Y REG 60EF 3 ; SAVE ROW ADDRESS 60F0 8 ; SPLIT COL ARG INTO TABLE OFFSET 60F2 3 ; & INTERP PORTION 60F3 3 ; SAVE INTERP PORTION TO STACK 60F7 3 ; GET ROW ARG 60F9 C ; SPLIT ROW ARG INTO R 60FB 3 ; TABLE NUMBER 60FC 3 ; (MAX RESULT IS 255D) 6135 1 ; Y1 - Y2 6136 1 ; FRACTION MULT 6139 2 ; BR IF D >= 0 613B 4 ;ELSE INTERP Y (RND UP IF Req) 614A 3 ; end of lkup3d, result in A 6166 1 ; 1 = ENGINE CLOSED LOOP 6196 8 ; what switch bit 6254 B ; SAVE A A*X->D 8 x 16 Multiply 6257 E ; LSB OF X with 16 bit result result 6259 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 625A 8 ; ROUND same as anht.hac 625C F ; get back multiplier EXcept X is not 625F 3 ; SAVE PARTIAL PRODUCT preserved. 6260 A ; GET MSB OF MULTIPLICAND 6262 3 ; MSB PARTIAL PRODUCT this instance 6263 3 ; loads A directly 6264 E ; ADD IN LSB PARTIAL PROD 6266 8 ; ROUND 6268 3 ; Result of A*X is left in D 6270 F ; store to send to t side for aldl data 6277 D ;; 16x16mult: ; X*D->D ;; 16 * 16 FIXED POINT MULTIPLY exactly from anht_hac ;; ROUNDING IS FORM LOW ORDER BYTE OF RESULT THE MIDDLE 2 BYTES RETURNED IN A & B REG'S 627A 3 ; MULTIPLICAND TO STACK 627B 3 ; LSB OF MULTIPLIER 627C 3 ; MSB OF MULTIPLIER 627E A ; GET LSB OF MULTIPLICAND 6280 3 ; LSB OF MULT'ER * LSB OF MULT'CND 6281 8 ; UPPER PART OF BYTE W/ROUNDING 6283 A ; TEMP SAVE LSB OF FINAL RESULT 6285 E ; LSB MULT'ER->A & MSB MULT'CND->B 6287 3 ; LSB MULT'ER * MSB MULT'ER 6288 E ; ADD LSB OF RESULT TO TEMP LSB OF FINAL RESULT 628C E ; SAVE FOR LATER 628E A ; GET MSB OF MULT'ER 6290 E ; GET LSB OF MULT'CND 6292 3 ; MSB MULTP'ER * LSB MULT'CND 6293 E ; ADD RESULT TO TEPM LSB OF FINAL RESULT 6295 2 ; jump to end if overflow 6299 A ; GET MSB OF MULT'ER 629B E ; GET MSB OF MULT'CND 629D 3 ; MSB MULT'ER * MS MULT'CND 629F 2 ; jump to end if overflow 62AC 3 ; end of 16x16, result in D 62DB D ;; same as t-side l_ec82_filter_sub ;; Computes NEW = ( Q*(New-Old) + Old ) * (1+Q) ;; where Q is a 8 bit fraction (00.xx) ;; Called with: ;; D = New Value to be filtered ;; X = Addr of Old Filtered Value ;; Y = Addr of Coeff Q ;; Returns: ;; D = Result filtered value ;; X = preserved 62DE 3 ; SP -> X point to where Old got put 62DF A ; D - m(X:X+1) -> D D=Delt=New-Old 62E1 3 ;set aside B (lsb of Delt) 62E2 1 ; mY -> B Coeff 62E5 2 ; branch if carry set from D-m(X:X+1) 62E7 3 ;else A * B -> D D = DelQ = Deltmsb * Q 62EA 3 ; A * B -> D D = DelQ = Deltmsb * Q 62EB 1 ; A - mY -> A DelQmsb - Q -> DelQmsb 62EE E ; D + mX:X+1 -> D DelQ+Old 62F0 E ; A->mX, B->mX+1 DelQ+Old -> spot on stack where Old got put earlier 62F2 3 ; stack -> A (DelQ+Old)msb 62F3 1 ; mY -> B Q 62F6 3 ; A * B -> D (DelQ+Old)msb * Q -> D 62F7 A ; A + mX+1 + C -> (DelQ+Old)lsb + lsb((DelQ+Old)msb * Q) 62F9 1 ; -> B lsb of D 62FA A ; mX -> A (DelQ+Old)msb + msb((DelQ+Old)msb * Q) 62FC 8 ; A + $00 + C -> A msb of D 62FE 3 ; preserve original X 6379 1 ; br if set, use Ve & ExtVe tables 637D B ; else, use a VE f(what & what) 638F 8 ; 2000 rpm 6393 C ; 2bee bt153_VEvsRPM&MAP 6396 8 ; -400 rpm 639A 4 ; limit to $00 639D C ; 2c8a bt289_ExtVEvsRPM&MAP 63A3 8 ; offset by -2000 rpm 63A5 8 ; rpm-2000 - 2000 63A7 2 ; br if rpm>4000 63A9 4 ; convert to 12.5 rpm/bit 63B0 2 ; do lkup if 00a5=4 63B2 7 ; else skip it 63B8 8 ; offset by +1000 rpm 63BC 8 ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val ;; 2bee bt153_VEvsRPM&MAP % = byte*0.390625 ;; 2c8a bt289_ExtVEvsRPM&MAP % = byte*0.390625 63BE A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 63C2 4 ; ... ELSE 63C3 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 63C7 5 ; ... ELSE 63C8 3 ; XFER TABLE ADDR TO Y REG 63CB 3 ; SAVE ROW ADDRESS 63CC 8 ; SPLIT COL ARG INTO TABLE OFFSET 63CE 3 ; & INTERP PORTION 63CF 3 ; SAVE INTERP PORTION TO STACK 63D3 3 ; GET ROW ARG 63D5 C ; SPLIT ROW ARG INTO R 63D7 3 ; TABLE NUMBER 63D8 3 ; (MAX RESULT IS 255D) 6411 1 ; Y1 - Y2 6412 1 ; FRACTION MULT 6415 2 ; BR IF D >= 0 6417 4 ;ELSE INTERP Y (RND UP IF Req) 6426 3 ; end of lkup3d, result in A 643D 3 ; Save X, get back after Multiply 6442 3 ; SAVE A A*X->D 8 x 16 Multiply 6443 E ; LSB OF X with 16 bit result result 6445 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6446 8 ; ROUND same as anht.hac 6448 3 ; get back multiplier EXcept X is not 6449 3 ; SAVE PARTIAL PRODUCT preserved. 644A A ; GET MSB OF MULTIPLICAND 644C 3 ; MSB PARTIAL PRODUCT 644E E ; ADD IN LSB PARTIAL PROD 6450 8 ; ROUND 6452 3 ; Result of A*X is left in D 6453 3 ; get back X saved before multiply 6462 3 ; SAVE A A*X->D 8 x 16 Multiply 6463 E ; LSB OF X with 16 bit result result 6465 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6466 8 ; ROUND same as anht.hac 6468 3 ; get back multiplier EXcept X is not 6469 3 ; SAVE PARTIAL PRODUCT preserved. 646A A ; GET MSB OF MULTIPLICAND 646C 3 ; MSB PARTIAL PRODUCT 646E E ; ADD IN LSB PARTIAL PROD 6470 8 ; ROUND 6472 3 ; Result of A*X is left in D 64AA 2 ; br to turn off fuel 64B4 2 ; br to turn off fuel 64C0 C ;; lkup2d_nooff_16spc 64C2 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 64C3 3 ; set aside B 64C4 1 ; A -> B, (index*16)/256, A stays in A 64C5 3 ; X=X+(index*16)/256 64C6 E ; load X,X+1 table entry above & below 64C8 1 ; A-B -> A, get slope*-1 of table 64C9 3 ; bring back B=remainder 64CA 2 ;br if table is decreasing 64CC 4 ;else increasing table 64CD 3 ; interpolate -1*-slope * delta 64CE A ; added interpolated part to initial 64D0 2 ; done A=result 64D2 3 ; interpolate -slope * delta 64D5 4 ; subtract interpolated part to initial 64D6 A ; done A=result DFCOMinTPS_vs_RPM 64E4 1 ; 1=DFCO enable command 64E8 1 ; 1=DFCO enabled 64EC 7 ;br to turn off fuel 64F2 B ; $10 6501 1 ; 1=DFCO enabled 6504 2 ;br to turn off fuel 6506 1 ; 1=DFCO enabled 650F C ;; lkup2d_nooff_16spc 6511 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6512 3 ; set aside B 6513 1 ; A -> B, (index*16)/256, A stays in A 6514 3 ; X=X+(index*16)/256 6515 E ; load X,X+1 table entry above & below 6517 1 ; A-B -> A, get slope*-1 of table 6518 3 ; bring back B=remainder 6519 2 ;br if table is decreasing 651B 4 ;else increasing table 651C 3 ; interpolate -1*-slope * delta 651D A ; added interpolated part to initial 651F 2 ; done A=result 6521 3 ; interpolate -slope * delta 6524 4 ; subtract interpolated part to initial 6525 A ; done A=result 6532 1 ; 1=vats disabled or passed freq test 653C 2 ;br to turn off fuel 653E 1 ; 1 = turn fuel off!!! 6542 F ; $5555 44 rpm? 6545 1 ; 1=rpm>min_crank_rpm_to_fuel 6549 F ; $6DB7 22 rpm? 654E 2 ; br if rpm>threshold 6550 1 ; 1=rpm>min_crank_rpm_to_fuel 6559 2 ;br to turn off fuel 656A 1 ; 1=rpm>min_crank_rpm_to_fuel 6579 C ; turn fuel off, set base fuel mass = 0 658B 8 ;what switch bit 658D 2 ; if switch bit is set, do lookups 658F 7 ;else (if bit clr) skip what f(cooltmp,load) lookups 6595 8 ; 4000 rpm 6597 2 ; br if RPM<4000 6599 9 ;else 659D 2 ; maybe skip lookup of what f(cooltmp,load) wallwetting? 65A7 C ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val 65AA A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 65AE 4 ; ... ELSE 65AF E ; CALC COL ARG OFFSET, (LIMITED TO 0) 65B3 5 ; ... ELSE 65B4 3 ; XFER TABLE ADDR TO Y REG 65B7 3 ; SAVE ROW ADDRESS 65B8 8 ; SPLIT COL ARG INTO TABLE OFFSET 65BA 3 ; & INTERP PORTION 65BB 3 ; SAVE INTERP PORTION TO STACK 65BF 3 ; GET ROW ARG 65C1 C ; SPLIT ROW ARG INTO R 65C3 3 ; TABLE NUMBER 65C4 3 ; (MAX RESULT IS 255D) 65FD 1 ; Y1 - Y2 65FE 1 ; FRACTION MULT 6601 2 ; BR IF D >= 0 6603 4 ;ELSE INTERP Y (RND UP IF Req) 6612 3 ; end of lkup3d, result in A 6618 8 ;4000 rpm 661A 2 ; br if RPM<4000 661C 9 ;else 6620 2 ; maybe skip lookup of what f(cooltmp,load) 6625 F ; (ADMAP-26)*151*2/256 6628 5 ;*2 6629 5 ;*2 662A C ;B=(ADMAP-26)*151*2/256*4 ;; lkup3d_sub: ; A row, B col, X tbl addr, A returned val ;; INPUTs 1. R min value, (Rows) 2. Q min value, (Col's) ;; 3. RNUM, number of Q Vals, (col's) in each R table ;; 4. Thr 1st R table, R num entries in length 662D A ; CALC ROW ARG OFFSET, (LIMITED TO 0) 6631 4 ; ... ELSE 6632 E ; CALC COL ARG OFFSET, (LIMITED TO 0) 6636 5 ; ... ELSE 6637 3 ; XFER TABLE ADDR TO Y REG 663A 3 ; SAVE ROW ADDRESS 663B 8 ; SPLIT COL ARG INTO TABLE OFFSET 663D 3 ; & INTERP PORTION 663E 3 ; SAVE INTERP PORTION TO STACK 6642 3 ; GET ROW ARG 6644 C ; SPLIT ROW ARG INTO R 6646 3 ; TABLE NUMBER 6647 3 ; (MAX RESULT IS 255D) 6680 1 ; Y1 - Y2 6681 1 ; FRACTION MULT 6684 2 ; BR IF D >= 0 6686 4 ;ELSE INTERP Y (RND UP IF Req) 6695 3 ; end 3dlkup, result in A 66D1 C ;max limit to $04ff 66DA 3 ; D=index, set aside B 66DB 1 ; A -> B, msb index, (index/256), A stays in A 66DC C ; 66DF 3 ; X=X+(index)/256 66E0 A ; load table value f(msb L0100) 66E2 3 ; B, lsb index, 66E3 C ; 66E6 3 ; X=X+(index)/256 66E7 E ; load table value f(lsb L0100) 66E9 3 ; A*B -> D 6726 3 ; SAVE A A*X->D 8 x 16 Multiply 6727 E ; LSB OF X with 16 bit result result 6729 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 672A 8 ; ROUND same as anht.hac 672C 3 ; get back multiplier EXcept X is not 672D 3 ; SAVE PARTIAL PRODUCT preserved. 672E A ; GET MSB OF MULTIPLICAND 6730 3 ; MSB PARTIAL PRODUCT 6732 E ; ADD IN LSB PARTIAL PROD 6734 8 ; ROUND 6736 3 ; Result of A*X is left in D 675A 2 ; br if L00c0=0 675C 2 ; else 675F B ; $01A8 6767 F ; $01A8 minimum fuel mass? pw? 6773 3 ; SAVE A A*X->D 8 x 16 Multiply 6774 E ; LSB OF X with 16 bit result result 6776 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6777 8 ; ROUND same as anht.hac 6779 3 ; get back multiplier EXcept X is not 677A 3 ; SAVE PARTIAL PRODUCT preserved. 677B A ; GET MSB OF MULTIPLICAND 677D 3 ; MSB PARTIAL PRODUCT 677F E ; ADD IN LSB PARTIAL PROD 6781 8 ; ROUND 6783 3 ; Result of A*X is left in D 67A9 1 ; 1 = BaseFuelMass=0 OR rpm>7188 67AE 2 ; if L00c2 != 0, continue 67B0 7 ; else goto set bpws to zero 67B5 1 ; 1 = rpm>7188 67B9 8 ; 7188 rpm 67BE 2 ;br if rpm < 7188 67C0 7 ; else goto set bpws to zero 67C3 1 ; 1 = rpm>7188 67C8 F ; $0282 3.874317E-02 lb/hr /bit ;; = .004768134 gm/sec /bit 67CB 0 ; D/X -> X integer divide: D is larger than X 67CC 3 ; hold quotient, remainder still in D 67D0 0 ; D/X -> X fractional divide: D is smaller than X 67D1 8 ; D/X ->D, remainder in X 67D2 1 ; A->B, lose lsb of D/X, keep only msb 67D3 3 ; get back msb of idiv 67D4 4 ; set Z bit if zero 67D5 3 ; get back lsb of idiv 67D6 2 ; br if msb was zero 67D8 C ; if not, (L00c2/K) was more than 255 67DB D ; D contained A=(L00c2/K)lsbmax255 B=L00c2/K remainder msb 67E0 C ; D contained A=(L00c2/K)lsbmax255 B=L00c2/K remainder msb 67E3 3 ; SAVE A A*X->D 8 x 16 Multiply 67E4 E ; LSB OF X with 16 bit result result 67E6 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 67E7 8 ; ROUND same as anht.hac 67E9 3 ; get back multiplier EXcept X is not 67EA 3 ; SAVE PARTIAL PRODUCT preserved. 67EB A ; GET MSB OF MULTIPLICAND 67ED 3 ; MSB PARTIAL PRODUCT 67EF E ; ADD IN LSB PARTIAL PROD 67F1 8 ; ROUND 67F3 3 ; Result of A*X is left in D 67FC 3 ; SAVE A A*X->D 8 x 16 Multiply 67FD E ; LSB OF X with 16 bit result result 67FF 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6800 8 ; ROUND same as anht.hac 6802 3 ; get back multiplier EXcept X is not 6803 3 ; SAVE PARTIAL PRODUCT preserved. 6804 A ; GET MSB OF MULTIPLICAND 6806 3 ; MSB PARTIAL PRODUCT 6808 E ; ADD IN LSB PARTIAL PROD 680A 8 ; ROUND 680C 3 ; Result of A*X is left in D 6848 B ;$005c 1.4 msec 684D F ;limit to $005c 92/65.36 = 1.4 msec 6874 B ;$005c 1.4 msec 6879 F ;limit to $005c 92/65.36 = 1.4 msec 688A 1 ; bt8_CylBal(AtIdle) 688E 1 ; at idle (or closed throttle) status bit 6892 1 ; bt8_CylBal(OffIdle) 689C 3 ; SAVE A A*X->D 8 x 16 Multiply 689D E ; LSB OF X with 16 bit result result 689F 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 68A0 8 ; ROUND same as anht.hac 68A2 3 ; get back multiplier EXcept X is not 68A3 3 ; SAVE PARTIAL PRODUCT preserved. 68A4 A ; GET MSB OF MULTIPLICAND 68A6 3 ; MSB PARTIAL PRODUCT 68A8 E ; ADD IN LSB PARTIAL PROD 68AA 8 ; ROUND 68AC 3 ; Result of A*X is left in D 68BB 3 ; SAVE A A*X->D 8 x 16 Multiply 68BC E ; LSB OF X with 16 bit result result 68BE 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 68BF 8 ; ROUND same as anht.hac 68C1 3 ; get back multiplier EXcept X is not 68C2 3 ; SAVE PARTIAL PRODUCT preserved. 68C3 A ; GET MSB OF MULTIPLICAND 68C5 3 ; MSB PARTIAL PRODUCT 68C7 E ; ADD IN LSB PARTIAL PROD 68C9 8 ; ROUND 68CB 3 ; Result of A*X is left in D 68DA 3 ; SAVE A A*X->D 8 x 16 Multiply 68DB E ; LSB OF X with 16 bit result result 68DD 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 68DE 8 ; ROUND same as anht.hac 68E0 3 ; get back multiplier EXcept X is not 68E1 3 ; SAVE PARTIAL PRODUCT preserved. 68E2 A ; GET MSB OF MULTIPLICAND 68E4 3 ; MSB PARTIAL PRODUCT 68E6 E ; ADD IN LSB PARTIAL PROD 68E8 8 ; ROUND 68EA 3 ; Result of A*X is left in D 68F9 3 ; SAVE A A*X->D 8 x 16 Multiply 68FA E ; LSB OF X with 16 bit result result 68FC 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 68FD 8 ; ROUND same as anht.hac 68FF 3 ; get back multiplier EXcept X is not 6900 3 ; SAVE PARTIAL PRODUCT preserved. 6901 A ; GET MSB OF MULTIPLICAND 6903 3 ; MSB PARTIAL PRODUCT 6905 E ; ADD IN LSB PARTIAL PROD 6907 8 ; ROUND 6909 3 ; Result of A*X is left in D 6918 3 ; SAVE A A*X->D 8 x 16 Multiply 6919 E ; LSB OF X with 16 bit result result 691B 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 691C 8 ; ROUND same as anht.hac 691E 3 ; get back multiplier EXcept X is not 691F 3 ; SAVE PARTIAL PRODUCT preserved. 6920 A ; GET MSB OF MULTIPLICAND 6922 3 ; MSB PARTIAL PRODUCT 6924 E ; ADD IN LSB PARTIAL PROD 6926 8 ; ROUND 6928 3 ; Result of A*X is left in D 6937 3 ; SAVE A A*X->D 8 x 16 Multiply 6938 E ; LSB OF X with 16 bit result result 693A 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 693B 8 ; ROUND same as anht.hac 693D 3 ; get back multiplier EXcept X is not 693E 3 ; SAVE PARTIAL PRODUCT preserved. 693F A ; GET MSB OF MULTIPLICAND 6941 3 ; MSB PARTIAL PRODUCT 6943 E ; ADD IN LSB PARTIAL PROD 6945 8 ; ROUND 6947 3 ; Result of A*X is left in D 6956 3 ; SAVE A A*X->D 8 x 16 Multiply 6957 E ; LSB OF X with 16 bit result result 6959 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 695A 8 ; ROUND same as anht.hac 695C 3 ; get back multiplier EXcept X is not 695D 3 ; SAVE PARTIAL PRODUCT preserved. 695E A ; GET MSB OF MULTIPLICAND 6960 3 ; MSB PARTIAL PRODUCT 6962 E ; ADD IN LSB PARTIAL PROD 6964 8 ; ROUND 6966 3 ; Result of A*X is left in D 6975 3 ; SAVE A A*X->D 8 x 16 Multiply 6976 E ; LSB OF X with 16 bit result result 6978 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6979 8 ; ROUND same as anht.hac 697B 3 ; get back multiplier EXcept X is not 697C 3 ; SAVE PARTIAL PRODUCT preserved. 697D A ; GET MSB OF MULTIPLICAND 697F 3 ; MSB PARTIAL PRODUCT 6981 E ; ADD IN LSB PARTIAL PROD 6983 8 ; ROUND 6985 3 ; Result of A*X is left in D 69A7 B ;$005c 1.4 msec 69AC F ;limit to $005c 92/65.36 = 1.4 msec 69CD B ;$005c 1.4 msec 69D2 F ;limit to $005c 92/65.36 = 1.4 msec 69F3 B ;$005c 1.4 msec 69F8 F ;limit to $005c 92/65.36 = 1.4 msec 6A19 B ;$005c 1.4 msec 6A1E F ;limit to $005c 92/65.36 = 1.4 msec 6A3F B ;$005c 1.4 msec 6A44 F ;limit to $005c 92/65.36 = 1.4 msec 6A65 B ;$005c 1.4 msec 6A6A F ;limit to $005c 92/65.36 = 1.4 msec 6A8B B ;$005c 1.4 msec 6A90 F ;limit to $005c 92/65.36 = 1.4 msec 6AB1 B ;$005c 1.4 msec 6AB6 F ;limit to $005c 92/65.36 = 1.4 msec 6AC3 1 ;;6BC9 wt8_6bc9_bpw_addr_table2: ;;6BC9 dw L00E6, L00E8, L00EA, L00EC, L00EE ;;6BD3 dw L00F0, L00F2, L00F4 6AD3 1 ; 1 = rpm>7188 6AD6 1 ; 1 = BaseFuelMass=0 OR rpm>7188 6B04 C ;;6BA9 wt16_6ba9_bpw_addr_table1: ;;6BA9 dw L142C, L158C, L142E, L158E, L1420 ;;6BB3 dw L1580, L1422, L1582, L1424, L1584 ;;6BBD dw L1426, L1586, L1428, L1588, L142A ;;6BC7 dw L158A 6B32 1 ; 1 = BaseFuelMass=0 6BDF 7 ; jump to reti, return from interrupt 6C1F 7 ; jump to reti, return from interrupt 6C30 C ;; lkup2d_nooff_16spc 6C32 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6C33 3 ; set aside B 6C34 1 ; A -> B, (index*16)/256, A stays in A 6C35 3 ; X=X+(index*16)/256 6C36 E ; load X,X+1 table entry above & below 6C38 1 ; A-B -> A, get slope*-1 of table 6C39 3 ; bring back B=remainder 6C3A 2 ;br if table is decreasing 6C3C 4 ;else increasing table 6C3D 3 ; interpolate -1*-slope * delta 6C3E A ; added interpolated part to initial 6C40 2 ; done A=result 6C42 3 ; interpolate -slope * delta 6C45 4 ; subtract interpolated part to initial 6C46 A ; done A=result 6C55 C ;; lkup2d_nooff_16spc 6C57 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6C58 3 ; set aside B 6C59 1 ; A -> B, (index*16)/256, A stays in A 6C5A 3 ; X=X+(index*16)/256 6C5B E ; load X,X+1 table entry above & below 6C5D 1 ; A-B -> A, get slope*-1 of table 6C5E 3 ; bring back B=remainder 6C5F 2 ;br if table is decreasing 6C61 4 ;else increasing table 6C62 3 ; interpolate -1*-slope * delta 6C63 A ; added interpolated part to initial 6C65 2 ; done A=result 6C67 3 ; interpolate -slope * delta 6C6A 4 ; subtract interpolated part to initial 6C6B A ; done A=result 6C86 C ;; lkup2d_nooff_16spc 6C88 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6C89 3 ; set aside B 6C8A 1 ; A -> B, (index*16)/256, A stays in A 6C8B 3 ; X=X+(index*16)/256 6C8C E ; load X,X+1 table entry above & below 6C8E 1 ; A-B -> A, get slope*-1 of table 6C8F 3 ; bring back B=remainder 6C90 2 ;br if table is decreasing 6C92 4 ;else increasing table 6C93 3 ; interpolate -1*-slope * delta 6C94 A ; added interpolated part to initial 6C96 2 ; done A=result 6C98 3 ; interpolate -slope * delta 6C9B 4 ; subtract interpolated part to initial 6C9C A ; done A=result 6CA1 3 ; SAVE A A*X->D 8 x 16 Multiply 6CA2 E ; LSB OF X with 16 bit result result 6CA4 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6CA5 8 ; ROUND same as anht.hac 6CA7 3 ; get back multiplier EXcept X is not 6CA8 3 ; SAVE PARTIAL PRODUCT preserved. 6CA9 A ; GET MSB OF MULTIPLICAND 6CAB 3 ; MSB PARTIAL PRODUCT 6CAD E ; ADD IN LSB PARTIAL PROD 6CAF 8 ; ROUND 6CB1 3 ; Result of A*X is left in D 6CB4 7 ; jump to reti, return from interrupt 6CC7 C ;; lkup2d_nooff_16spc 6CC9 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6CCA 3 ; set aside B 6CCB 1 ; A -> B, (index*16)/256, A stays in A 6CCC 3 ; X=X+(index*16)/256 6CCD E ; load X,X+1 table entry above & below 6CCF 1 ; A-B -> A, get slope*-1 of table 6CD0 3 ; bring back B=remainder 6CD1 2 ;br if table is decreasing 6CD3 4 ;else increasing table 6CD4 3 ; interpolate -1*-slope * delta 6CD5 A ; added interpolated part to initial 6CD7 2 ; done A=result 6CD9 3 ; interpolate -slope * delta 6CDC 4 ; subtract interpolated part to initial 6CDD A ; done A=result 6D05 3 ; SAVE A A*X->D 8 x 16 Multiply 6D06 E ; LSB OF X with 16 bit result result 6D08 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 6D09 8 ; ROUND same as anht.hac 6D0B 3 ; get back multiplier EXcept X is not 6D0C 3 ; SAVE PARTIAL PRODUCT preserved. 6D0D A ; GET MSB OF MULTIPLICAND 6D0F 3 ; MSB PARTIAL PRODUCT 6D11 E ; ADD IN LSB PARTIAL PROD 6D13 8 ; ROUND 6D15 3 ; Result of A*X is left in D 6D18 7 ; jump to reti, return from interrupt 6D25 C ;; lkup2d_nooff_16spc 6D27 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6D28 3 ; set aside B 6D29 1 ; A -> B, (index*16)/256, A stays in A 6D2A 3 ; X=X+(index*16)/256 6D2B E ; load X,X+1 table entry above & below 6D2D 1 ; A-B -> A, get slope*-1 of table 6D2E 3 ; bring back B=remainder 6D2F 2 ;br if table is decreasing 6D31 4 ;else increasing table 6D32 3 ; interpolate -1*-slope * delta 6D33 A ; added interpolated part to initial 6D35 2 ; done A=result 6D37 3 ; interpolate -slope * delta 6D3A 4 ; subtract interpolated part to initial 6D3B A ; done A=result 6D42 7 ; jump to reti, return from interrupt 6D53 C ;; lkup2d_nooff_16spc 6D55 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6D56 3 ; set aside B 6D57 1 ; A -> B, (index*16)/256, A stays in A 6D58 3 ; X=X+(index*16)/256 6D59 E ; load X,X+1 table entry above & below 6D5B 1 ; A-B -> A, get slope*-1 of table 6D5C 3 ; bring back B=remainder 6D5D 2 ;br if table is decreasing 6D5F 4 ;else increasing table 6D60 3 ; interpolate -1*-slope * delta 6D61 A ; added interpolated part to initial 6D63 2 ; done A=result 6D65 3 ; interpolate -slope * delta 6D68 4 ; subtract interpolated part to initial 6D69 A ; done A=result 6D84 C ;; lkup2d_nooff_16spc 6D86 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6D87 3 ; set aside B 6D88 1 ; A -> B, (index*16)/256, A stays in A 6D89 3 ; X=X+(index*16)/256 6D8A E ; load X,X+1 table entry above & below 6D8C 1 ; A-B -> A, get slope*-1 of table 6D8D 3 ; bring back B=remainder 6D8E 2 ;br if table is decreasing 6D90 4 ;else increasing table 6D91 3 ; interpolate -1*-slope * delta 6D92 A ; added interpolated part to initial 6D94 2 ; done A=result 6D96 3 ; interpolate -slope * delta 6D99 4 ; subtract interpolated part to initial 6D9A A ; done A=result 6DB5 7 ; jump to reti, return from interrupt 6DC6 7 ; jump to reti, return from interrupt 6E51 2 ; jump to reti, return from interrupt 6E59 C ;; lkup2d_nooff_16spc 6E5B 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6E5C 3 ; set aside B 6E5D 1 ; A -> B, (index*16)/256, A stays in A 6E5E 3 ; X=X+(index*16)/256 6E5F E ; load X,X+1 table entry above & below 6E61 1 ; A-B -> A, get slope*-1 of table 6E62 3 ; bring back B=remainder 6E63 2 ;br if table is decreasing 6E65 4 ;else increasing table 6E66 3 ; interpolate -1*-slope * delta 6E67 A ; added interpolated part to initial 6E69 2 ; done A=result 6E6B 3 ; interpolate -slope * delta 6E6E 4 ; subtract interpolated part to initial 6E6F A ; done A=result 6E7A C ;; lkup2d_nooff_16spc 6E7C 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 6E7D 3 ; set aside B 6E7E 1 ; A -> B, (index*16)/256, A stays in A 6E7F 3 ; X=X+(index*16)/256 6E80 E ; load X,X+1 table entry above & below 6E82 1 ; A-B -> A, get slope*-1 of table 6E83 3 ; bring back B=remainder 6E84 2 ;br if table is decreasing 6E86 4 ;else increasing table 6E87 3 ; interpolate -1*-slope * delta 6E88 A ; added interpolated part to initial 6E8A 2 ; done A=result 6E8C 3 ; interpolate -slope * delta 6E8F 4 ; subtract interpolated part to initial 6E90 A ; done A=result 6E9D 3 ; jump to reti, return from interrupt 6EA2 C ;base addr recd data table 6EA5 D ; offset recd data 6EA7 3 ; X + B -> X 6EA8 B ; spsr -> A 6EAB C ; B-$19 (25) 6EAD 2 ;branch if B<25 6EAF B ; else spdr -> A reading spsr&spdr clrs the spif bit 6EB2 A ; rec'd data byte -> m0046+m0042 ;; rec'd from tside data starts at m0046 6EB4 2 ; no more data to recv? 6EB9 8 ;1101 0100 6EBB B ;set spie,spe,mstr,cpha bits enable spi,mastr mode 6EBE 1 ; clr m1008 bit5, portD, SS slave select line 6EC2 A ; m0046+m0042+27 -> A ;; sent to Tside data starts at 0061 (0046 + 27, 0042=0) ;; BUT it looks like 0060 is the start..? see $6f05 6EC4 B ; A -> spdr transmit data byte to T side 6EC8 B ; recv data byte -> A 6ECB A ; A-> m0046+m0042 6ECD C ; B + 2 -> B 6ECF 1 ; set m1008 bit5, portD, SS slave select line 6ED6 8 ;1100 0100 6ED8 B ;set spie,spe,cpha bits enable spi, slave mode 6EDB B ; read spsr 6EDE B ; read spdr, reading spsr&spdr clrs the spif bit 6EE1 A ; recd byte -> m0046+m0042 + 1 6EE3 C ; B-$1A (26) 6EE5 2 ; branch if B<26, ie: 25 bytes sent to Tside 6F11 B ; why do this mem->A 6F14 0 ; and this...? 6F15 F ; and then mem->A, mem+1->B 6F1A B ; why bother 6F3B B ;why...? 6F3E 0 ; why..? 6F42 1 ; m1482 - m0065 6F45 2 ; br if m1482 = m0065, if unchanged, skip 6F47 D ; else store it again 6F50 D ; and store this again too. 6F55 0 ; mult x 2 6F58 8 ; if mult overflowed, set msb to $FF 6F5A 9 2; msb of l018b * 2 6F66 9 ;index for multiplexing some bytes tts 6F68 1 ; m0045 -> B, hold onto index in B for later 6F69 9 ; index to be sent to t side 6F6B 4 ; inc index, A + 1 -> A 6F6C 8 ; A - 4 6F6E 2 ; br if A<4 6F70 4 ; if index = 4, reset it to 0 6F71 9 ; index for multiplexing some bytes tts 6F73 8 ; $0a = 10 6F75 3 ; index previously stored in B * 10 -> D ;; B = 0,10,20,30, or 40 at this point 6F76 1 ; base addr ;;82F7 wt_82f7_mltiplxed_addr_index_table: ;;82F7 dw l_012a_ADMAP, L012B, L012E, L012C, L012D at this time (050401) these are known ;;8301 dw L00CC, $00CD, L012F, L0129, L0128 .. lw_00cc_GP6EBPWL from aldl labels ;;830B dw L000C, $2000, $2001, $2002, $2003 2000-2003 mod2bitpattrn on t side ;;8315 dw L00CA, $00CB, L0188, L01C9, L01CA .. lw_00ca_GP6EBPWR ;;831F dw L01CB, L01CC, L01CD, L018D, $018E .. lw_018d_GP6EAFND 6F7A 1 ; + offset 0,10,20,30,40 6F7C C ; 6F7F A ; 6F81 9 ; mem l_012a_ADMAP,... 6F88 9 ; mem L012B, ... 6F8F 9 ; mem L012E,... 6F96 9 ; mem L012C,... 6F9D 9 ; mem L012D ... 6FAD 1 ; if m1804 b2 set, set m0035 b5 6FB2 9 ; 6FB4 9 ; start preparing cksm of tts data 6FE8 9 ; store cksm of tts data 6FEA 9 ; start adding cksm of fts data 701D 9 ; recd fts cksm 708C 9 ;start storing data rec'd from t side 7781 ;;* 8X16MULT.SRC from anht_hac ;;* ;;* 8 x 16 Multiply with 16 bit result result rounded ;;* to the upper 16 bits. ;;* ;;* CALL WITH: ;;* A Reg = 8 BIT Multiplier ;;* X Reg = Adderss og 16 bit Multiplicand ;;* ;;* RETURN WITH: ;;* A Reg = MSB of 16 bit result ;;* B Reg = LSM of 16 bit result ;;* ;;* Exec time: 66 Cycles ;;* Code length: 20 Bytes ;;* Stack req: 3 Bytes 7781 3 ; SAVE A A*X->D 8 x 16 Multiply 7782 E ; LSB OF X with 16 bit result result 7784 3 ; MSB PARTIAL PROD rounded to the upper 16 bits. 7785 8 ; ROUND same as anht.hac 7787 3 ; get back multiplier 7788 3 ; SAVE PARTIAL PRODUCT 7789 A ; GET MSB OF MULTIPLICAND 778B 3 ; MSB PARTIAL PRODUCT 778C 3 ; preserve X 778E E ; ADD IN LSB PARTIAL PROD 7790 8 ; ROUND 7792 3 ; get back X 7794 3 ; Result of A*X is left in D 7803 ;;********************************************************** ;;from anht.hac. Same 2D lookup sub ;; also same as on T side ;;* LKUP_2DA.SRC ;;* ;;* ;;* l_7807_lkup2d_nooff_tblspc ;;* LEBF5: 2D table look up w/no offset ;;* spacing from table ;;* ;;* l_780e_lkup2d_off_tblspc ;;* ebfc_LKUP_2D: 2D table lookup w/offset ;;* spaced from table ;;* ;;* l_7812_lkup2d_nooff_16spc ;;* ec00_P4LKUPQ: 2D table lookup ;;* spaced 16 ;;* ;;* Returns a value from a table based on the value of an ;;* independent varable. Only certin values of indepenednt ;;* varable are represnted in the table. ;;* ;;* Call Arg: ;;* A Reg = independent var ;;* X Reg = Address of table ;;* ;;* LKUP_2D: l_ebfc_lkup2d_off_tblspc ;;* B Reg = Value of independednt var ;;* ;;* LEBF5 & LKU_PQ: l_ec00_lkup2d_nooff_16spc l_ebf5_lkup2d_nooff_tblspc ;;* B Reg = Ignmored & 1st tabulated val is 0 ;;* ;;* LEBF5: ;;* 1st byt of table = 256/H (subsequent bytes ;;* are the tabulated values) ;;* EXAMPLE: ;;* 2 for H = 128, (3 table entries max) ;;* 16 for H = 16, (17 table entries max) ;;* 25 for H = 10.4, (26 table entries max) ;;* ;;* LKUP_2D & LKU_PQ ;;* This byte omitedm H = 16 ;;* ;;* RETURNS WITH: A Reg = table value ;;* ;;* EXEC TIME: LEBF5 = 81 - 82 cyc ;;* LKUP_2D = 78 - 81 ;;* LKUP_Q = 73 - 74 ;;* ;;* STACK REQ: 4 Bytes ;;* ;;* ;;* ORG $EBF5 ;;********************************************************** 7807 3 ; 2D LK UP W/LINE COUNT 780B 0 ; Get 256/spacing value 780F 2 ; Br if D > 0 ;; 2D LOOK UP, NO OFFSET ... else 7812 3 ; lkup2d_nooff_16spc 7814 C ;Set 256/spacing, H to 16 (=$10) ;;--------------------------------- ;; Seperate val into table offset ;; & interp fraction ;;-------------------------------- 7816 3 ; A*B -> D 781A E ;Pick up Y1 & Y2 781C 1 ;Get delta Y1 - Y2, 781D 3 ;Ck if table is increasing 781E 2 ;Br if not inc 7820 4 ; ELSE Interp & round up if req 7824 2 ;;--------------------- ;; Interp & round ;; down if req'ed ;;--------------------- 782E 3 ;;*****************************************end of 2D lookup subroutine*********** 789A ;; from anht.hac same lag filter subroutine ;;******************************************************* ;;* LAG_FIL.SRC ;;* ;;* First order lag filter ;;* ;;* Filter out unwnated transients from 8 bit unsigned ;;* intigers. ;;* ;;* Computes NEWVALUE = OLDVALUE + Q * (INPUT - OLDVALUE) ;;* where Q is a 8 bit fraction (00.xx) ;;* ;;* Call with: ;;* X Reg = old value (prior filtered value) ;;* A Reg = New value (to be filtered) ;;* B Reg = Q (Filter coef) ;; Result returned in A, with B=0 ;;* ;;* Exec time: 104 Cycles ;;* Stack req: 6 Bytes ;;* Code length: 35 Bytes ;;* ;;* ALGORITHEM: ;;* NEW = OLD + Q * (IN - OLD) ;;* = OLD HIGH + OLD LOW + Q * (IN - OLD HIGH) ;;* - Q * OLD LOW ;;* = OLD HIGH + Q * (IN - OLD HIGH) HIGH2 ;;* + Q * (IN - OLD HIGH) HIGH ;;* + Q * (IN - OLD HIGH) LOW ;;* + ;;* + (1-Q) * OLD LOW ;; 789A 3 ; SAVE Q TO STACK 789C 3 ; SAVE OLD VAL 789D 3 ; SP -> X 789E A ; RESULT = INPUT(A) - OLD VALUE(X) 78A2 5 ;else 78A5 E ; CALC OLD VALUE HIGH + Q * DELTA HIGH2 78AD E ; CALC (1 - Q) * (OLDVALUE LOW) 78B2 3 ;else 78B7 E ; ADD Q * DELTA 7A91 C ;bt17_2df2_what_f(CoolTmp) 7A94 C ;; lkup2d_nooff_16spc 7A96 3 ; D=index*16 A=(index*16)/256 B=lsb(index*16) 7A97 3 ; set aside B 7A98 1 ; A -> B, (index*16)/256, A stays in A 7A99 3 ; X=X+(index*16)/256 7A9A E ; load X,X+1 table entry above & below 7A9C 1 ; A-B -> A, get slope*-1 of table 7A9D 3 ; bring back B=remainder 7A9E 2 ;br if table is decreasing 7AA0 4 ;else increasing table 7AA1 3 ; interpolate -1*-slope * delta 7AA2 A ; added interpolated part to initial 7AA4 2 ; done A=result 7AA6 3 ; interpolate -slope * delta 7AA9 4 ; subtract interpolated part to initial 7AAA A ; done A=result FFFF ; end of comments