Converting Pseudocode into LC-3 Assembly
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Converting Pseudocode into LC-3 Assembly

  1. #1
    Join Date
    Feb 2011
    Posts
    15

    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

    http://imageshack.us/photo/my-images/43/capturelo.jpg/


    Any help will be much appreciated. Thank you.

  2. #2
    Join Date
    Jan 2009
    Posts
    596

    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:
    Code:
    // 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

This is a CodeGuru survey question.


Featured


HTML5 Development Center