Question: Write an assembly language program that identifies the class of IPv 4 addresses. It should start by reading from the keyboard a number of addresses
Write an assembly language program that identifies the class of IPv addresses. It should start by reading from the keyboard a number of addresses N between and to be checked and the IPv of those N addresses. The IPv format, known as dotted quad or dotted decimal, is xxxx where each x can be any value between and Hence the IPv address must be between and Every valid IPv address should be translated into bit integer that can be expressed in binary or hexadecimal notation, as illustrated in the following Figure.
Dotdecimal notation:
numbering Binary :
Octet's orde : st ed ed th
bit byte
Figure: Decomposition of the quaddotted IPv address representation to its binary value
The program must then display a list containing for each address: the class A B C D or E and the IPv address
as shown in the sample run. The class is determined according to the following table:
Class Address range Address Octet Binary range
A to xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
B to xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
C to xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
D to xxxxx xxxxxxxx xxxxxxxx xxxxxxxx
E to xxxx xxxxxxxx xxxxxxxx xxxxxxxx
Your program must define and use the following procedures:
Procedure ReadInput: This procedure reads the value of N address, and IPv of N addresses. If the user enters an invalid out of range value for N then it displays the error message Error number is out of range. Try again! and allows the user to enter the value again and again until the entered value is valid. If the user enters an invalid value for an IPv address then it displays the error message Error IPv address is not formatted correctly. Try again! and allows the user to enter the value again and again until the entered value is valid. This procedure makes use of the procedure CheckInt which checks if a value is out of range and
procedure CheckIPvwhich checks if a value is not formatted correctly
Procedure CheckInt: This procedure takes as input parameters an integer value in EAX, a minimum value in EBX and a maximum value in ECX. If the value of EAX is between the values of EBX and ECX, this procedure returns in BL the value Otherwise, it displays the error message Error value out of range. Try again! and returns in BL the value
Procedure CheckIPv: This procedure takes as input parameters a string in buffer as entered from keyboard and its length in byteCount. If the value of buffer is formatted as per the IPv addressing standard ie octets separated with dot and each octet is between and this procedure returns in BL the value Otherwise, it displays the error message Error IPv address is not formatted correctly. Try again! and returns in BL the value
Procedure charint: This procedure takes as input parameters an ASCII character of a digit between and in BL and add its converted decimal value to EAX. If the addition procedure did not overflow, this procedure returns in BL the value Otherwise, it returns in BL the value
Procedure PrintIPvClass: Displays the classes of the IPv addresses, by listing the addresses and their classes in the format shown in the sample run. It makes use of the procedure FindClass defined below. It should print the IPv address with dotted decimal formatting.
Procedure FindClass: This procedure takes as input parameter in EAX an IPv address and returns in EDX the offset of one of the following strings ABCD or E based on the range of the given IPv address according to the above table.
Sample Run:
IPv Address Classes Calculator
Enter the number of IPv Address between and :
Error, number is out of range. Try again!
Enter the number of IPv Address between and :
Error, number is out of range. Try again!
Enter the number of IPv Address between and :
Enter the IPv Address xxxxxxxxxxxx:
Error, IPv address is not formatted correctly. Try again!
Enter the IPv Address xxxxxxxxxxxx:
Error, IPv address is not formatted correctly. Try again!
Enter the IPv Address xxxxxxxxxxxx:
Enter the IPv Address xxxxxxxxxxxx:
Enter the IPv Address xxxxxxxxxxxx:
Enter the IPv Address xxxxxxxxxxxx:
Enter the IPv Address xxxxxxxxxxxx:
Enter the IPv Address xxxxxxxxxxxx:
IP Class IPv Address
A
B
C
D
E
B
Write the program in assembly language and write all implementation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
