Question
Hi! I asked this question before but I believe I either received the wrong answer, or maybe I didn't understand it. I'm trying to calculate
Hi! I asked this question before but I believe I either received the wrong answer, or maybe I didn't understand it. I'm trying to calculate the following questions using machine language.
1. 24-12 2. -125-30
I was told that I should convert the numbers to 2 complement binary form in order to calculate it. But the what? Do I turn the birnary numbers into hex numbers? This is what I did at first:
But if I do follow the suggestion and turn lets say -125 and -30 it will look like this:
-125=1000 0011 in binary 2 com=83 in hex -30=1110 0010 in binary 2 com=E2 in hex
But is this really the right way to go?
If I solve question 1 this way I get the right answer. When it's suppost to be FFF4 instead of just F4 for -12.
I feel like I'm doing this all wrong. I don't understand how I'm suppost to do this. Below there is a list of the codes.
CPU Memory U Memory Control Unit Memory CPU Memory Control Unit 1R:XY Load register R with bit pattern in memory cell with adress XY 2R:XY Load register R with bit pattern XY 3R:XY Store bit pattern in register R in memory cell with adress XY 40:RS Move bit pattern in register R in register S 5R:ST Add bit pattern in register S and T. Put the result in register R. Bit pattern is supposed to be in 2-complement. 6R:ST Add bit pattern in register S and T. Put the result in register R. 7R:ST OR the bit patterns in register S and T. Put the result in register R. 8R:ST AND the bit patterns in register S and T. Put the result in register R. 9R:ST XOR the bit patterns in register S and T. Put the result in register R. AR:OX Rotate bit pattern in register R one bit to the right X times. BR:XY Jump to memory cell with adress XY if bit pattern in register R is equal to bit pattern in register 0 . Co:00 Halt the program DR:0X Shift bit pattern in register R one bit to the left X times. ER:OX Shift bit pattern in register R one bit to the right X times
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