Home / Expert Answers / Computer Science / how-to-solve-these-2-problem-by-using-nbsp-lc3-assembly-language-for-example-nbsp-question-1-pa574

(Solved): How to solve these 2 problem by using Lc3 assembly language, For example,  Question: 1) ...



How to solve these 2 problem by using Lc3 assembly language,

For example, \begin{tabular}{lll} 
& .ORIG & \multicolumn{1}{l}{ X3000 } \\
& LD & R0, NUMBERS \\
& LD & R2, MASK \\
LOOP & LDR & R1, R0,

Question:

1) Write a simple LOOP program to add “1+2+3+4+5+6+7+8+9+10” and output the sum;

2) Write a program to check for ODD/EVEN number. Make it loops many times, finishes when user enter ‘0’: (Assuming user only input single digit number 1~9, and exit when the input is ‘0’)

       example:

                Please enter a number: 2

                Thanks, 2 is an even number.

                Please enter a number: 9

                Thanks, 9 is an odd number.

                Please enter a number: 0

                Thanks, see you again.

please do it in assembly language, not in C or other high level language, really need help!

\begin{tabular}{lll} & .ORIG & \multicolumn{1}{l}{ X3000 } \\ & LD & R0, NUMBERS \\ & LD & R2, MASK \\ LOOP & LDR & R1, R0, \#0 \\ & BRz & DONE \\ & AND & R5, R1, R2 \\ & BRz & L1 \\ & BRnzP & NEXT \\ LI & ADD & R1, R1, R1 \\ & STR & R1, R0, \#0 \\ NEXT & ADD & R0, R0, \#1 \\ & BRnzP & LOOP \\ DONE & HALT & \\ NUMBERS & FILL & X4000 \\ MASK & .FILL & X8000 \end{tabular}


We have an Answer from Expert

View Expert Answer

Expert Answer


PROGRAM TO FIND SUM: .MODEL small .STACK 100h .DATA ARR db
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe