Question: Write an assembly language program that calculates the network address, the broadcast address and the range of IP addresses of a given IPv 4 address.
Write an assembly language program that calculates the network address, the broadcast address and the range of IP addresses of a given IPv address. The program should: Read from the keyboard the number of IPv Addresses N an integer number between and For each IPv address, input: The IPv address formatted 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. The subnet mask formatted as dotted decimal similar to the IPv address and is a continuous sequence of s followed by s The program should perform the following for every IPv address: Calculates the network address by performing a bitwise AND operation between the IP address and the subnet mask. Determines the broadcast address by setting all host bits to in the network address. Calculates the range of IP addresses within this subnet: o The first usable address network address o The last usable address broadcast address The program must then display a list with the following details for each item: The IPv address The subnet mask The network address The broadcast address The range of usable IP addresses
Your program must define and use the following procedures: Procedure ReadInput: This procedure reads the value of N address, then it reads the IPv and the subnet masks of these N addresses. o 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. This procedure makes use of the procedure CheckInt which checks if a value is out of range o 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 CheckIPvwhich checks if a value is not formatted correctly o If the user enters an invalid value for a subnet mask then it displays the error message Error Subnet Mask 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 CheckIPvwhich checks if a value is not formatted correctly and procedure CheckSubMask which checks if a subnet mask is a continuous sequence of s followed by s 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 returns in BL the value It also converts the octets string of the IPv address into bit unsigned number using the charint procedure. Procedure CheckSubMask: This procedure takes as input parameters a bit unsigned number. If the value is formatted as per the Subnet Mask addressing standard ie a continuous sequence of s followed by s this procedure returns in BL the value Otherwise, it 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 DisplayList: Displays the classes of the IPv addresses, by listing the addresses and their corresponding information in the following order: o The IPv address, as entered by the user and validated by the program. o The subnet mask, as entered by the user and validated by the program. o The network address, calculated by performing a bitwise AND operation between the IP address and the subnet mask. o The broadcast address, calculated by setting all host bits to in the network address. o The range of usable IP addresses, the first address network address
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
