Question: The purpose of this assignment is to write a program in LC-3 machine language to find if a given input is a power of 2

The purpose of this assignment is to write a program in LC-3 machine language to find if a given input is a power of 2 and a perfect square. If it is then, write its exponent (as power of 2) as the result otherwise, write -1 as the result.

Description:

Find if a given number N at location x2FFE is, a power of 2 and a perfect square; If yes, write its exponent (k where N=2^k) to x2FFF, else write a -1 to x2FFF

Notes: Program must be at x3000. Program must be written in binary Do not assume any values in registers

0010000000000000 ; First line says where the program must load to Put your code here 1111000000100101 ; Halt machine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!