Write short Assembly programs to perform the following functions. Use at least one label in each segment of code (a~e). You must comment each line of your code. Please copy your mnemonic code to your HW document instead of pasting a screenshot of your code. I need to test your work by copying your code to LMC. 1. Input X IF (X == 0) Output -1 ELSE Output 1 2. Input X IF (X == 3) Output -1 ELSE Output 1 3. Input X WHILE (X < 4) { Output X X = X + 1 }
Added by Diana W.
Step 1
Input X IF (X == 0) Output -1 ELSE Output 1 a. INP b. BRZ zero c. LDA one d. BRA end zero: LDA minus_one end: OUT HLT Show more…
Show all steps
Your feedback will help us improve your experience
Shaik Dadasaheb and 52 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Sri K.
Given the following pseudocode, code a solution in LEGv8 assembly language, using the instructions on zyBooks section 2.24. The code should initialize registers for unsigned values and then loop until the condition is met and then exit the loop. In addition, comment each line of assembly code stating with a short sentence the purpose/action of the instruction. Hint: X# are registers; also, use the ARM Simulator (alpha) on zyBooks section 2.24 to test your code. X1 = 5; X2 = 10; while (X2 >= X1) { X2 = X2 - 1; }
Krishna G.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD