CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Converting Pseudocode into LC-3 Assembly

  1. #1
    Join Date
    Feb 2011

    Converting Pseudocode into LC-3 Assembly

    In this program I have to bit shifting when multiplying two numbers together. I know the basis of what the program is supposed to have achieve I just don't know the exact way to implement it as my LC-3 skills are lacking a bit.

    I need help converting this multiplication algorithm psuedocode

    Any help will be much appreciated. Thank you.

  2. #2
    Join Date
    Jan 2009

    Re: Converting Pseudocode into LC-3 Assembly

    It is better to post code directly into your post, rather than link to an image on another site. So here is the code in that image:
    // Compute product P < XY
    // Y is the multiplicand
    // X=x15;x14;x13...x1;x0 is the multiplier
    P < 0 // Initialize product
    for i=0 to 14 do     // Exclude the sign bit
        if X[i] = 1 then
            P < P + Y     // Add
        Y < Y + Y     // Shift left
    As to your original question, LC-3 doesn't support bit shifting. You will just have to add the number to itself, like in the pseudocode supplied

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)