Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi! I have asked this question before, but I'm still lost. Basically I'm trying to solve these questions using machine language: 1. 24-12 2. -125-30

Hi! I have asked this question before, but I'm still lost. Basically I'm trying to solve these questions using machine language:

1. 24-12 2. -125-30

I have provided you with images of how I have tried to solve these questions, and I do get the correct answers, but my method is not flawless. Keep in mind that the program I'm using can not subtract. Here's a list of the codes:

image text in transcribed

Question 1:

I turn 24 into a hexadecimal, which will be 18. I also turn -12 into a hexadecimal which will be FFF4. However I cannot use but in a number with 4 digits, I can only write numbers with 2. If I only put in F4 I get the correct answer. Below I have provided you with the code I wrote to solve this question and and an image of the explanation I've been given I do not understand how I'm suppost to use this explanation in the code? What does it have to do with the code? If this is how I should solve it, then can you write the code, because otherwise I don't understand.

image text in transcribed

image text in transcribed

Question 2:

In question to I did the same thing, which means it has the same problem. FF is missing from both numbers this time.

image text in transcribed

Perhaps my codes are correct and there is no better way, but if there are better ways please show me!

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 . C0: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. Memory Control Unit Registers 1. 24-12: - Convert 24 to binary: 11000 - Convert 12 to binary: 01100 - Perform binary subtraction: 11000 01100=100 2. 12530 : - Convert 125 to binary: 1111101 - Convert the binary to its two's complement form: 00000010 (flip all bits, then add 1) Convert 30 to binary: 011110 Convert the binary to its two's complement form: 100010 (flip all bits, then add 1) Perform binary addition: 00000010+ 100010=100100 Explanation In the two's complement format, negative numbers are represented by flipping all the bits in the binary representation of the positive number (0 to 1 , and 1 to 0 ), then adding 1 to the outcome. As a result, binary arithmetic can express and handle negative values. Control Unit Registers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions