1. Registry conditions:
A. Show how the decimal integer
* -120 would be
stored in 16 bits
* -120 would be
stored in 8 bits
* -32456 would be
stored in 32 bits
* -32456 would be
stored in 16 bits
B. For each of the
following decimal numbers, tell whether it could be
stored (1) as a 16-bit
number (2) as an 8-bit number.
* 32768
* -40000
* 65536
* 257
* -128
C. For each of the
following 16-bit signed numbers, tell whether it is
positive or
negative.
*
1010010010010100b
* 78E3h
* CB33h
* 807Fh
* 9AC4h
D. For each of the
following instructions, give the new destination contents
and the new settings of
CF,SF,ZF,PF, and OF. Suppose that the flags are
initially 0 in each part
of this question. (Note: need not show AF)
* ADD
AX,BX where AX contains 7FFFh and BX contains
0001h.
* SUB
AL,BL where AL contains 01h and BL contains FFh.
* DEC
AL where AL contains 00h.
* NEG
AL where AL contains 7Fh.
* XCHG
AX,BX where AX contains 1ABCh and BX contains
712Ah.
* ADD
AL,BL where AL contains 80h and BL contains FFh.
* SUB
AX,BX where AX contains 0000h and BX contains
8000h.
* NEG
AX where AX contains 0001h.
E. Suppose ADD
AX,BX is executed. In each of the following part, the first
number being added
is the contents of AX, and the second number is the
contents of BX.
Give the resulting value and tell whether unsigned or signed
overflow
occurred.
512Ch
+4185h
------
FE12h
+1ACBh
------
E1E4h
+DAB3h
------
7132h
+7000h
------
6389h
+1176h
------
F. Suppose SUB
AX,BX is executed. In each of the following part, the first
number is the
initial contents of AX and the second number is the contents
of
BX. Give the
resulting value and tell whether unsigned or signed overflow
occurred.
2143h
-1986h
------
81FEh
-19BCh
------
19BCh
-81FEh
------
0002h
-FEOFh
------
8BCDh
-71ABh
------
A.
In signed representation, the most significant bit is reserved for the sign (0 for +, 1 for -). A negative number is represented in 2's complement. 2's complement is obtained by adding 1 to 1's complement.
120 in binary notation is (in 16 bits): 0000 0000 0111 1000
1's complement is: 1111 1111 1000 0111
2's complement: 1111 1111 1000 1000
In 8 bits, 120: 0111 1000
1's complement is: 1000 0111
2's complement is: 1000 1000
32456 in binary notation (32 bits) is: 0000 0000 0000 0000 0111 1110 1100 1000
1's complement is: 1111 1111 1111 1111 1000 0001 0011 0111
2's complement is: 1111 1111 1111 1111 1000 0001 0011 1000
In 16 bits, 32456 is 0111 1110 1100 1000
1's complement is: 1000 0001 0011 0111
2's complement is: 1000 0001 0011 1000
B.
If N bits are used to store numbers, signed integers can range from: -2N-1 to 2N-1 - 1
If N bits are used to store unsigned numbers (only positive values), the range is 0 to 2N - 1.
So for 16-bit signed integers, the range is -32768 to 32767
For 16-bit unsigned integers, the range is 0 to 65535
For 8-bit signed integers, the range is -128 to 127
For 8-bit unsigned integers, the range is 0 to 255
So the answers are:
C.
The most significant bit represents the sign. So if the MSB is 1, it is a negative number, other wise it is a positive number.
In hexadecimal notation, if the MSB is 1, the fourth hexadecimal number (most significant) will be greater than or equal to 8, i.e. the range is 8, 9, A, B, C, D, E, F for negative numbers.
Based on the above explanation,
As per HomeworkLib rules, only 4 subparts of a question need to be answered. 4 subparts of three questions have been answered above. For the rest, please raise a separate question.
1. Registry conditions: A. Show how the decimal integer * -120 would be stored...
Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1. Give the new contents of AL after each of the following instructions is executed. Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH. Show the contents of BX and CX after...
Suppose SUB AX, BX is executed. In each of the following parts, the 1st number is the initial contents of AX and the second number is the contents of BX. Give the resulting value of AX and tell whether signed or unsigned overflow occurred. a. 2143h - J986h b. 8JFEh - 1986h c. 19BCh - 81fEh d. 0002h – FEOFh e. 8BCDh -...
For each part, do or answer the following: - Show how you would add the two 8-bit binary numbers by filling in each of the blank boxes with a 0 or 1. NOTE1: Addition of 2's complement numbers is done just like the addition of unsigned whole numbers, so you only need to show each addition once. NOTE2: There are 9 blank boxes for the Carry bits and 8 blank boxes for the Sum bits. CAUTION: Every blank box should...
(3 pts) Consider an unsigned fixed point decimal (Base10) representation with 8 digits, 5 to the left of the decimal point and 3 to the right. a. What is the range of the expressible numbers? b. What is the precision? c. What is the error? ______________________________________________________________________________ (3 pts) Convert this unsigned base 2 number, 1001 10112, to each base given below (Note: the space in the binary string is purely for visual convenience) Show your work. Using...
1.) a.) Using the simplified instruction set shown for part b, write code for the following. Suppose memory locations 1400 to 1449 contain 16-bit words. Each word represents 2 ASCII characters. Write code to read in and write out these 100 characters. Left-side character from location 1400 should be first, right-side character from location 1400 should be second, and remaining characters follow in numeric order. Assume you have access to 4 registers: R1, R2, R3, R4. Each register holds one...
Group Project 1 The Micro-1 Processor Simulation <Micro-1 Computer> Here's the organization of a computer equipped with a Micro-1 processor Memory contains an array of integer cells: int cell[] = new int[CAP]; where CAP is the capacity of memory. Initially this is set to 256. Internally, the Micro-1 processor is equipped with eight 32-bit data/address registers and two 32 bit control registers: PC, the program counter, contains the address of the next instruction to execute. IR, the instruction register, contains...
There is an example below Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A The MiteASM Assembler and Appendix B The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should 1. display a count on the 7-segment display. The count should increase by 1 when button 0 is pressed. It should reset to 0 when button...
pls answer all questions 1) A step-by-step solution to a problem is called a. hardware b. an operating system c. a computer language d. an algorithm 2) separated the programming task from the computer operation tasks. a. Algorithms b. Data processors c. High-level programming languages d. Operating systems 3) is a 16-bit code that can represent symbols in languages other than English. a. ASCII b. Extended ASCII c. EBCDIC d. Unicode 4) When you want to download music to a...
Rational Number *In Java* A rational number is one that can be expressed as the ratio of two integers, i.e., a number that can be expressed using a fraction whose numerator and denominator are integers. Examples of rational numbers are 1/2, 3/4 and 2/1. Rational numbers are thus no more than the fractions you've been familiar with since grade school. Rational numbers can be negated, inverted, added, subtracted, multiplied, and divided in the usual manner: The inverse, or reciprocal of...
AssignmentBitmap files map three 8-bit (1-byte) color channels per pixel. A pixel is a light-emitting "dot" on your screen. Whenever you buy a new monitor, you will see the pixel configuration by its width and height, such as 1920 x 1080 (1080p) or 3840x2160 (4K). This tells us that we have 1080 rows (height), and each row has 1920 (width) pixels.The bitmap file format is fairly straight forward where we tell the file what our width and height are. When...