SlideShare a Scribd company logo
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

chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
warda aziz
 
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 (coal)
Assembly language (coal)Assembly language (coal)
Assembly language (coal)
Hareem Aslam
 
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 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 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
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
Javeria Yaqoob
 
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 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
 
bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
University of Gujrat, Pakistan
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
Anwar Hasan Shuvo
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
Kartik Sharma
 
Assembly Language Lecture 3
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
Motaz Saad
 
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
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
A. S. M. Badrudduza
 
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 8086
Assembly 8086Assembly 8086
Assembly 8086
Mustafa Salah
 

What's hot (20)

chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
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 (coal)
Assembly language (coal)Assembly language (coal)
Assembly language (coal)
 
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 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 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,...
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
 
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 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...
 
bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
 
Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086Multiplication & division instructions microprocessor 8086
Multiplication & division instructions microprocessor 8086
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
 
Assembly Language Lecture 3
Assembly Language Lecture 3Assembly Language Lecture 3
Assembly Language Lecture 3
 
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...
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
 
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 8086
Assembly 8086Assembly 8086
Assembly 8086
 

Similar to Representation of numbers and characters

Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
bhuvanaaswini
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
lionking
 
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.ppt
RabiaAsif31
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
Suganthi Vasanth Raj
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ssuser52a19e
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
RAJKUMARP63
 
binary-numbers.ppt
binary-numbers.pptbinary-numbers.ppt
binary-numbers.ppt
MarlonMagtibay2
 
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
UtkirjonUbaydullaev1
 
Data representation
Data representationData representation
Data representation
Chew Hoong
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
MUNAZARAZZAQELEA
 
Unit 4.docx
Unit 4.docxUnit 4.docx
Unit 4.docx
T Srihari
 
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 Reduction
Dhaval 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.pdf
Hama302631
 
Number system
Number systemNumber system
Number system
Mantra VLSI
 
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
 
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
 
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
 
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

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

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