0% found this document useful (0 votes)
18 views5 pages

EXPERIMENT 4 _COAL

Uploaded by

Tahir2 Siddiqui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

EXPERIMENT 4 _COAL

Uploaded by

Tahir2 Siddiqui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

EXPERIMENT 4 –INPUT/ OUTPUT SINGLE AND MULTI-DIGIT

NUMBER
Objective
• To learn about signed and unsigned numbers
• Practice how to Input, Output single and multi-digit number.
• Addition and subtraction of numbers
Time Required : 3 hrs
Programming Language : Assembly Language
Software Required : EMU 8086
Hardware Required : NIL

Character storage
• Computer stores binary numbers, so how character ‘A’ and ‘$’ are stored.
• Computer uses character encoding scheme that translate numbers into
letters.  Well-known scheme is ASCII (American Standard code for
Information Interchange)  ASCII is 7 bit code with range 0 to 127.
Signed Numbers
• Signed byte uses only 7 bits for its magnitude.
• Highest bit is reserved for the sign, where 0 indicates positive and 1
indicates negative.
Example:
11110110 = - 10
00001010 = + 10
Two’s Complement Notation
• Negative numbers use Two’s complement representation.
• Removes the need for separate digital circuits to handle both addition and
subtraction. Example: A – B = A + (-B)
To find Twos complement, toggle all bits and add 1.
00000001 = + 1
35526 (toggle all bits)
+ 1 (add 1)
---------------
35527 = - 1
Example:
00001010 = + 10
11110101 (toggle all bits)
+ 1 (add 1)
--------------
11110110 =
- 10
Two’s Complement of Hexadecimal
 To form the two’s complement of a hexadecimal integer, reverse all
bits and add 1  Easy way to reverse the bits of a hexadecimal digit
is to subtract the digit from 15.
Example:
6A3D --> 95C2 + 1 --> 95C3
Library of common functions - emu8086.inc

To make programming easier there are some common functions that can be
included in your program. To make your program use functions defined in
other file you should use the INCLUDE directive followed by a file name.
Compiler automatically searches for the file in the same folder where the
source file is located.

To use any of the functions in emu8086.inc you should have the following
line in the beginning of your source file: include 'emu8086.inc'
emu8086.inc also defines the following procedures:

 SCAN_NUM - procedure that gets the multi-digit SIGNED number


from the keyboard, and stores the result in CX register. To use it
declare: DEFINE_SCAN_NUM before END directive.

 PRINT_NUM - procedure that prints a signed number in AX register.


To use it declare: DEFINE_PRINT_NUM
andDEFINE_PRINT_NUM_UNS before END directive.

 PRINT_NUM_UNS - procedure that prints out an unsigned number in


AX register.
To use it declare:DEFINE_PRINT_NUM_UNS before END directive.

You might also like