P04 Custom Code

For discussion and distribution of custom code and hacks
zack4200
Posts: 79
Joined: Sat Jun 25, 2022 1:35 am
cars: 1982 Chevy Chevette 3400 LA1 swapped
1986 Chevy Chevette
1998 Chevy s10

Re: P04 Custom Code

Post by zack4200 »

ProfessWRX
Posts: 139
Joined: Tue Oct 03, 2023 9:33 am
cars: 04 Monte SSSC
04 Tahoe
92 Trans Am
Location: AZ USA

Re: P04 Custom Code

Post by ProfessWRX »

Ok, so since nobody has posted this info anywhere that I've seen:

The extra unused PCM input for an O2 Sensor in the L67 cars is Clear 12. This corresponds with FFFFFD09 in all P04 PCMs. This is Loaded into Software register: FFFF8EC2 in 12588500. This pin can then be used for any custom work you want done with a voltage input.
ProfessWRX
Posts: 139
Joined: Tue Oct 03, 2023 9:33 am
cars: 04 Monte SSSC
04 Tahoe
92 Trans Am
Location: AZ USA

Re: P04 Custom Code

Post by ProfessWRX »

Here's a custom subroutine hooked into the Fan Coolant temp Lookup routine. This is hooked where OS check if the Fan temps are controlled by BCM. My code instead jumps to this subroutine. Checks for the performance mode and if in performance mode subtracts 40C from the Fan Turn On/Off temps and jumps back.
The second subroutine is a duplicate but is different as the Fan 2 turns ons are loaded into d4 instead of d3. I probably could have done this a cleaner way but it was easy.

Code: Select all

ROM:0006E350     ; =============== S U B R O U T I N E =======================================
ROM:0006E350
ROM:0006E350
ROM:0006E350     sDropFan1OnTemps:                       ; CODE XREF: sCoolantFan1+16Ap
ROM:0006E350 000                 tst.b   (pPerformanceMode).w ; for Performance mode
ROM:0006E354 000                 bne.s   loc_6E35A       ; Branch to 6E35A if in performance mode
ROM:0006E356 000                 move.l  a1,d3           ; Load OEM values
ROM:0006E358 000                 rts                     ; Go back to stock code
ROM:0006E35A     ; ---------------------------------------------------------------------------
ROM:0006E35A
ROM:0006E35A     loc_6E35A:                              ; CODE XREF: sDropFan1OnTemps+4j
ROM:0006E35A 000                 move.l  a1,d3           ; Pull OEM value
ROM:0006E35C 000                 move.w  #$400,d0        ; 
ROM:0006E360 000                 sub.w   d0,d3           ; Subtract 40C from value
ROM:0006E362 000                 rts                     ; Return to Stock code
ROM:0006E362     ; End of function sDropFan1OnTemps
ROM:0006E362
ROM:0006E364
ROM:0006E364     ; =============== S U B R O U T I N E =======================================
ROM:0006E364
ROM:0006E364
ROM:0006E364     sDropFan2OnTemps:                       ; CODE XREF: sCoolantFan2:loc_4C350p
ROM:0006E364 000                 tst.b   (pPerformanceMode).w ; Test an Operand
ROM:0006E368 000                 bne.s   loc_6E36E       ; Branch if Not Equal
ROM:0006E36A 000                 move.l  a1,d4           ; Move Data from Source to Destination
ROM:0006E36C 000                 rts                     ; Return from Subroutine
ROM:0006E36E     ; ---------------------------------------------------------------------------
ROM:0006E36E
ROM:0006E36E     loc_6E36E:                              ; CODE XREF: sDropFan2OnTemps+4j
ROM:0006E36E 000                 move.l  a1,d4           ; Move Data from Source to Destination
ROM:0006E370 000                 move.w  #$400,d0        ; Move Data from Source to Destination
ROM:0006E374 000                 sub.w   d0,d4           ; Subtract
ROM:0006E376 000                 rts                     ; Return from Subroutine
ROM:0006E376     ; End of function sDropFan2OnTemps
ROM:0006E376
ROM:0006E376     ; ---------------------------------------------------------------------------
Fan 1 Hook:

Code: Select all

ROM:0004C146 022                 jsr     sDropFan1OnTemps ; Jump to Custom Subroutine
ROM:0004C14C 022                 bra.s   loc_4C168       ; Branch skipping some OEM code to the correct spot.
Edit: tested, works.
Post Reply