CSC 231 1 Devon M. Simmonds University of North Carolina, Wilmington CSC231 Data Structures.
CSC231—Assembly · mith College C omputer Science Dominique Thiébaut [email protected]...
Transcript of CSC231—Assembly · mith College C omputer Science Dominique Thiébaut [email protected]...
![Page 1: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/1.jpg)
mith College
Computer Science
Dominique Thiébaut [email protected]
CSC231—AssemblyWeek #7 — Fall 2017
![Page 2: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/2.jpg)
D. Thiebaut, Computer Science, Smith College
Exercise
x dd 0most dd 0least dd 0
call _getInput ; eax <- user input mov dword[x], eax
; set most to contain all 0s except most; significant bit of x. Set least to ; contain all 1s except least significant; nybble of x
![Page 3: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/3.jpg)
D. Thiebaut, Computer Science, Smith College
Logic Design
![Page 4: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/4.jpg)
D. Thiebaut, Computer Science, Smith College
Image from http://www.willegal.net/appleii/images/motherboard.jpg
Apple II Motherboard
![Page 5: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/5.jpg)
D. Thiebaut, Computer Science, Smith College
Logic Design
![Page 6: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/6.jpg)
D. Thiebaut, Computer Science, Smith College
A Bit of History
• Claude Shannon • 21 years old • 1937 • MIT Master's Thesis • All arithmetic operations
on binary numbers can be performed usingboolean logic operators
https://en.wikipedia.org/wiki/Claude_Shannon
![Page 7: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/7.jpg)
D. Thiebaut, Computer Science, Smith College
Designing a 2-bitAdder with Logic
Gates
![Page 8: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/8.jpg)
D. Thiebaut, Computer Science, Smith College
a b
s
?
![Page 9: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/9.jpg)
D. Thiebaut, Computer Science, Smith College
0 + 0 = .
0 + 1 = .
1 + 0 = .
1 + 1 = .
![Page 10: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/10.jpg)
D. Thiebaut, Computer Science, Smith College
a b
s
?cy
2 inputs and 2 outputs
![Page 12: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/12.jpg)
D. Thiebaut, Computer Science, Smith College
https://www.youtube.com/watch?v=xTQDIiSWK_k
![Page 13: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/13.jpg)
D. Thiebaut, Computer Science, Smith College
NEGATIVE NUMBERS
![Page 14: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/14.jpg)
D. Thiebaut, Computer Science, Smith College
![Page 15: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/15.jpg)
D. Thiebaut, Computer Science, Smith College
ALU
CU
Processor
![Page 16: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/16.jpg)
D. Thiebaut, Computer Science, Smith College
ALU
yixi
sumi
carryi
Compute add x, y
![Page 17: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/17.jpg)
D. Thiebaut, Computer Science, Smith College
yx
z
…
x0 y0x1 y1x2 y2xn yn x3 y3
z0z1z2z3z31
![Page 18: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/18.jpg)
D. Thiebaut, Computer Science, Smith College
x0y0
z0
0+ 0 ____
= 0 0
0+ 1____
= 0 1
1+ 0____
= 0 1
1+ 1____
= 1 0
carry
![Page 19: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/19.jpg)
D. Thiebaut, Computer Science, Smith College
x0 y0 Carry z0
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
![Page 20: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/20.jpg)
D. Thiebaut, Computer Science, Smith College
x0 y0 Carry z0
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Carry = x0 and y0
z0 = x0 xor y0
![Page 21: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/21.jpg)
D. Thiebaut, Computer Science, Smith College
x0
z0
XORAND
y0
carry
![Page 22: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/22.jpg)
D. Thiebaut, Computer Science, Smith College
yx
z
…
x0 y0x1 y1x2 y2xn yn x3 y3
z0z1z2z3z31
![Page 23: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/23.jpg)
D. Thiebaut, Computer Science, Smith College
Moral of the Story:Addition is performed
by logic operationsusing natural binary numbers…
(unsigned arithmetic)
![Page 24: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/24.jpg)
D. Thiebaut, Computer Science, Smith College
How can we represent signed binary numbers when
all we have are bits (0/1)?
Whichever system we use should work with the binary adder in the ALU…
![Page 25: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/25.jpg)
D. Thiebaut, Computer Science, Smith College
Binary Hex Unsigned Decimal
0000 0 00001 1 10010 2 20011 3 30100 4 40101 5 50110 6 60111 7 71000 8 81001 9 91010 A 101011 B 111100 C 121101 D 131110 E 141111 F 15
4-bit Nybble
![Page 26: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/26.jpg)
D. Thiebaut, Computer Science, Smith College
Binary Hex Unsigned Decimal
0 000 0 00 001 1 10 010 2 20 011 3 30 100 4 40 101 5 50 110 6 60 111 7 71 000 8 81 001 9 91 010 A 10 1 011 B 111 100 C 121 101 D 131 110 E 141 111 F 15
4-bit NybbleSign Bit
![Page 27: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/27.jpg)
D. Thiebaut, Computer Science, Smith College
Binary Hex Unsigned Decimal
0 000 0 00 001 1 10 010 2 20 011 3 30 100 4 40 101 5 50 110 6 60 111 7 71 000 8 81 001 9 91 010 A 10 1 011 B 111 100 C 121 101 D 131 110 E 141 111 F 15
PositiveNumbers
NegativeNumbers
4-bit Nybble
![Page 28: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/28.jpg)
D. Thiebaut, Computer Science, Smith College
Signed MagnitudeNumber System
![Page 29: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/29.jpg)
D. Thiebaut, Computer Science, Smith College
Signed Magnitude Rule: To find the opposite of a number, just flip
its MSB
0 101 (+5)
1 101(-5)
and vice versa…
![Page 30: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/30.jpg)
D. Thiebaut, Computer Science, Smith College
4-bit NybbleBinary Hex Unsigned
DecimalSigned
Magnitude0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -01 001 9 9 -11 010 A 10 -2 1 011 B 11 -31 100 C 12 -41 101 D 13 -51 110 E 14 -61 111 F 15 -7
![Page 31: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/31.jpg)
D. Thiebaut, Computer Science, Smith College
Does this System workWith the ALU Adder?
Binary Hex Unsigned Decimal
Signed Magnitud
e0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -01 001 9 9 -11 010 A 10 -2 1 011 B 11 -31 100 C 12 -41 101 D 13 -51 110 E 14 -61 111 F 15 -7
3 + -3 ——- = 0
4 + -1 ——- = 3
![Page 32: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/32.jpg)
D. Thiebaut, Computer Science, Smith College
1's ComplementNumber System
![Page 33: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/33.jpg)
D. Thiebaut, Computer Science, Smith College
1's Complement Rule: To find the opposite of a number,
just flip all its bits
0 101 (+5)
1 010(-5)
and vice versa…
![Page 34: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/34.jpg)
D. Thiebaut, Computer Science, Smith College
4-bit NybbleBinary Hex Unsigned
Decimal1's
Complement0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -71 001 9 9 -61 010 A 10 -5 1 011 B 11 -41 100 C 12 -31 101 D 13 -21 110 E 14 -11 111 F 15 -0
![Page 35: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/35.jpg)
D. Thiebaut, Computer Science, Smith College
Does this System workWith the ALU Adder?
Binary Hex Unsigned Decimal
1'sComplement
0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -71 001 9 9 -61 010 A 10 -5 1 011 B 11 -41 100 C 12 -31 101 D 13 -21 110 E 14 -11 111 F 15 -0
3 + -3 ——- = 0
4 + -1 ——- = 3
5 + -3 ——- = 2
![Page 36: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/36.jpg)
D. Thiebaut, Computer Science, Smith College
2's ComplementNumber System
![Page 37: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/37.jpg)
D. Thiebaut, Computer Science, Smith College
2's Complement Rule: To find the opposite of a number,
just flip all its bits, and add 1
0 101(+5)
1 011(-5)
and vice versa…
1 010 + 1
0 100 + 1
![Page 38: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/38.jpg)
D. Thiebaut, Computer Science, Smith College
Binary Hex Unsigned Decimal
2'sComplement
0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -81 001 9 9 -71 010 A 10 -6 1 011 B 11 -51 100 C 12 -41 101 D 13 -31 110 E 14 -21 111 F 15 -1
4-bit Nybble
![Page 39: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/39.jpg)
D. Thiebaut, Computer Science, Smith College
Does this System workWith the ALU Adder?
Binary Hex Unsigned Decimal
2'sComplement
0 000 0 0 +00 001 1 1 +10 010 2 2 +20 011 3 3 +30 100 4 4 +40 101 5 5 +50 110 6 6 +60 111 7 7 +71 000 8 8 -81 001 9 9 -71 010 A 10 -6 1 011 B 11 -51 100 C 12 -41 101 D 13 -31 110 E 14 -31 111 F 15 -1
3 + -3 ——- = 0 4
+ -1——- = 3
5 + -3 ——- = 2
![Page 40: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/40.jpg)
D. Thiebaut, Computer Science, Smith College
InterestingProperty
• What is the binary representation of -1 as a byte?
• What is the binary representation of -1 as a word?
• What is the binary representation of -1 as a dword?
![Page 41: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/41.jpg)
D. Thiebaut, Computer Science, Smith College
int x = 0x7fffffff - 5;
for ( int i=0; i<10; i++ )System.out.println( x++ );
getcopy Loop0x7fffffff.java
![Page 42: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/42.jpg)
D. Thiebaut, Computer Science, Smith College
What did you just learn about Java ints?
![Page 43: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/43.jpg)
D. Thiebaut, Computer Science, Smith College
negneg op8 neg op16 neg op32 op: mem, reg
alpha db 1beta dw 4x dd 0xF06
neg byte[alpha] mov ax,1234 neg ax
neg dword[x]
neg oprnd
To get the
2's complement
of an int
![Page 44: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/44.jpg)
D. Thiebaut, Computer Science, Smith College
Range of 2's Comp't. ints
Binary Hex Unsigned Decimal
0000 0 00001 1 10010 2 20011 3 30100 4 40101 5 50110 6 60111 7 71000 8 81001 9 91010 A 101011 B 111100 C 121101 D 131110 E 141111 F 15
![Page 45: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/45.jpg)
D. Thiebaut, Computer Science, Smith College
Type Minimum Maximum # Bytes
unsigned byte 0 255 1
signed byte -128 127 1
unsigned short 0 65,535 2
signed short -32,768 32,767 2
unsigned int 0 4,294,967,295 4
signed int -2,147,483,648 2,147,483,647 4
signed long
−9,223,372,036,854,775,808
9,223,372,036,854,775,807 8
![Page 46: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/46.jpg)
D. Thiebaut, Computer Science, Smith College
Binary unsigned signed0000 0000 0 +00000 0001 1 +10000 0010 2 +2……0111 1110 126 +1260111 1111 127 +1271000 0000 128 -1281000 0001 129 -1271000 0010 130 -126……1111 1110 254 -21111 1111 255 -1
![Page 47: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/47.jpg)
D. Thiebaut, Computer Science, Smith College
Binary unsigned signed0000 0000 0 +00000 0001 1 +10000 0010 2 +2……0111 1110 126 +1260111 1111 127 +1271000 0000 128 -1281000 0001 129 -1271000 0010 130 -126……1111 1110 254 -21111 1111 255 -1
![Page 48: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/48.jpg)
D. Thiebaut, Computer Science, Smith College
Binary unsigned signed0000 0000 0 +00000 0001 1 +10000 0010 2 +2……0111 1110 126 +1260111 1111 127 +1271000 0000 128 -128 = -271000 0001 129 -1271000 0010 130 -126……1111 1110 254 -21111 1111 255 -1
![Page 49: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/49.jpg)
D. Thiebaut, Computer Science, Smith College
Exercises on Signed Numbers
http://www.science.smith.edu/dftwiki/index.php/CSC231_Exercises_on_Signed_Numbers
![Page 50: CSC231—Assembly · mith College C omputer Science Dominique Thiébaut dthiebaut@smith.edu CSC231—Assembly Week #7 — Fall 2017](https://reader034.fdocuments.in/reader034/viewer/2022050303/5f6c44ab6921c4353323f0d0/html5/thumbnails/50.jpg)
D. Thiebaut, Computer Science, Smith College
Useful On-Line Toolhttp://www.exploringbinary.com/twos-complement-converter/