Question: This assignment requires you to write a program in C + + with inline assembly. Turn in your program via a Canvas submission. Only turn
This assignment requires you to write a program in C with inline assembly.
Turn in your program via a Canvas submission. Only turn in the program source file, ie the cpp source code with embedded assembly.
Your program should start with the following heading:
; Lastname, Firstname CS Section Date completed
; Lab Map Boundaries
The Problem
Use the bit map creation program from the week lab exercises as a base, along with your lab program Bresenhams algorithm to draw lines in a bit map which provide a geographic map outline. This will only be accepted as an individual assignment.
To simplify your life, convert the salient parts of your lab submission into a function called lineTo.
Input
After creating the basic bit map by pixels your program will read a text file which contains pairs of longitude and latitude numbers in that order These values will be positive, and will be within the following dimensions:
North maximum latitude
West maximum longitude
South minimum latitude
East minimum longitude
For longitude, maximum and minimum are relative to their absolute value.
The text file is at this link. It is called DCBoundaryFile.txt and it is in the Assignments folder of our Canvas course.
Processing
Start by creating the bit map in storage. Read the first two entries from the input file. Verify that all values are within the eastwest or northsouth ranges above. Ignore any points which are not and issue message if any values are out of range, then end the program.
Save the first longitude and latitude values as separate variable for later use.
For each point pair of longitudelatitude values calculate the equivalent x or y pixel position. To do this:
subtract the edge boundary south for latitude and east for longitude from the longitude or latitude.
divide the difference by the number of degrees per pixel in the bit map. For our assignment, use for that value.
the quotient becomes the x or y position. Truncate the result you may use the math floor function.
These calculations must be in Intel assembly language. The rest of the program can be in C
Read in the next pair of longlat values. Calculate the equivalent x and y values. Then call the lineTo function to draw that line segment. After drawing, use the newest point as the "from" point for the next segment, and read in the new longitude and latitude values.
Putting it another way, you may find it simplest to define four variables named x y x and y After drawing the line, copy x into x and y into y then proceed with the next point, placing those values into x and y
Your program should end by comparing the most recently read long and lat values to the first long and lat values. If they are equal, stop the program. Remember from CS that direct equality of floating point values may not be a successful test. Write the output bit map and invoke Paint to display it then end the program.
Output
Message :
Pierce College CS Spring Lab Assignment Last, first
Replace Last, first with your name.
No message
Message :
Value nnnn out of range, ending.
Replace nnnn with the incorrect value. Note that all four values must be checked, so message may be issued up to four times.
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
