LC-3 Motor Program (Strange Outputs) <p>So the output to my LC-3 program is giving me very strange characters/symbols. The objective of this program is to ask a user to input a 0 or a 1. If the user inputs a 1, the motor moves 120 degrees clockwise and then 90 degrees counter clockwise. If the user inputs a 0, the motor moves 50 degrees counter clockwise. 360 degrees = 36 steps. What is a step? A step is 10 degrees. The output prints out each step. For example, the user inputs a 0 then the output should say:</p> <pre><code>The motor moved 10 degrees CCW The motor moved 10 degrees CCW The motor moved 10 degrees CCW The motor moved 10 degrees CCW The motor moved 10 degrees CCW </code></pre> <p>It's a pretty interesting task imo but I'm having trouble actually making it work. Attached is my code and a screenshot of my output. Thanks for your time!</p> <p>Can't embed picture since this account is new but the link of the screenshot of my output is below: <a href="http://i.stack.imgur.com/wZi29.png" rel="nofollow">http://tinypic.com/r/9roghf/9</a></p> <p>It also seems like the code didnt embedded correctly but please consider everything below as part of the code (Because it is!):</p> <pre><code>.ORIG x4000 ;Constants Prompt .STRINGZ "Enter '1' to move moter 120 degrees clockwise then 90 degrees counter clockwise or Enter '0' to move motor 50 degree counter clockwise" CW .STRINGZ "The motor rotated 10 degrees clockwise" CCW .STRINGZ "The motor rotated 10 degrees counterclockwise" RL ;Clear and Load Register 2 AND R2, R2, #0 ADD R2, R2, #12 ;Clear and Load Register 3 AND R3, R3, #0 ADD R3, R3, #3 ;Clear and Load Register 4 AND R4, R4, #0 ADD R4, R4, #2 ;Clear And Load Register 5 AND R5, R5, #0 ADD R5, R5, #1 LL0 ;user input LEA R0, Prompt PUTS ;Print String GETC ;Receive user input OUT ;Prints out user input BRz LL3 ;If user input 0 BRp LL1 ;If user input 1 ;beginning of '1' loop ;120 degree clockwise rotation LL1 LEA R0, CW ADD R2, R2, #-6 ;1 Bit Shift (Right) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #-3 ;1 Bit Shift (Right) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #6 ;1 Bit Shift (Right) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #3 ;1 Bit Shift (Right) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R3, R3, #-1 ;Decrement Loop (3x) BRp LL1 ;90 degree counter clockwise rotation LL2 LEA R0, CCW ADD R2, R2, #-3 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT BRz Stop ;After 90 degree turn ADD R2, R2, #-6 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #3 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #6 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R4, R4, #-1 ;Decrement Loop (2x) BRzp LL2 ;beginning of '0' loop ;50 degree counter clockwise LL3 LEA R0, CCW ADD R2, R2, #-3 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT BRz Stop ;After 50 degree turn ADD R2, R2, #-6 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #3 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R2, R2, #6 ;1 Bit Shift (Left) - 10 degree turn PUTS AND R0, R0, #0 ADD R0, R0, #10 OUT ADD R5, R5, #-1 ;Decrement Loop (1x) BRz LL3 Stop HALT .END </code></pre>