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 IPv4 address. The program should: 1. Read from the keyboard the number of IPv4 Addresses N (an integer number between 1 and 10).2. For each IPv4 address, input: The IPv4 address (formatted as dotted quad or dotted decimal, is x.x.x.x, where each x can be any value between 0 and 255). Hence, the IPv4 address must be between 0.0.0.0 and 255.255.255.255. Every valid IPv4 address should be translated into 32-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 IPv4 address- and is a continuous sequence of 1s followed by 0s).3. The program should perform the following for every IPv4 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 1 in the network address. Calculates the range of IP addresses within this subnet: o The first usable address (network address +1). o The last usable address (broadcast address -1).4. The program must then display a list with the following details for each item: The IPv4 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 Read_Input: This procedure reads the value of N address, then it reads the IPv4 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 Check_Int (which checks if a value is out of range). o If the user enters an invalid value (for an IPv4 address) then it displays the error message Error, IPv4 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 Check_IPv4(which 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 Check_IPv4(which checks if a value is not formatted correctly) and procedure Check_SubMask (which checks if a subnet mask is a continuous sequence of 1s followed by 0s). Procedure Check_Int: 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 1. Otherwise, it displays the error message Error, value out of range. Try again! and returns in BL the value 0. Procedure Check_IPv4: 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 IPv4 addressing standard (i.e.4 octets separated with dot . and each octet is between 0 and 255), this procedure returns in BL the value 1. Otherwise, it returns in BL the value 0. It also converts the 4 octets string of the IPv4 address into 32-bit unsigned number using the char2int procedure. Procedure Check_SubMask: This procedure takes as input parameters a 32-bit unsigned number. If the value is formatted as per the Subnet Mask addressing standard (i.e. a continuous sequence of 1s followed by 0s), this procedure returns in BL the value 1. Otherwise, it returns in BL the value 0. Procedure char2int: This procedure takes as input parameters an ASCII character of a digit between 0 and 9 in BL, and add its converted decimal value to EAX. If the addition procedure did not overflow, this procedure returns in BL the value 1. Otherwise, it returns in BL the value 0. Procedure Display_List: Displays the classes of the IPv4 addresses, by listing the addresses and their corresponding information in the following order: o The IPv4 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 1 in the network address. o The range of usable IP addresses, the first address (network address +1)

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!