INCLUDE Irvine32.inc CD_LEN = 30 ; Length of the of ip address .data CCA BYTE 44*CD_LEN+1 DUP(0) ; array for storing course codes buffer BYTE 44 DUP(?) ; input buffer to store and process course code byteCount DWORD ? ; holds course code length as read from keyboard ; holds course score as read from keyboard ipCountr DWORD 0 ; counter for courses ; Messages to be displayed prompt3 BYTE "Enter a ipV4 address", 0 HeadingA BYTE "The ip address List ", 0 .code main PROC ; read And copy 3 strings CALL Read_Input CALL Print_ips exit main ENDP Read_Input PROC mov ipCountr, 0 GET_CC: READ_ip: MOV EDX,OFFSET prompt3 CALL WriteString mov edx,OFFSET buffer ; point to the buffer mov ecx,SIZEOF buffer ; specify max characters CALL ReadString ; input the string mov byteCount,eax ; number of characters mov esi,offset buffer call chk_ipv4_format cmp eax, 0 CALL Crlf JE READ_ip jmp COPY_ip mov esi,0 COPY_ip: mov ebx,ipCountr imul ebx,ebx,CD_LEN add ebx,esi mov al, buffer[esi] mov CCA[ebx], al INC esi cmp al, 0 ; Jump if equal (bl = 0) JNE COPY_CC jmp finish finish: mov esi,ipCountr INC ipCountr MOV EAX, ipCountr cmp EAX, 3 JL GET_CC Read_Input ENDP ;---------------------------------------------------------------------------------------- chk_ipv4_format PROC xor ecx, ecx validate_ip: call ReadOctet cmp eax, -1 je invalid_format mov [ipOctets + ecx], al ; Store only the lower byte inc ecx inc dword ptr [octetsProcessed] mov bl, [esi] inc esi cmp bl, '.' je increment_dot cmp bl, 0 je finish_validation jmp invalid_format increment_dot: inc dword ptr [dotCount] jmp validate_ip finish_validation: cmp dword ptr [octetsProcessed], 4 jne invalid_format cmp dword ptr [dotCount], 3 jne invalid_format mov eax, 1 ret invalid_format: mov eax, 0 ret chk_ipv4_format ENDP ;---------------------------------------------------------------------------------------- ReadOctet PROC xor eax, eax xor ebx, ebx read_digit: mov bl, [esi] cmp bl, '0' jl invalid_input cmp bl, '9' jg invalid_input sub bl, '0' imul eax, 10 add eax, ebx inc esi mov bl, [esi] cmp bl, '.' je octet_done cmp bl, 0 je octet_done jmp read_digit octet_done: cmp eax, 255 ja invalid_input ret invalid_input: mov eax, -1 ret ReadOctet ENDP ;---------------------------------------------------------------------------------------- Print_ips PROC mov ipCountr, 0 PRNT_Crs: mov esi, 0 CCA2BUFFER: mov ebx,ipCountr imul ebx,ebx,CD_LEN add ebx,esi mov al, CCA[ebx] mov buffer[esi],al INC esi cmp esi, CD_LEN ; Jump if not equal (esi != CD_LEN) JNE CCA2BUFFER mov buffer[esi],0 mov EDX, offset buffer CALL WriteString call crlf INC ipCountr MOV EAX, ipCountr cmp EAX, 3 ; Jump if less (EAX < 3) JL PRNT_Crs Print_ips ENDP correct that code to be output like this END mainoEnter the IPv4 Address (xxx.xxx.xxx.xxx): 127.255.255.255. Error, IPv4 address is not formatted correctly. Try again! Enter the IPv4 Address (xxx.xxx.xxx.xxx): 127.255.255.256 Error, IPv4 address is not formatted correctly. Try again! Enter the IPv4 Address (xxx.xxx.xxx.xxx): 127.255.255.255 Enter the IPv4 Address (xxx.xxx.xxx.xxx): 191.255.255.255 Enter the IPv4 Address (xxx.xxx.xxx.xxx): 223.255.255.255 Enter the IPv4 Address (xxx.xxx.xxx.xxx): 239.255.255.255 Enter the IPv4 Address (xxx.xxx.xxx.xxx): 240.255.255.255 Enter the IPv4 Address (xxx.xxx.xxx.xxx): 00189.234.23.32 IPv4 Address -------------------------------- 127.255.255.255 191.255.255.255 223.255.255.255 239.255.255.255 240.255.255.255 189.234.23.32 Make sure before submit to me run correctly with this output