Hi!
I'm trying to patch $EE code to use AIR pump output to control electric water pump on an LT1.
Here are parts of E-side disassembly that control the AIR pump:
Code:
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
; 0x531F some AIR Pump code (probably enable at startup ???) (part of hc11_irq_00) (executed when L0023 b0 is clear)
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
531F B6 20 28 ldaA b_2028_sw_b3vats_b2spddens_b0tcs
5322 85 04 bitA #%00000100 ; test AIR Pump switch bit (E-side 0x2028 b2)
5324 27 1B beq @8 ; Bra to continue if bit clear
5326 B6 01 92 ldaA l_0192_CoolTmp_fltrd_$f0 ; Load Coolant Temp
5329 B1 23 B2 cmpA L23B2 ; Compare to AIR pump disable temp threshold (E-side 0x23B2)
532C 23 10 bls @7 ; Bra if Temp <= threshold
532E B6 01 28 ldaA L0128 ; Load ???
5331 81 AB cmpA #$AB ; Compare to 171
5333 24 06 bcc @6 ; Bra if L0128 >= 171
5335 CE 18 00 ldX #$1800 ; Load Hardware output address
5338 1C 00 02 bset 0, X, #%00000010 ; Set AIR Pump output bit
533B 14 28 10 @6 bset L0028, #%00010000 ; Set AIR Pump ON flag
533E 7F 02 44 @7 clr L0244 ; Clear AIR Pump Timer
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
; 0x4962 Update AIR Pump State (part of loop_c_00)
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4962 B6 01 28 @12 ldaA L0128 ; Load ???
4965 81 AB cmpA #$AB ; Compare to 171
4967 24 29 bcc @14 ; Bra if L0128 >= 171
4969 12 2F 01 2D brset l_002f_fts_2_stat_byte, #%00000001, @15 ;Bra if T-side AIR request
496D 12 28 20 1E brset L0028, #%00100000, @13 ; Branch if AIR ON flag is set
4971 13 28 10 1D brclr L0028, #%00010000, @14 ; Branch if AIR Startup Request flag is clear
; Increase AIR Pump timer
4975 B6 02 44 ldaA L0244 ; Load AIR Pump Timer to A
4978 8B 01 addA #$01 ; Add 1 to A
497A 82 00 sbcA #$00 ; Subtract 0 from A with carry
497C B7 02 44 staA L0244 ; Store AIR Pump Timer
497F B1 23 B3 cmpA L23B3 ; Compare increased AIR Pump Timer to AIR pump timer threshold (E-side 0x23B3)
4982 25 1F bcs @16 ; Bra if A lower than threshold
4984 14 28 20 bset L0028, #%00100000 ; Set AIR ON flag
4987 15 28 10 bclr L0028, #%00010000 ; Clear AIR Startup Request flag
498A 7F 02 44 clr L0244 ; Clear AIR Pump Timer
498D 20 03 jr @14
; Here if AIR Pump should be turned OFF (T-side AIR request clear and AIR ON set)
498F 15 28 20 @13 bclr L0028, #%00100000 ; Clear AIR ON flag
; Here if L0128 >= 171, AIR Pump timer threshold met or AIR Startup Request flag clear
4992 CE 18 00 @14 ldX #$1800 ; Load Hardware output address
4995 1D 00 02 bclr 0, X, #%00000010 ; AIR Pump OFF
4998 20 0F jr @17 ; Bra to continue
;
499A 14 28 20 @15 bset L0028, #%00100000 ; Set AIR ON flag
499D 15 28 10 bclr L0028, #%00010000 ; Clear AIR Startup Request flag
49A0 7F 02 44 clr L0244 ; Clear AIR Pump Timer
; Here if AIR Pump timer threshold not met
49A3 CE 18 00 @16 ldX #$1800 ; Load Hardware output address
49A6 1C 00 02 bset 0, X, #%00000010 ; AIR Pump ON
49A9 7E 4E 38 @17 jmp L4E38
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So far I've managed to get it working most of the time, pump swithes on when engine is running and turns off when engine stalls, but sometimes it turns off while engine is running. It does not report that it's ON in EEHack, but I can still enable it using EEHack control and then the AIR ON flag is set.
Here is my code patch:
Code:
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
; 0x4962 Update AIR Pump State (part of loop_c_00)
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4962 B6 01 5F ldaA l_015f_RPM_2.5/bit ; Load engine speed
4965 CE 18 00 ldX #$1800 ; Load Hardware output address
4968 12 2F 01 10 brset l_002f_fts_2_stat_byte, #%00000001, @14 ;Bra if T-side AIR request set
496C 81 A0 cmpA #$A0 ; Compare to 400rpm
496E 24 0C bcc @14 ; Bra if higher or same
4970 81 78 cmpA #$78 ; Compare to 300rpm
4972 22 0E bhi @15 ; Bra if higher
4974 15 28 20 @13 bclr L0028, #%00100000 ; Clear AIR ON flag
4977 1D 00 02 bclr 0, X, #%00000010 ; AIR Pump OFF
497A 20 06 bra @15 ; Bra to continue
497C 14 28 20 @14 bset L0028, #%00100000 ; Set AIR ON flag
497F 1C 00 02 bset 0, X, #%00000010 ; AIR Pump ON
4982 20 25 @15 bra @17
....
49A9 7E 4E 38 @17 jmp L4E38
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Maybe some of you may get me on the right track here, there must be something I don't see in the code that turns the AIR output OFF. Also, do you know what is in L0128 RAM address? I can't figure it out.
Bookmarks