Announcement

Collapse
No announcement yet.

Need some 68000 ASM help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need some 68000 ASM help

    I've run across some 68000 assembly that I'm not familiar with and was hoping someone could give me some info.

    I'll post the assembly trace first, then I'll ask my question below...


    00:BB88 EE 48 LSR.W #7,D0 A0=000113C0 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00001000 D1=00000006 D2=00000020 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnzvc

    00:BB8A 32 00 MOVE.w D0,D1 A0=000113C0 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000020 D1=00000006 D2=00000020 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnzvc

    00:BB8C 34 2B MOVE.w $0054(A3),D2 A0=000113C0 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000020 D1=00000020 D2=00000020 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnzvc

    00:BB90 E5 42 ASL.W #2,D2 A0=000113C0 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000020 D1=00000020 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnZvc

    00:BB92 20 7C MOVE.l #$00010E64,A0 A0=000113C0 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000020 D1=00000020 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnZvc

    00:BB98 C1 F0 MULS.W $00(A0,D2),D0 A0=00010E64 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000020 D1=00000020 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnZvc

    00:BB9C C3 F0 MULS.W $02(A0,D2),D1 A0=00010E64 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000000 D1=00000020 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnZvc

    00:BBA0 D1 6B ADD.W D0,$0028(A3) A0=00010E64 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000000 D1=00001900 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnzvc

    00:BBA4 D3 6B ADD.W D1,$002A(A3) A0=00010E64 A1=FFFFCA32 A2=FFFFC6CE A3=FFFFB04A A4=FFFFB88A A5=FFFFD404 A6=00000000 A7=FFFFFFF2 D0=00000000 D1=00001900 D2=00000000 D3=00000020 D4=00000000 D5=0000FF00 D6=00000000 D7=00000001 xnZvc

    =================================

    Here's my question: At the very bottom of the trace (00:BBA4), the value I'm interested in is in register D1 (1900). I can see that at 00:BB9C, they are multiplying the value at ROM address $00010E66 (which is 00C8) by D1 (which is 0020): C8 x 20 = 1900. No problems so far. For the GG code I want to make, I can't modify the "C8" value because it affects other things, so I want to find out where the "20" value is coming from (in D1). I traced the 20 in D1 back to 00:BB8A 32 00 MOVE.w D0,D1 where the 0020 in register D0 is moved to D1. Now all I have to do is figure out where the 20 in D0 is coming from. This is where I'm having problems. I don't know what this line means:

    00:BB88 EE 48 LSR.W #7,D0

    This is what seems to load the "20" into D0, but I have no idea how. Can anyone help with this? Do I need to include more of the trace?

    Thanks for any help.
    The Code Hut: http://codehut.gshi.org/

  • #2
    LSR.W #7,D0 means Logical Shift Right D0 7 places (it is similar to an ASL - Arithmetic Shift Right except the sign is not shifted)

    So

    when LSR.W #7,D0 is run it contains 0x00010000 convert this into binary:-

    1000000000000
    0100000000000 <-first lsr
    0010000000000
    0001000000000
    0000100000000
    0000010000000
    0000001000000
    0000000100000 <seventh lsr

    So at the end of the LSR - D0 contains Binary 0000000100000

    Convert this into Hex and we have 00000020

    So if you want 0x40 instead of 0x20 just change it into a LSR.W #6,D0 or 0x80 into LSR.W #5,D0

    Alternatively you can reuse the 4 bytes at BB88,BB89,BB8A & BB8B for a MOVE.W #$0020,D1(or other value instead of 0020) for simplicity as the D0 register is not read again before it is overwritten at BB98.
    Last edited by Pugsy; 05-17-2007, 11:06:38 AM.
    Pugsy's MAME Cheat Page : http://mamecheat.co.uk

    Comment


    • #3
      Thanks Pugsy. Appreciate the help. This one had me stumped.
      The Code Hut: http://codehut.gshi.org/

      Comment

      Working...
      X