Question: Problem 3 Network Masking An Internet Protocol version 4 ( IPv 4 ) address is represented in dotted decimal notation. Here is an example of

Problem 3 Network Masking
An Internet Protocol version 4(IPv4) address is represented in dotted decimal notation. Here is an example of an IPv4 address for an end-point:
192.168.1.8
The IPv4 addressing scheme also requires a mask associated with each subnet. The mask is used to find the network address. The network address is essentially the base address of the network and is used for routing and switching. For example, suppose the mask for the above address is 255.255.0.0. The mask indicates that the two rightmost octets are masked, since those bits are all turned off. So our network address is 192.168.0.0. An IPv4 address conveniently fits into a DWORD. Lets look at all this in hex:
IP Address: 192.168.1.8=0xC0A80108
Subnet Mask: 255.255.0.0=0xFFFF0000
Network Address: 192.168.0.0=0xC0A80000
As you can see, an IP address can be represented in hex by simply concatenating the hex byte representation for each octet.
Write a complete, yet simple, x86 assembly program that can mask an IP address to produce the network address. I recommend using a console32 template. Develop a procedure that can mask an IP address to produce the network address. Create the function with the following prototype:
DWORD getNetAddress(DWORD ipAddress, DWORD subnetMask);
The function consumes two DWORD parameters: the IP address and the subnet mask. The function returns the network address as a DWORD. Your program simply needs to define and call the procedure. Check your functions return value (in EAX), and provide screenshots of your registers to verify the accuracy of the functions return value.
the code i was provided earlier did not work. I'm coding in VS win32,64. All of my code starts with
.386
a samp[lpe partial code -
.586
.MODEL FLAT
INCLUDE io.h ; header file for input/output
.STACK 4096
.DATA
valueA DWORD ?
valueB DWORD ?
valueC DWORD ?
prompt1 BYTE "Value of a?",0
prompt2 BYTE "Value of b?(not zero)",0
prompt3 BYTE "Value of c?",0
string BYTE 40 DUP (?)
result BYTE 11 DUP (?),0
resultLbl BYTE "Expression value", 0
.CODE
_MainProc PROC

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 Databases Questions!