Multiply Word By Byte

Discussion in 'Sega Discussion' started by Scorpion Illuminati, Dec 4, 2015.

  1. Scorpion Illuminati

    Scorpion Illuminati Scorpion Illuminati Lead Developer(Site Supporter)

    Joined:
    Oct 1, 2015
    Messages:
    15
    Likes Received:
    1
    Location:
    Cyber Space
    I have a byte variable called multiplier in ram. I want to multiply 100 by it's value and add the result to another ram value of type wordword called score. What would be the simplest approach to doing it? Any assistance in this matter would be greatly appreciated.

    Sincerely,

    Scorpion Illuminati
     
    #1
  2. dutchconsolefreak

    dutchconsolefreak Peppy Member

    Joined:
    Sep 8, 2005
    Messages:
    315
    Likes Received:
    3
    Location:
    Amsterdam
    Something like this (in 68000):

    move.w $score,d0
    move.b $multiplier, d1
    move.w d1,d2
    move.w d1,d3
    lsl.w #6,d1
    lsl.w #5,d2
    lsl.w #2,d3
    add.w d3,d2
    add.w d2,d1
    add.w d1,d0
    move.w d0,$score
     
    #2

Share This Page