Write a subroutine called MUL3 that rounds the content of

Chapter 8, Problem P8.45

(choose chapter or problem)

Write a subroutine called MUL3 that rounds the content of A to its nearest integer multiple of 3. Assume that the initial content of A is a positive integer in twos-complement form. Memory location $0A can be used for temporary storage. Include comments in your source code to explain the program and its operation to human readers. (Hint: Repeatedly subtract 3 until the result becomes negative. If the result is 3, the original content of A was a multiple of 3 and should not be changed. If the result is 2, the original content of A was one plus an integer multiple of 3, and we should subtract one from the original number to obtain the nearest multiple of 3. If the result is 1, the original content of A is 2 plus an integer multiple of 3, and we should add 1 to the original number to obtain the nearest multiple of 3.)

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back