Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago