SlideShare a Scribd company logo
1 of 8
Download to read offline
A solution manual to
Assembly language
Programming
and the organization of
the IBM PC
Chapter 2
Representation of numbers and
characters
BY:- Ytha Yu & Charles Marut
prepared by :
Warda Aziz
Wardaaziz555@gmail.com
Question 1:
In many applications , it saves time to memorize the conversions
among small binary, decimal, and hex numbers. Without referring to
the table , fill in the blanks in the following table
binary decimal hex
1001 9 9
1010 10 A
1101 13 D
1100 12 C
1110 14 E
1011 11 B
Question 2:
Convert the following numbers into decimal:
A) 1110
B) 100101011101
C) 46Ah
D) FAE2Ch
Solution:
1110:
=1*23
+ 1*22
+ 1*21
+ 0*20
=8 + 4 + 2 + 0
=14
100101011101:
=(1*211
)+(0*210
)+(0*29
)+(1*28
)+(0*27
)+(1*26
)+(0*25
)+(1*24
)+(1*23
)+(1*22
)+(0
*21
) +(1*2 0
)
=2048 + 0 + 0 + 256 + 0 + 64 + 0 + 16 + 8 +
4 + 0 +1
2397
46Ah:
=4*162
+ 6*161
+ A*160
=4*256+ 6*16 +10*1
=1024 + 96 +10
=1130
FAE2Ch:
=F*164
+ A* 163
+ E*162
+ 2*161
+C*160
=15*65536 + 10* 4096 + 14*256 +2*16 +12*1
=983040 + 40960 +3584 +32+12
=1027628
Question 3:
Convert the following decimal numbers:
a) 97 to binary
b) 627 to binary
c) 921 to hex
d) 6120 to hex
Solution:
97 to binary
;LCM with 2, remaining bits are in binary
=1110 0001
627 to binary
=0010 0111 0011
921 to hex
LCM with 16, remaining digits are in hex form
=399
6120 to hex
=17E8
Question 4:
Convert the following numbers:
a) 1001011 to hex
b) 1001010110101110 to hex
c) A2Ch to binary
d) B34Dh to binary
Solution:
a) 1001011 to hex
1001011=0100 1011(byte complete)
As we know 0100=4 and 1011=B
=4B
b) 1001010110101110 to hex
=95AE
c) A2Ch to binary
A=10d=1010(binary)
2=0010(binary)
C=12d=1100(binary)
=1010 0010 1100b
d) B34Dh to binary
B=11(decimal)=1011(binary),
3=0011(binary)
4=0100(binary)
D=1101(binary)
=1011 0011 0100 1101b
Question 5:
Perform the following addition:
a. 100101b + 10111b
b. 100111101b + 10001111001b
c. B23CDh + 17912h
d. FEFFEh + FBCADh
Solution:
100101b + 10111b

100101
+10111
111100
100111101b + 10001111001b
 
100111101
+ 10001111001
10110110110
B23CDh + 17912h
B23CD
+17912
C9CDF
FEFFEh + FBCADh
Solving from the right most values i.e., Eh+Dh=14d+13d=27d
27d=1Bh(solving through LCM method)
B is written below and 1 is given carry to the left bit.
Process goes so on and we get;
FEFFE
+FBCAD
1FACAB
Question 6:
Perform the following subtraction:
a) 11011 - 10110
b) 10000101 - 111011
c) 5FC12h - 3ABD1h
d) F001Eh - 1FF3Fh
Solution:
11011 - 10110
11011
- 10110
00101
10000101 - 111011
10000101
- 111011
1001010
5FC12h - 3ABD1h
    ;borrow carries
0101 1111 1100 0001 0010 (5FC12h)
- 0011 1010 1011 1101 0001 (3ABD1)
0010 0101 0000 0100 0001 (binary)
=25041(hex)
F001Eh - 1FF3Fh
    
1111 0000 0000 0001 1110
- 0001 1111 1111 0011 1111
1101 0000 0000 1101 1111
=D00DF
Question 7:
Give the 16 bit representation of each of the following decimal
integers . write answers in hex.
a. 234d
b. -16d
c. 31634d
d. -32216d
Solution:
234
Bin= 0000 0000 1110 1010
Hex=00EAh
-16
Bin=0000 0000 0001 0000
2’s compliment:
 
1111 1111 1110 1111
+ 1
1111 1111 1111 0000
=FFF0h
Hex=FFF0h
31634
bin= 0111 1011 1001 0010b
Hex=7B92h
-32216
Same as Q7(part e)
Bin=1000 0010 0010 1000b
Hex=8228h
Question 8:
Do the following binary and hex subtractions by two’s compliment
addition.
a) 10110100b - 10010111b
b) 10001011b - 11110111b
c) FE0Fh - 12ABh
d) 1ABCh - B3EAh
Solution:
Note:
if the resulting bit has a carry 1 , neglect the carry
if the result has no carry take 2’s compliment again with a negative sign.
10110100 - 10010111
Two’s compliment= 01101000+1=01101001

10110100
+ 01101001
1 00011101
Dropping the resulting carry bit we get the answer 0001 1101b or 11101b
10001011 - 11110111
2’s compliment 11110111=00001000+1=00001001
 
1000 1011
+0000 1001
1001 0100
Taking 2’s compliment again and put a negative sign

01101011
+1
01101100
Ans -1101100
FE0Fh - 12ABh
FE0Fh - 12ABh=1111111000001111b-1001010101011b
Take 2’s compliment of 0001 0010 1010 1011b;
1110 1101 0101 0100b+1b=1110 1101 0101 0101b
   
1111 1110 0000 1111
+1110 1101 0101 0101
1 1110 1011 0110 0100
Ans: =1110 1011 0110 0100b
=EB64h
1ABCh - B3EAh
Same as Q8(3,2)
Ans: -992Eh
Question 9:
Give the signed and unsigned interpretations of each of the following
16 bit or 8 bit numbers.
a. 7FFEh
b. 8543h
c. FEh
d. 7Fh
Solution:
7FFEh
Signed: 32766 ; as the MSB is 0(in binary)
Unsigned: 32766
8543h
Signed: -31421 ; as the MSB is 1
Unsigned: 34115
FEh
Signed: -2 ; as the MSB is 1 (see table 2.4B)
Unsigned: 254
7Fh
Signed: 127 ; as the MSB is 0
Unsigned: 127
Question 10:
Show how the decimal integer -120 would be represented
a) In 16 bits
b) In 8 bits
As we know 120d=0111 1000(binary)
-120=2’s compliment
ANS:
16 bit:
(0000 0000 1000 0111)16 + 1= (1111 1111 1000 1000)16
8 bit:
(1000 0111)8 + 1= (1000 1000)8
;2’s compliment because we are solving for negative value i.e., -120
Question 11:
For each of the following numbers ,tell whether it could be stored
(a)as a 16 bit number or (b) as an 8 bit number?
a. 32767
b. -40000
c. 65536
d. 257
e. -128
ANS:
Number Bit storage
32767 16 bit
-40000 Bigger than 16 bit
65536 Bigger than 16 bit
257 16 bit
-128 both
Question 12:
For each of the following 16 bit numbers, tell whether it is positive or
negative?
ANS:
Signed number polarity
1010010010010100b negative
783E3h positive
CB33h negative
807Fh negative
9AC4h negative
Question 13:
If the character string “$12.75” is being stored in memory starting at
address 0, give the hex contents of byte 0-5.
Data string Data
$ $ 24
1 1 31
2 2 32
. . 2E
7 7 37
5 5 35
ANS: The content at address 5 is 35.
Question 14:
Translate the message of ASCII
41 74 74 61 63 6B 20 61 74 20 44 61 77 6E
ANS: Attack at Dawn
Question 15:
Suppose that a byte contains the ASCII code of an upper case letter.
What hex number should be added to it to convert it to lower case?
ANS: 20h
Question 16:
Suppose a byte contains a decimal digit that is “0”….“9” . what hex
number should be subtracted from the byte to convert it to the
numerical form of chracters?
Ans:30h

More Related Content

What's hot

Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Bilal Amjad
 
Assembly language (coal)
Assembly language (coal)Assembly language (coal)
Assembly language (coal)Hareem Aslam
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Tayeen Ahmed
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Bilal Amjad
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Bilal Amjad
 
Calculator 8086 Assembly Language Programming
Calculator 8086 Assembly Language Programming Calculator 8086 Assembly Language Programming
Calculator 8086 Assembly Language Programming Sami Ullah
 
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Bilal Amjad
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in AssemblyJaveria Yaqoob
 
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...Bilal Amjad
 
Assembly language
Assembly language Assembly language
Assembly language Usama ahmad
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Anwar Hasan Shuvo
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086COMSATS Abbottabad
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086University of Gujrat, Pakistan
 

What's hot (20)

Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
 
Assignment on alp
Assignment on alpAssignment on alp
Assignment on alp
 
Assembly language (coal)
Assembly language (coal)Assembly language (coal)
Assembly language (coal)
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 5 (The Processor...
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
 
Calculator 8086 Assembly Language Programming
Calculator 8086 Assembly Language Programming Calculator 8086 Assembly Language Programming
Calculator 8086 Assembly Language Programming
 
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
 
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...assembly language programming organization of IBM PC chapter 9 part-2(decimal...
assembly language programming organization of IBM PC chapter 9 part-2(decimal...
 
Assembly language
Assembly language Assembly language
Assembly language
 
[ASM]Lab5
[ASM]Lab5[ASM]Lab5
[ASM]Lab5
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
 
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
 

Similar to Representation of numbers and characters

Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009lionking
 
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...JanakiramanLohitha
 
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...NikxzsLeonTormon
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRabiaAsif31
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalUtkirjonUbaydullaev1
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRAJKUMARP63
 
Data representation
Data representationData representation
Data representationChew Hoong
 
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...Hsien-Hsin Sean Lee, Ph.D.
 
Number systems and Boolean Reduction
Number systems and Boolean ReductionNumber systems and Boolean Reduction
Number systems and Boolean ReductionDhaval Shukla
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic renatus katundu
 
Week 5 - Number Systems.pdf
Week 5 - Number Systems.pdfWeek 5 - Number Systems.pdf
Week 5 - Number Systems.pdfHama302631
 
Hexa to binary
Hexa to binaryHexa to binary
Hexa to binarymyrajendra
 
Number system
Number systemNumber system
Number systemaviban
 

Similar to Representation of numbers and characters (20)

Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
 
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
 
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
Solution_Manual_Digital_Design_With_an_Introduction_to_the_Verilog_HDL_5th_Ed...
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
 
Data representation
Data representationData representation
Data representation
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Unit 4.docx
Unit 4.docxUnit 4.docx
Unit 4.docx
 
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
 
Number systems and Boolean Reduction
Number systems and Boolean ReductionNumber systems and Boolean Reduction
Number systems and Boolean Reduction
 
Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 
Week 5 - Number Systems.pdf
Week 5 - Number Systems.pdfWeek 5 - Number Systems.pdf
Week 5 - Number Systems.pdf
 
Number system
Number systemNumber system
Number system
 
Hexa to binary
Hexa to binaryHexa to binary
Hexa to binary
 
Number system
Number systemNumber system
Number system
 

Recently uploaded

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

Representation of numbers and characters

  • 1. A solution manual to Assembly language Programming and the organization of the IBM PC Chapter 2 Representation of numbers and characters BY:- Ytha Yu & Charles Marut prepared by : Warda Aziz Wardaaziz555@gmail.com
  • 2. Question 1: In many applications , it saves time to memorize the conversions among small binary, decimal, and hex numbers. Without referring to the table , fill in the blanks in the following table binary decimal hex 1001 9 9 1010 10 A 1101 13 D 1100 12 C 1110 14 E 1011 11 B Question 2: Convert the following numbers into decimal: A) 1110 B) 100101011101 C) 46Ah D) FAE2Ch Solution: 1110: =1*23 + 1*22 + 1*21 + 0*20 =8 + 4 + 2 + 0 =14 100101011101: =(1*211 )+(0*210 )+(0*29 )+(1*28 )+(0*27 )+(1*26 )+(0*25 )+(1*24 )+(1*23 )+(1*22 )+(0 *21 ) +(1*2 0 ) =2048 + 0 + 0 + 256 + 0 + 64 + 0 + 16 + 8 + 4 + 0 +1 2397 46Ah: =4*162 + 6*161 + A*160 =4*256+ 6*16 +10*1 =1024 + 96 +10 =1130 FAE2Ch: =F*164 + A* 163 + E*162 + 2*161 +C*160 =15*65536 + 10* 4096 + 14*256 +2*16 +12*1 =983040 + 40960 +3584 +32+12 =1027628 Question 3: Convert the following decimal numbers: a) 97 to binary b) 627 to binary
  • 3. c) 921 to hex d) 6120 to hex Solution: 97 to binary ;LCM with 2, remaining bits are in binary =1110 0001 627 to binary =0010 0111 0011 921 to hex LCM with 16, remaining digits are in hex form =399 6120 to hex =17E8 Question 4: Convert the following numbers: a) 1001011 to hex b) 1001010110101110 to hex c) A2Ch to binary d) B34Dh to binary Solution: a) 1001011 to hex 1001011=0100 1011(byte complete) As we know 0100=4 and 1011=B =4B b) 1001010110101110 to hex =95AE c) A2Ch to binary A=10d=1010(binary) 2=0010(binary) C=12d=1100(binary) =1010 0010 1100b d) B34Dh to binary B=11(decimal)=1011(binary), 3=0011(binary) 4=0100(binary) D=1101(binary) =1011 0011 0100 1101b Question 5: Perform the following addition: a. 100101b + 10111b b. 100111101b + 10001111001b c. B23CDh + 17912h d. FEFFEh + FBCADh Solution:
  • 4. 100101b + 10111b  100101 +10111 111100 100111101b + 10001111001b   100111101 + 10001111001 10110110110 B23CDh + 17912h B23CD +17912 C9CDF FEFFEh + FBCADh Solving from the right most values i.e., Eh+Dh=14d+13d=27d 27d=1Bh(solving through LCM method) B is written below and 1 is given carry to the left bit. Process goes so on and we get; FEFFE +FBCAD 1FACAB Question 6: Perform the following subtraction: a) 11011 - 10110 b) 10000101 - 111011 c) 5FC12h - 3ABD1h d) F001Eh - 1FF3Fh Solution: 11011 - 10110 11011 - 10110 00101 10000101 - 111011 10000101 - 111011 1001010 5FC12h - 3ABD1h     ;borrow carries 0101 1111 1100 0001 0010 (5FC12h) - 0011 1010 1011 1101 0001 (3ABD1) 0010 0101 0000 0100 0001 (binary) =25041(hex) F001Eh - 1FF3Fh      1111 0000 0000 0001 1110 - 0001 1111 1111 0011 1111 1101 0000 0000 1101 1111
  • 5. =D00DF Question 7: Give the 16 bit representation of each of the following decimal integers . write answers in hex. a. 234d b. -16d c. 31634d d. -32216d Solution: 234 Bin= 0000 0000 1110 1010 Hex=00EAh -16 Bin=0000 0000 0001 0000 2’s compliment:   1111 1111 1110 1111 + 1 1111 1111 1111 0000 =FFF0h Hex=FFF0h 31634 bin= 0111 1011 1001 0010b Hex=7B92h -32216 Same as Q7(part e) Bin=1000 0010 0010 1000b Hex=8228h Question 8: Do the following binary and hex subtractions by two’s compliment addition. a) 10110100b - 10010111b b) 10001011b - 11110111b c) FE0Fh - 12ABh d) 1ABCh - B3EAh Solution: Note: if the resulting bit has a carry 1 , neglect the carry if the result has no carry take 2’s compliment again with a negative sign. 10110100 - 10010111 Two’s compliment= 01101000+1=01101001  10110100 + 01101001
  • 6. 1 00011101 Dropping the resulting carry bit we get the answer 0001 1101b or 11101b 10001011 - 11110111 2’s compliment 11110111=00001000+1=00001001   1000 1011 +0000 1001 1001 0100 Taking 2’s compliment again and put a negative sign  01101011 +1 01101100 Ans -1101100 FE0Fh - 12ABh FE0Fh - 12ABh=1111111000001111b-1001010101011b Take 2’s compliment of 0001 0010 1010 1011b; 1110 1101 0101 0100b+1b=1110 1101 0101 0101b     1111 1110 0000 1111 +1110 1101 0101 0101 1 1110 1011 0110 0100 Ans: =1110 1011 0110 0100b =EB64h 1ABCh - B3EAh Same as Q8(3,2) Ans: -992Eh Question 9: Give the signed and unsigned interpretations of each of the following 16 bit or 8 bit numbers. a. 7FFEh b. 8543h c. FEh d. 7Fh Solution: 7FFEh Signed: 32766 ; as the MSB is 0(in binary) Unsigned: 32766 8543h Signed: -31421 ; as the MSB is 1 Unsigned: 34115 FEh Signed: -2 ; as the MSB is 1 (see table 2.4B) Unsigned: 254 7Fh Signed: 127 ; as the MSB is 0
  • 7. Unsigned: 127 Question 10: Show how the decimal integer -120 would be represented a) In 16 bits b) In 8 bits As we know 120d=0111 1000(binary) -120=2’s compliment ANS: 16 bit: (0000 0000 1000 0111)16 + 1= (1111 1111 1000 1000)16 8 bit: (1000 0111)8 + 1= (1000 1000)8 ;2’s compliment because we are solving for negative value i.e., -120 Question 11: For each of the following numbers ,tell whether it could be stored (a)as a 16 bit number or (b) as an 8 bit number? a. 32767 b. -40000 c. 65536 d. 257 e. -128 ANS: Number Bit storage 32767 16 bit -40000 Bigger than 16 bit 65536 Bigger than 16 bit 257 16 bit -128 both Question 12: For each of the following 16 bit numbers, tell whether it is positive or negative? ANS: Signed number polarity 1010010010010100b negative 783E3h positive CB33h negative 807Fh negative 9AC4h negative Question 13:
  • 8. If the character string “$12.75” is being stored in memory starting at address 0, give the hex contents of byte 0-5. Data string Data $ $ 24 1 1 31 2 2 32 . . 2E 7 7 37 5 5 35 ANS: The content at address 5 is 35. Question 14: Translate the message of ASCII 41 74 74 61 63 6B 20 61 74 20 44 61 77 6E ANS: Attack at Dawn Question 15: Suppose that a byte contains the ASCII code of an upper case letter. What hex number should be added to it to convert it to lower case? ANS: 20h Question 16: Suppose a byte contains a decimal digit that is “0”….“9” . what hex number should be subtracted from the byte to convert it to the numerical form of chracters? Ans:30h