Question
I dont think there is one correct answer for this, but I dont understand how to write the Little Man Computer code. The instruction is
I dont think there is one correct answer for this, but I dont understand how to write the Little Man Computer code.
The instruction is to convert a base 10 number to binary.
The range for the input is 0 to 63. Anything above 63 would end the program.
The following are instructions from the instructor. It doesnt make sense to me but Im hoping someone with experience with LMC can create some code.
We need to understand that for an output of the LMC you get a max of 3 decimal numbers. So, what if 5 digits were needed, say 12345? There would have to be 2 output statements: MSB and LSB. (most significant digit and least significant digit).
So MSB => 012 and LSB => 345. In the project, we want binary out 9 digits. So MSB, Middle, and LSB.
53 Decimal is: MSB => 110, and LSB => 101
Code may look like:
input
sto TMP_IN ; get number to convert
sub six ; subtract 32
brp cal_1 ; branch around
br nxt_1 ; branch around
cal_1 sto TMP
DAT six 032
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started