Found PID subroutines

Coordinator
Feb 12, 2008 at 1:28 AM
I think I have found the subroutines that calculate PID results. All of the PID's are defined in the area between:

10AA0 - 1196A

ROM:00010AA0 byte10AA0: dc.b 3 ; DATA XREF: sub1198E+34r
ROM:00010AA0 ; sub_1198E+7Er ...
ROM:00010AA1 dc.l off_100+2
ROM:00010AA5 dc.l off_118+3
ROM:00010AA9 dc.b 2, 9, 0
ROM:00010AAC dc.l loc_20100
ROM:00010AB0 dc.l sub_11DA2
ROM:00010AB4 dc.b 6
ROM:00010AB5 dc.b 0
ROM:00010AB6 dc.w 3
ROM:00010AB8 dc.b 1
ROM:00010AB9 dc.b 0
ROM:00010ABA dc.l sub_11DF8
ROM:00010ABE dc.b $F
ROM:00010ABF dc.b 0
ROM:00010AC0 dc.w 4
ROM:00010AC2 dc.b 0
ROM:00010AC3 dc.b 0
ROM:00010AC4 dc.l sub_11EB4
ROM:00010AC8 dc.b $F
ROM:00010AC9 dc.b 0
ROM:00010ACA dc.w 5
ROM:00010ACC dc.b 0
ROM:00010ACD dc.b 0
ROM:00010ACE dc.l sub_11F1C
ROM:00010AD2 dc.b $F
ROM:00010AD3 dc.b 0
ROM:00010AD4 dc.w 6
ROM:00010AD6 dc.b 0
ROM:00010AD7 dc.b 0
ROM:00010AD8 dc.l sub_11F74


An example of TPS calculation (PID 11)

ROM:000122E6 sub122E6: ; CODE XREF: sub470E6+7Ep
ROM:000122E6 ; DATA XREF: ROM:00010B3Co
ROM:000122E6 cmpi.b #2,d0 ; Compare Immediate
ROM:000122EA bhi.s loc_122F2 ; Branch if High
ROM:000122EC beq.s loc_12300 ; Branch if Equal
ROM:000122EE tst.b d0 ; Test an Operand
ROM:000122F0 bne.s loc_12306 ; Branch if Not Equal
ROM:000122F2

*ROM:000122F2 loc122F2: ; CODE XREF: sub122E6+4j
ROM:000122F2 move.w ($FFFFA7B4).w,d0 ; Move Data from Source to Destination
ROM:000122F6 mulu.w #$D,d0 ; Unsigned Multiply
ROM:000122FA divu.w #$105,d0 ; Unsigned Divide
ROM:000122FE bra.s locret_12338 ; Branch Always*

ROM:00012300 ; ---------------------------------------------------------------------------
ROM:00012300
ROM:00012300 loc12300: ; CODE XREF: sub122E6+6j
ROM:00012300 tst.w ($FFFFAEA6).w ; Test an Operand
ROM:00012304 bne.s loc_1230C ; Branch if Not Equal
ROM:00012306
ROM:00012306 loc12306: ; CODE XREF: sub122E6+Aj
ROM:00012306 move.w ($FFFF87AE).w,d0 ; Move Data from Source to Destination
ROM:0001230A bra.s locret_12338 ; Branch Always
ROM:0001230C ; ---------------------------------------------------------------------------
ROM:0001230C
ROM:0001230C loc1230C: ; CODE XREF: sub122E6+1Ej
ROM:0001230C move.w ($FFFFAEA6).w,d3 ; Move Data from Source to Destination
ROM:00012310 cmpi.w #$FF,d3 ; Compare Immediate
ROM:00012314 bhi.s loc_12324 ; Branch if High
ROM:00012316 cmpi.b #5,d3 ; Compare Immediate
ROM:0001231A bhi.s loc_12324 ; Branch if High
ROM:0001231C cmpi.b #1,d3 ; Compare Immediate
ROM:00012320 bcs.s loc_12328 ; Branch if Carry Set
ROM:00012322 bra.s loc_1232A ; Branch Always
ROM:00012324 ; ---------------------------------------------------------------------------
ROM:00012324
ROM:00012324 loc12324: ; CODE XREF: sub122E6+2Ej
ROM:00012324 ; sub_122E6+34j
ROM:00012324 moveq #5,d3 ; Move Quick
ROM:00012326 bra.s loc_1232A ; Branch Always
ROM:00012328 ; ---------------------------------------------------------------------------
ROM:00012328
ROM:00012328 loc12328: ; CODE XREF: sub122E6+3Aj
ROM:00012328 moveq #1,d3 ; Move Quick
ROM:0001232A
ROM:0001232A loc1232A: ; CODE XREF: sub122E6+3Cj
ROM:0001232A ; sub_122E6+40j
ROM:0001232A andi.w #$FF,d3 ; AND Immediate
ROM:0001232E mulu.w #$3B,d3 ; ';' ; Unsigned Multiply
ROM:00012332 move.w -$7852(d3.l*2),d0 ; Move Data from Source to Destination
ROM:00012338
ROM:00012338 locret12338: ; CODE XREF: sub122E6+18j
ROM:00012338 ; sub_122E6+24j
ROM:00012338 rts ; Return from Subroutine


Anyone want to define the calculations?