Results 1 to 13 of 13

Thread: table lookups info

  1. #1

    table lookups info

    Hi all,

    Here's some info re table lookups. I found five 3d table lookup routines.

    ROM:000264AC
    ROM:000264AC ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:000264AC
    ROM:000264AC
    ROM:000264AC Lookup_3Dsword_264AC: ; CODE XREF: ROM:00020260 p
    ROM:000264AC ; ROM:000203B2 p ...
    ROM:000264AC move.w d1,d3 ; Move Data from Source to Destination
    ROM:000264AE lsr.w #8,d3 ; Logical Shift Right
    ROM:000264B0 lsl.w #1,d2 ; Logical Shift Left
    ROM:000264B2 mulu.w d2,d3 ; Unsigned Multiply
    ROM:000264B4 adda.l d3,a0 ; Add Address
    ROM:000264B6 move.w d0,d3 ; Move Data from Source to Destination
    ROM:000264B8 tblsn.w (a0),d0 ; Table Lookup and Interpolation (Signed)
    ROM:000264BC tblsn.w (a0,d2.w),d3 ; Table Lookup and Interpolation (Signed)
    ROM:000264C2 tbls.l d0:d3,d1 ; Table Lookup and Interpolation (Signed)
    ROM:000264C6 addi.l #$80,d1 ; 'Ç' ; Add Immediate
    ROM:000264CC asr.l #8,d1 ; Arithmetic Shift Right
    ROM:000264CE move.l d1,d0 ; Move Data from Source to Destination
    ROM:000264D0 rts ; Return from Subroutine
    ROM:000264D0 ; End of function Lookup_3Dsword_264AC
    ROM:000264D0


    Inputs:
    A0 = Address of table
    D0 = column variable
    D1 = row variable
    D2 = # columns per row

    Outputs:
    D0 & D1 both contain the lookup result

    Temp registers:
    D3 =

    Analysing the routine:

    D3 = D1
    Shift right D3 8 places (divide by 256) (convert to integer row number)
    Shift left D2 1 place (multiply by 2) convert from cols/row to bytes/row
    Multiply Word Unsigned D2 and D3 result in D3
    Add Long D3 to A0, result in A0 (this is the new lower row address)

    D3 = D0 copy column variable to D3
    D0 = Lookup Lower row: Lookup Signed Word Unrounded A0 as row and D0 as the column variable

    D3 = Lookup Upper row: Lookup Signed Word Unrounded A0+D2 as row and D3 as the column variable

    D1 = Interpolate with rounding between D0 and D3 for final answer

    D1 = D1 + 128
    Shift right D1 8 places (divide by 256) adjust to the resolution required
    D0 = D1

    Return Result in D0 and D1

    Hopefully no mistakes above. There are word and byte, signed an unsigned equivalents of these. Also, some routines take D2 in bytes/row not cols/row. D0 and D1 need to be pre-scaled to be in range for the table size. In total i counted over 600 2d and 3d lookups in the code, thankfully not all are unique tables!!

    I've found all sorts of other stuff but will post in another thread specific to this bin. The jump refernces take a while to get ya head around for sure - not quite there yet on the actual structure of the main routines but wont be long.
    I count sheep in hex...

  2. #2
    HP Tuners Owner Keith@HPTuners's Avatar
    Join Date
    Sep 2002
    Location
    Chicago, IL
    Posts
    6,395

    Re: table lookups info

    Excellent information and write-up. It makes it a lot easier to understand and follow for those of us new to assembly.

    What BIN you using?

    - Keith
    We got this guy Not Sure, ...

  3. #3

    Re: table lookups info

    its a 12225074 which is a 2002 aussie holden bin.
    I count sheep in hex...

  4. #4
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: table lookups info

    Those same routines are also in a 2001 Z06 image
    that I'm playing with.

    FWIW, I've also found the DTC's (important because
    it's how you figure out variables).. both the routines
    and the actual "table of DTC's" and the checksum
    routines.. which use an array structure just after 0x500

    In the 2001 Z06, there are 8 checksums. One for the
    "code" and 7 for different cal segments.

    The big question is: Has anyone found the code that
    communicates via Class2?

  5. #5

    Re: table lookups info

    care to share your DTC info?

    I count sheep in hex...

  6. #6
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: table lookups info

    No doubt..

    OK.. since I don't have YOUR bin to see, what you
    need to look for is a structure of hex bytes that
    starts like this:

    01 01 02 01 01 02 02 01

    The struct is 1 word, then 2 bytes.. thusly:

    0101 (P0101)
    02
    01

    0102 (P0102)
    02
    01

    Every example I've seen ends in

    1875 (P1875)
    1E
    04

    This table is referenced by two (well more, but we only
    care about two) routines.

    ROM:0005A84A CLR_DTC: ; CODE XREF: sub_20646+18p
    ROM:0005A84A ; sub_20646+34p ...
    ROM:0005A84A movem.l d1-d2/d6,-(sp)
    ROM:0005A84E btst #4,($FFFFA6F0).w
    ROM:0005A854 bne.s loc_5A898
    ROM:0005A856 clr.l d6
    ROM:0005A858 move.b d0,d6
    ROM:0005A85A btst #1,$FFFF87FC(d6.w*2)
    ROM:0005A862 sne d2
    ROM:0005A864 neg.b d2
    ROM:0005A866 jsr sub_596F6
    ROM:0005A86C tst.b d2
    ROM:0005A86E beq.s loc_5A898
    ROM:0005A870 move.b byte_7D4B4(d6.w*4),d3
    ROM:0005A878 clr.l d4
    ROM:0005A87A move.b d3,d4
    ROM:0005A87C lea $FFFFA6E8(d4.w),a2
    ROM:0005A882 subq.b #1,$A(a2)
    ROM:0005A886 tst.b $FFFFA6F2(d4.w)
    ROM:0005A88C bne.s loc_5A898
    ROM:0005A88E move.l ($FFFF81CA).w,d4
    ROM:0005A892 bclr d3,d4
    ROM:0005A894 move.l d4,($FFFF81CA).w
    ROM:0005A898
    ROM:0005A898 loc_5A898: ; CODE XREF: CLR_DTC+Aj
    ROM:0005A898 ; CLR_DTC+24j ...
    ROM:0005A898 movem.l (sp)+,d1-d2/d6
    ROM:0005A89C rts
    ROM:0005A89C ; End of function CLR_DTC
    ROM:0005A89C
    ROM:0005A89E
    ROM:0005A89E ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
    ROM:0005A89E
    ROM:0005A89E
    ROM:0005A89E SET_DTC: ; CODE XREF: sub_20000+6Ap
    ROM:0005A89E ; sub_200DE+522p ...
    ROM:0005A89E movem.l d1-d2/d6,-(sp)
    ROM:0005A8A2 move.b d0,d1
    ROM:0005A8A4 btst #4,($FFFFA6F0).w
    ROM:0005A8AA bne.s loc_5A90C
    ROM:0005A8AC clr.l d6
    ROM:0005A8AE move.b d0,d6
    ROM:0005A8B0 btst #1,$FFFF87FC(d6.w*2)
    ROM:0005A8B8 sne d2
    ROM:0005A8BA neg.b d2
    ROM:0005A8BC jsr sub_5955C
    ROM:0005A8C2 tst.b d2
    ROM:0005A8C4 bne.s loc_5A90C
    ROM:0005A8C6 cmpi.b #3,byte_161B8(d6.w)
    ROM:0005A8D0 beq.s loc_5A90C
    ROM:0005A8D2 tst.b ($FFFF81CE).w
    ROM:0005A8D6 beq.s loc_5A8E6
    ROM:0005A8D8 btst #2,($FFFF9834).w
    ROM:0005A8DE beq.s loc_5A8E6
    ROM:0005A8E0 tst.b ($FFFFAF63).w
    ROM:0005A8E4 beq.s loc_5A8EC
    ROM:0005A8E6
    ROM:0005A8E6 loc_5A8E6: ; CODE XREF: SET_DTC+38j
    ROM:0005A8E6 ; SET_DTC+40j
    ROM:0005A8E6 cmpi.b #$66,d1 ; 'f'
    ROM:0005A8EA bne.s loc_5A90C
    ROM:0005A8EC
    ROM:0005A8EC loc_5A8EC: ; CODE XREF: SET_DTC+46j
    ROM:0005A8EC move.b byte_7D4B4(d6.w*4),d3
    ROM:0005A8F4 clr.l d4
    ROM:0005A8F6 move.b d3,d4
    ROM:0005A8F8 lea -$5918(d4.w),a2
    ROM:0005A8FE addq.b #1,$A(a2)
    ROM:0005A902 move.l ($FFFF81CA).w,d4
    ROM:0005A906 bset d3,d4
    ROM:0005A908 move.l d4,($FFFF81CA).w
    ROM:0005A90C
    ROM:0005A90C loc_5A90C: ; CODE XREF: SET_DTC+Cj
    ROM:0005A90C ; SET_DTC+26j ...
    ROM:0005A90C movem.l (sp)+,d1-d2/d6
    ROM:0005A910 rts
    ROM:0005A910 ; End of function SET_DTC

    Look where they are called, and you will see an "offset"
    into the table passed to each call.

    Example:

    ROM:00064D06 loc_64D06: ; CODE XREF: Check_P0101+7Ej
    ROM:00064D06 moveq #1,d0
    ROM:00064D08 jsr SET_DTC

    This code sets the first DTC in the table.. AKA P0101
    which is a MAF fault.

    You'll NEED the exact GM Manuals for YOUR car in YOUR
    market to see the conditions for setting the DTCs/etc
    to figure out variables.

    BTW, the offset is "1" and not "0" because the table
    actually starts with four 0 bytes.

    If you or anyone finds ANY code you think is some of
    the class2 stuff.. even simple DTC read/clear, send me
    to it and I'll trace it out and find the "important" stuff
    like flash read/write and mode 27 security auth.

    ;D

    BTW^2: I have an excel chart to break out all the codes
    to their "meanings" per the SAE if you want it, email me
    clicking the link above.

  7. #7

    Re: table lookups info

    cool info, i found this stuff for my bin should speed things up a bit over the next few days.

    I've found some code that reads/writes to the QSPI data RAM, but haven't analysed it yet to see what it does or whether it is even related to what you are chasing.


    I count sheep in hex...

  8. #8
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: table lookups info

    One would think that's it, the HC58 is likely used in SPI
    mode.


  9. #9

    Re: table lookups info

    also, i found some code that sets/clears DTC $F3 and $F4 which is seemingly outside the table.

    don't know what these extra entries do?

    ---snip---
    ROM:0007D2E4 DTC_E5: dc.w $1870 ; Transmission Component Slipping
    ROM:0007D2E6 dc.b $1E ;
    ROM:0007D2E7 dc.b 4 ;
    ROM:0007D2E8 DTC_E6: dc.w $1875 ; 4WD Low Circuit Error
    ROM:0007D2EA dc.b $1E ;
    ROM:0007D2EB dc.b 4 ;
    ROM:0007D2EC dc.w $D000
    ROM:0007D2EE dc.b 0 ;
    ROM:0007D2EF dc.b 6 ;
    ROM:0007D2F0 dc.w $D024
    ROM:0007D2F2 dc.b 0 ;
    ROM:0007D2F3 dc.b 6 ;
    ROM:0007D2F4 dc.w $D026
    ROM:0007D2F6 dc.b 0 ;
    ROM:0007D2F7 dc.b 6 ;
    ROM:0007D2F8 dc.w $D040
    ROM:0007D2FA dc.b 0 ;
    ROM:0007D2FB dc.b 6 ;
    ROM:0007D2FC dc.w $D041
    ROM:0007D2FE dc.b 0 ;
    ROM:0007D2FF dc.b 6 ;
    ROM:0007D300 dc.w $D056
    ROM:0007D302 dc.b 0 ;
    ROM:0007D303 dc.b 6 ;
    ROM:0007D304 dc.w $D064
    ROM:0007D306 dc.b 0 ;
    ROM:0007D307 dc.b 6 ;
    ROM:0007D308 dc.w $D096
    ROM:0007D30A dc.b 0 ;
    ROM:0007D30B dc.b 6 ;
    ROM:0007D30C dc.w $D153
    ROM:0007D30E dc.b 0 ;
    ROM:0007D30F dc.b 6 ;
    ROM:0007D310 dc.w $D192
    ROM:0007D312 dc.b 0 ;
    ROM:0007D313 dc.b 6 ;
    ROM:0007D314 dc.w $D193
    ROM:0007D316 dc.b 0 ;
    ROM:0007D317 dc.b 6 ;
    ROM:0007D318 dc.w $D255
    ROM:0007D31A dc.b 0 ;
    ROM:0007D31B dc.b 6 ;
    ROM:0007D31C DTC_F3: dc.w $D300
    ROM:0007D31E dc.b 0 ;
    ROM:0007D31F dc.b 6 ;
    ROM:0007D320 DTC_F4: dc.w $D301
    ROM:0007D322 dc.b 0 ;
    ROM:0007D323 dc.b 6 ;



    I count sheep in hex...

  10. #10
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: table lookups info

    Nope.. be sure that code is executed first.. there are
    tons of "flags" that control which DTC's are run/etc.

    I've already found RPM, ECT, IAT.. etc.

    The units in this ECU are VERY wierd.

    Take RPM.. 5.12 counts per RPM, such that 1000 rpm is
    $1400.. for example.

    But I've verified it from multiple sources.

  11. #11
    Senior Tuner
    Join Date
    May 2003
    Location
    Santa Clarita, Ca
    Posts
    962

    Re: table lookups info

    Gameover, I don't know which PCM you are working on, but that index you posted looks more like a subroutine or jump index than code setting.

    Super_Sport_x2

  12. #12
    Tuner in Training
    Join Date
    May 2003
    Location
    SLC, Utah
    Posts
    33

    Re: table lookups info

    If you're talking two posts "up", it's neither..

    Its part of the DTC structure.

    How the PCM sets different DYCs.

    Jim

  13. #13

    Re: table lookups info

    here's the call. What do you think? It looks valid to me, still no idea what they might be for though. The PCM is an Aussie 2002, 12225074.


    ROM:00045836 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦¦¦¦¦¦¦
    ROM:00045836
    ROM:00045836 ; Attributes: bp-based frame
    ROM:00045836
    ROM:00045836 sub_45836: ; CODE XREF: sub_40CC0+2B0p
    ROM:00045836 ; sub_41A84+24p ...
    ROM:00045836
    ROM:00045836 var_4 = -4
    ROM:00045836 var_3 = -3
    ROM:00045836 var_2 = -2
    ROM:00045836
    ROM:00045836 link a6,#-2 ; Link and Allocate
    ROM:0004583A move.w d0,-(sp) ; Move Data from Source to Destination
    ROM:0004583C move.l d1,-(sp) ; Move Data from Source to Destination
    ROM:0004583E move.b var_4(a6),d3 ; Move Data from Source to Destination
    ROM:00045842 lsr.b #4,d3 ; Logical Shift Right
    ROM:00045844 move.b d3,($FFFFA4B8).w ; Move Data from Source to Destination
    ROM:00045848 btst #0,var_4(a6) ; Test a Bit
    ROM:0004584E sne d3 ; Set According to TRUE if Not Equal (else to FALSE)
    ROM:00045850 neg.b d3 ; Negate
    ROM:00045852 move.b d3,($FFFFA4B9).w ; Move Data from Source to Destination
    ROM:00045856 move.b var_3(a6),($FFFFA4BA).w ; Move Data from Source to Destination
    ROM:0004585C btst #4,($FFFF982E).w ; Test a Bit
    ROM:00045862 bne.s loc_4586E ; Branch if Not Equal
    ROM:00045864 btst #2,($FFFF982E).w ; Test a Bit
    ROM:0004586A beq.w loc_459C8 ; Branch if Equal
    ROM:0004586E
    ROM:0004586E loc_4586E: ; CODE XREF: sub_45836+2Cj
    ROM:0004586E tst.b ($FFFF9850).w ; Test an Operand
    ROM:00045872 bne.w loc_459C8 ; Branch if Not Equal
    ROM:00045876 tst.b ($FFFFAC9A).w ; Test an Operand
    ROM:0004587A bne.w loc_459C8 ; Branch if Not Equal
    ROM:0004587E cmpi.b #3,($FFFFAD13).w ; Compare Immediate
    ROM:00045884 beq.s loc_45890 ; Branch if Equal
    ROM:00045886 cmpi.b #2,($FFFFAD13).w ; Compare Immediate
    ROM:0004588C bne.w loc_459C8 ; Branch if Not Equal
    ROM:00045890
    ROM:00045890 loc_45890: ; CODE XREF: sub_45836+4Ej
    ROM:00045890 move.b ($FFFFA4B8).w,d3 ; Move Data from Source to Destination
    ROM:00045894 cmpi.b #1,d3 ; Compare Immediate
    ROM:00045898 bne.w loc_45984 ; Branch if Not Equal
    ROM:0004589C btst #1,($FFFF89DC).w ; Test a Bit
    ROM:000458A2 bne.w loc_45984 ; Branch if Not Equal
    ROM:000458A6 btst #1,($FFFF89DA).w ; Test a Bit
    ROM:000458AC bne.w loc_45984 ; Branch if Not Equal
    ROM:000458B0 move.b ($FFFFA4BA).w,d3 ; Move Data from Source to Destination
    ROM:000458B4 cmpi.b #-1,d3 ; Compare Immediate
    ROM:000458B8 bne.s loc_458C4 ; Branch if Not Equal
    ROM:000458BA move.b #$E7,var_2(a6) ; Move Data from Source to Destination
    ROM:000458C0 bra.w loc_45958 ; Branch Always
    ROM:000458C4 ; ---------------------------------------------------------------------------
    ROM:000458C4
    ROM:000458C4 loc_458C4: ; CODE XREF: sub_45836+82j
    ROM:000458C4 cmpi.b #$1A,d3 ; Compare Immediate
    ROM:000458C8 bne.s loc_458D4 ; Branch if Not Equal
    ROM:000458CA move.b #$E9,var_2(a6) ; Move Data from Source to Destination
    ROM:000458D0 bra.w loc_45958 ; Branch Always
    ROM:000458D4 ; ---------------------------------------------------------------------------
    ROM:000458D4
    ROM:000458D4 loc_458D4: ; CODE XREF: sub_45836+92j
    ROM:000458D4 cmpi.b #$28,d3 ; '(' ; Compare Immediate
    ROM:000458D8 bne.s loc_458E2 ; Branch if Not Equal
    ROM:000458DA move.b #$EA,var_2(a6) ; Move Data from Source to Destination
    ROM:000458E0 bra.s loc_45958 ; Branch Always
    ROM:000458E2 ; ---------------------------------------------------------------------------
    ROM:000458E2
    ROM:000458E2 loc_458E2: ; CODE XREF: sub_45836+A2j
    ROM:000458E2 cmpi.b #$29,d3 ; ')' ; Compare Immediate
    ROM:000458E6 bne.s loc_458F0 ; Branch if Not Equal
    ROM:000458E8 move.b #$EB,var_2(a6) ; Move Data from Source to Destination
    ROM:000458EE bra.s loc_45958 ; Branch Always
    ROM:000458F0 ; ---------------------------------------------------------------------------
    ROM:000458F0
    ROM:000458F0 loc_458F0: ; CODE XREF: sub_45836+B0j
    ROM:000458F0 cmpi.b #$38,d3 ; '8' ; Compare Immediate
    ROM:000458F4 bne.s loc_458FE ; Branch if Not Equal
    ROM:000458F6 move.b #$EC,var_2(a6) ; Move Data from Source to Destination
    ROM:000458FC bra.s loc_45958 ; Branch Always
    ROM:000458FE ; ---------------------------------------------------------------------------
    ROM:000458FE
    ROM:000458FE loc_458FE: ; CODE XREF: sub_45836+BEj
    ROM:000458FE cmpi.b #$40,d3 ; '@' ; Compare Immediate
    ROM:00045902 bne.s loc_4590C ; Branch if Not Equal
    ROM:00045904 move.b #$ED,var_2(a6) ; Move Data from Source to Destination
    ROM:0004590A bra.s loc_45958 ; Branch Always
    ROM:0004590C ; ---------------------------------------------------------------------------
    ROM:0004590C
    ROM:0004590C loc_4590C: ; CODE XREF: sub_45836+CCj
    ROM:0004590C cmpi.b #$60,d3 ; '`' ; Compare Immediate
    ROM:00045910 bne.s loc_4591A ; Branch if Not Equal
    ROM:00045912 move.b #$EE,var_2(a6) ; Move Data from Source to Destination
    ROM:00045918 bra.s loc_45958 ; Branch Always
    ROM:0004591A ; ---------------------------------------------------------------------------
    ROM:0004591A
    ROM:0004591A loc_4591A: ; CODE XREF: sub_45836+DAj
    ROM:0004591A cmpi.b #$99,d3 ; Compare Immediate
    ROM:0004591E bne.s loc_45928 ; Branch if Not Equal
    ROM:00045920 move.b #$EF,var_2(a6) ; Move Data from Source to Destination
    ROM:00045926 bra.s loc_45958 ; Branch Always
    ROM:00045928 ; ---------------------------------------------------------------------------
    ROM:00045928
    ROM:00045928 loc_45928: ; CODE XREF: sub_45836+E8j
    ROM:00045928 cmpi.b #$18,d3 ; Compare Immediate
    ROM:0004592C bne.s loc_45936 ; Branch if Not Equal
    ROM:0004592E move.b #$E8,var_2(a6) ; Move Data from Source to Destination
    ROM:00045934 bra.s loc_45958 ; Branch Always
    ROM:00045936 ; ---------------------------------------------------------------------------
    ROM:00045936
    ROM:00045936 loc_45936: ; CODE XREF: sub_45836+F6j
    ROM:00045936 cmpi.b #$C0,d3 ; Compare Immediate
    ROM:0004593A bne.s loc_45944 ; Branch if Not Equal
    ROM:0004593C move.b #$F0,var_2(a6) ; Move Data from Source to Destination
    ROM:00045942 bra.s loc_45958 ; Branch Always
    ROM:00045944 ; ---------------------------------------------------------------------------
    ROM:00045944
    ROM:00045944 loc_45944: ; CODE XREF: sub_45836+104j
    ROM:00045944 cmpi.b #$C1,d3 ; Compare Immediate
    ROM:00045948 bne.s loc_45952 ; Branch if Not Equal
    ROM:0004594A move.b #$F1,var_2(a6) ; Move Data from Source to Destination
    ROM:00045950 bra.s loc_45958 ; Branch Always
    ROM:00045952 ; ---------------------------------------------------------------------------
    ROM:00045952
    ROM:00045952 loc_45952: ; CODE XREF: sub_45836+112j
    ROM:00045952 clr.b var_2(a6) ; Clear an Operand
    ROM:00045956 clr.b d4 ; Clear an Operand
    ROM:00045958
    ROM:00045958 loc_45958: ; CODE XREF: sub_45836+8Aj
    ROM:00045958 ; sub_45836+9Aj ...
    ROM:00045958 tst.b var_2(a6) ; Test an Operand
    ROM:0004595C beq.s loc_45960 ; Branch if Equal
    ROM:0004595E moveq #1,d4 ; Move Quick
    ROM:00045960
    ROM:00045960 loc_45960: ; CODE XREF: sub_45836+126j
    ROM:00045960 tst.b d4 ; Test an Operand
    ROM:00045962 beq.s loc_459C8 ; Branch if Equal
    ROM:00045964 tst.b ($FFFFA4B9).w ; Test an Operand
    ROM:00045968 bne.s loc_45976 ; Branch if Not Equal
    ROM:0004596A move.b var_2(a6),d0 ; Move Data from Source to Destination
    ROM:0004596E
    ROM:0004596E loc_4596E: ; CODE XREF: sub_45836+15Ej
    ROM:0004596E ; sub_45836+17Ej
    ROM:0004596E jsr CLR_DTC ; Jump to Subroutine
    ROM:00045974 bra.s loc_459C8 ; Branch Always
    ROM:00045976 ; ---------------------------------------------------------------------------
    ROM:00045976
    ROM:00045976 loc_45976: ; CODE XREF: sub_45836+132j
    ROM:00045976 btst #4,($FFFF982E).w ; Test a Bit
    ROM:0004597C beq.s loc_459C8 ; Branch if Equal
    ROM:0004597E move.b var_2(a6),d0 ; Move Data from Source to Destination
    ROM:00045982 bra.s loc_459C2 ; Branch Always
    ROM:00045984 ; ---------------------------------------------------------------------------
    ROM:00045984
    ROM:00045984 loc_45984: ; CODE XREF: sub_45836+62j
    ROM:00045984 ; sub_45836+6Cj ...
    ROM:00045984 cmpi.b #3,d3 ; Compare Immediate
    ROM:00045988 bne.s loc_459A4 ; Branch if Not Equal
    ROM:0004598A tst.b ($FFFFA4B9).w ; Test an Operand
    ROM:0004598E bne.s loc_45996 ; Branch if Not Equal
    ROM:00045990 move.b #$F3,d0 ; Move Data from Source to Destination
    ROM:00045994 bra.s loc_4596E ; Branch Always
    ROM:00045996 ; ---------------------------------------------------------------------------
    ROM:00045996
    ROM:00045996 loc_45996: ; CODE XREF: sub_45836+158j
    ROM:00045996 btst #4,($FFFF982E).w ; Test a Bit
    ROM:0004599C beq.s loc_459C8 ; Branch if Equal
    ROM:0004599E move.b #$F3,d0 ; Move Data from Source to Destination
    ROM:000459A2 bra.s loc_459C2 ; Branch Always
    ROM:000459A4 ; ---------------------------------------------------------------------------
    ROM:000459A4
    ROM:000459A4 loc_459A4: ; CODE XREF: sub_45836+152j
    ROM:000459A4 cmpi.b #4,d3 ; Compare Immediate
    ROM:000459A8 bne.s loc_459C8 ; Branch if Not Equal
    ROM:000459AA tst.b ($FFFFA4B9).w ; Test an Operand
    ROM:000459AE bne.s loc_459B6 ; Branch if Not Equal
    ROM:000459B0 move.b #$F4,d0 ; Move Data from Source to Destination
    ROM:000459B4 bra.s loc_4596E ; Branch Always
    ROM:000459B6 ; ---------------------------------------------------------------------------
    ROM:000459B6
    ROM:000459B6 loc_459B6: ; CODE XREF: sub_45836+178j
    ROM:000459B6 btst #4,($FFFF982E).w ; Test a Bit
    ROM:000459BC beq.s loc_459C8 ; Branch if Equal
    ROM:000459BE move.b #$F4,d0 ; Move Data from Source to Destination
    ROM:000459C2
    ROM:000459C2 loc_459C2: ; CODE XREF: sub_45836+14Cj
    ROM:000459C2 ; sub_45836+16Cj
    ROM:000459C2 jsr SET_DTC ; Jump to Subroutine
    ROM:000459C8
    ROM:000459C8 loc_459C8: ; CODE XREF: sub_45836+34j
    ROM:000459C8 ; sub_45836+3Cj ...
    ROM:000459C8 move.l (sp)+,d1 ; Move Data from Source to Destination
    ROM:000459CA unlk a6 ; Unlink
    ROM:000459CC rts ; Return from Subroutine
    ROM:000459CC ; End of function sub_45836


    I count sheep in hex...