Question: This program accepts an integer between -511 to +511 typed in by user. It works as in Part 2 until a valid number is entered,

This program accepts an integer between -511 to +511 typed in by user. It works as in Part 2 until a valid number is entered, then the program prints the binary version of the number as an integer and follows it by printing the binary representation of the number as a 16-bit floating point number. Bit 15 is the sign bit. Bits 14 - 11 is the biased exponent (bias of 7). Bits 10 - 0 is the mantissa (fractional part). Remember there is an implicit 1 for the fractional part. On the next page are some example interactions with the program.

You must use subroutines for this program. To assist you to design your code there is a file called part4.asm which you must add to. You must not add any lines of code before the halt instruction. Example input and output.

This program accepts an integer between -511 to +511 typed in by

Zero is a special case.

user. It works as in Part 2 until a valid number is

When writing assembly language the temptation is to treat most values as globally accessible. The solution to this is to pass parameters and return values on the stack as in higher level languages. For this assignment you may use globally accessible values when that makes sense e.g. the input

buffer used when the user types a number in can be accessed without having to pass its address to the subroutines which use it. You should save all registers (except R0) when you enter a subroutine and restore them on exit. This is not strictly necessary in this assignment because the top-level program doesn't depend on registers maintaining their values. On a related point most programming languages keep all of the code separated from the data. In assembly language that is also a good idea but for this assignment it may be easier if you keep data associated with a subroutine near that subroutine. It makes it easier for you to read and fix your code. Also many of the LC-3 addressing modes limit offsets from the current value of PC to 256 words.

L LC3 Console ter an integer between-511 and +511: +64 0 0 0 0 00001 000 0 0 0110100000 000 00 0 Halting the processor-- ter an integer between-511 and +511:-64 1110100 000 0000 0 0 _ Halting the processor ter an integer between -511 and +511:-129 111 000000 0 1 0 0 0 0 Halting the processor- ter an integer between -511 and +511: +511 Halting the processor L LC3 Console ter an integer between-511 and +511: +64 0 0 0 0 00001 000 0 0 0110100000 000 00 0 Halting the processor-- ter an integer between-511 and +511:-64 1110100 000 0000 0 0 _ Halting the processor ter an integer between -511 and +511:-129 111 000000 0 1 0 0 0 0 Halting the processor- ter an integer between -511 and +511: +511 Halting the processor

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!