Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Brookshear Machine- Modify the code so that it adds 2, 12, and -4 instead So far, I have converted the three numbers to be added

Brookshear Machine- Modify the code so that it adds 2, 12, and -4 instead

So far, I have converted the three numbers to be added to get:

Twos complement notation

2: 0000 0010

12: 0000 1100

-4: 1111 1100

Convert to hexadecimal

2: 02

12: 0c

-4: fc

Padded

2: 0200

12: 0c00

-4: fc00

But I am unsure of how to load them into the register and how to create the code to add the numbers. Thanks!

image text in transcribed

image text in transcribed

If you wanted to add two numbers together, for example, such as 14 and -6, these would have to be converted to two's complement notation in 8 bits. 14 converts to 0000 1110 in two's complement, binary notation, 8 bits. -6 converts to 1111 1010 in the same notation. Now we need to convert the binary to hexadecimal which we do by replacing each four bits with a hexadecimal digit as in Figure 1.6 on page 25 of the text. 0000 1110 converts to 0e 1111 1010 converts to fa To add these we need to enter them into memory cells, The cells hold 16 bits each in Memory List format, but our data is only 8 bits, so we have to pad our data to fit. We would put Oe00 and fa00 into two cells as data. The extra 00 in each is not used when the data in that address is read The Brooshear Machine applet can be found here: http://bmachine.sourceforge.net/ (to be able to run it you will need to have Java installed on your machine). Running the applet is not required for this assignment Here is an example of a program to add the two numbers -6 and 14 as entered in the applet. The first five memory locations hold instructions while the next two hold -6 and 14. The address location 0a holds -6 as fa with padding of 00, while address location 0c holds 14 as Oe with padding of 00 emory LiS 00 100a Load register O with bit pattern found at 0a 02 110c Load register 1 with bit pattern found at 0c 04 5201 Add registers 0 and 1 as two's complement, store result in register 2 06 320e Store bit pattern from register 2 at address O 08 c000 Halt execution Oa fa00 Oc 0e00 Oe emo If you wanted to add two numbers together, for example, such as 14 and -6, these would have to be converted to two's complement notation in 8 bits. 14 converts to 0000 1110 in two's complement, binary notation, 8 bits. -6 converts to 1111 1010 in the same notation. Now we need to convert the binary to hexadecimal which we do by replacing each four bits with a hexadecimal digit as in Figure 1.6 on page 25 of the text. 0000 1110 converts to 0e 1111 1010 converts to fa To add these we need to enter them into memory cells, The cells hold 16 bits each in Memory List format, but our data is only 8 bits, so we have to pad our data to fit. We would put Oe00 and fa00 into two cells as data. The extra 00 in each is not used when the data in that address is read The Brooshear Machine applet can be found here: http://bmachine.sourceforge.net/ (to be able to run it you will need to have Java installed on your machine). Running the applet is not required for this assignment Here is an example of a program to add the two numbers -6 and 14 as entered in the applet. The first five memory locations hold instructions while the next two hold -6 and 14. The address location 0a holds -6 as fa with padding of 00, while address location 0c holds 14 as Oe with padding of 00 emory LiS 00 100a Load register O with bit pattern found at 0a 02 110c Load register 1 with bit pattern found at 0c 04 5201 Add registers 0 and 1 as two's complement, store result in register 2 06 320e Store bit pattern from register 2 at address O 08 c000 Halt execution Oa fa00 Oc 0e00 Oe emo

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions