Question: Ise 8 0 8 6 Instruction set for assembly language and write using the code segment in the picture. Convert binary to unsigned int Problem:

Ise 8086 Instruction set for assembly language and write using the code segment in the picture.
Convert binary to unsigned int
Problem: Convert a binary string to decimal. Accept buffered user input in the form of a 16-bit binary string. Convert to unsigned integer and print to the screen. If the user enters less than 16 bits, you may pad the binary number with zeros on the left.
Hint: To print the numbers, you have to modify the print int tat example file (the file is on Nexus). That version uses division for 8 bits, but you need division using 16 bits for this assignment.
Sample Execution:
Enter a 16-bit binary number: 1001111001011100
The decimal unsigned integer equivalent is 40540.
Enter a 16-bit binary number: 01100
The decimal unsigned integer equivalent is 12.
Convert binary to signed int
Problem: Convert a binary string to decimal. Accept buffered user imput in the form of a 16-bit binary string. Convert to signed integer and print to the screen. If the user enters less than 16 bits, or inputs illegal character, return an error message and prompt for input again.
Sample Execution:
Enter a iboblt binary number: 1002111001011100
The decimal signed integer equivalent is -24996.
Enter a 16-bit binaty number: 11091021100
Error: Please enter exactly 16-hits: 1001111001011100
Error: Illegal characters detactod. Please enter a 16-bit binary number: 1001111001011100
Evaluation
10 marks will be awarded for correctly converting to unsigned int and stgned int (i.e.10 marks each).10 marks are for implementing error mensuge in Problem 2. The remaining to matk are style points based on subjective evaluation of the quality of your solutions and zaif comments (amother tor maks each)
19.
data
; data segment. Keyword db means define byte. You can also define word (du)
; Define input number
; stack seqment
data iNum
stack1 segment stack
db 100 dup (P)
: This 18 the stack of 100 bytes
stackl ences
code
begreart
hsnume es:code, ds:data, ss:stackl
start:
; Perform initialization
: Put the starting address of the stack into the ax register (murt of thiat firar)
: Put the starting address of the stack segment into the ss regiater (where if belargs)
q,
nov ah. Wiset up code to specity return to dos
Int = I Interpt number 21(Return control to dou promet)
Ise 8 0 8 6 Instruction set for assembly language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!