Question: INCLUDE Irvine 3 2 . inc CD _ LEN = 3 0 ; Length of the of ip address . data CCA BYTE 4 4
INCLUDE Irvineinc
CDLEN ; Length of the of ip address
data
CCA BYTE CDLEN DUP ; array for storing course codes
buffer BYTE 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 ; counter for courses
; Messages to be displayed
prompt BYTE "Enter a ipV address",
HeadingA BYTE "The ip address List
code
main PROC
; read And copy strings
CALL ReadInput
CALL Printips
exit
main ENDP
ReadInput PROC
mov ipCountr,
GETCC:
READip:
MOV EDX,OFFSET prompt
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 chkipvformat
cmp eax,
CALL Crlf
JE READip
jmp COPYip
mov esi,
COPYip:
mov ebx,ipCountr
imul ebx,ebx,CDLEN
add ebx,esi
mov al bufferesi
mov CCAebx al
INC esi
cmp al ; Jump if equal bl
JNE COPYCC
jmp finish
finish:
mov esi,ipCountr
INC ipCountr
MOV EAX, ipCountr
cmp EAX,
JL GETCC
ReadInput ENDP
;
chkipvformat PROC
xor ecx, ecx
validateip:
call ReadOctet
cmp eax,
je invalidformat
mov ipOctets ecx al ; Store only the lower byte
inc ecx
inc dword ptr octetsProcessed
mov blesi
inc esi
cmp bl
je incrementdot
cmp bl
je finishvalidation
jmp invalidformat
incrementdot:
inc dword ptr dotCount
jmp validateip
finishvalidation:
cmp dword ptr octetsProcessed
jne invalidformat
cmp dword ptr dotCount
jne invalidformat
mov eax,
ret
invalidformat:
mov eax,
ret
chkipvformat ENDP
;
ReadOctet PROC
xor eax, eax
xor ebx, ebx
readdigit:
mov blesi
cmp bl
jl invalidinput
cmp bl
jg invalidinput
sub bl
imul eax,
add eax, ebx
inc esi
mov blesi
cmp bl
je octetdone
cmp bl
je octetdone
jmp readdigit
octetdone:
cmp eax,
ja invalidinput
ret
invalidinput:
mov eax,
ret
ReadOctet ENDP
;
Printips PROC
mov ipCountr,
PRNTCrs:
mov esi,
CCABUFFER:
mov ebx,ipCountr
imul ebx,ebx,CDLEN
add ebx,esi
mov al CCAebx
mov bufferesial
INC esi
cmp esi, CDLEN ; Jump if not equal esi CDLEN
JNE CCABUFFER
mov bufferesi
mov EDX, offset buffer
CALL WriteString
call crlf
INC ipCountr
MOV EAX, ipCountr
cmp EAX, ; Jump if less EAX
JL PRNTCrs
Printips ENDP correct that code to be output like this
END mainoEnter 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:
IPv 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
