Question: Program Specification The program must start at address x 3 0 0 0 . The program will start by copying a picture of a cow
Program Specification
The program must start at address x
The program will start by copying a picture of a cow from location x into the center of the screen.
The image of the cow is a rectangle pixels wide by pixels high. This cow image is provided to you
as a separate cow.obj file to be loaded into Pennsim. This cow image data is stored in row order. For
example, the first row of pixels is stored at xxD the second row is stored at xEB
and so on
The user will then draw blades of grass colored green on the sides of the cow. These blades of
grass should be pixels wide, start at the same pixel row as the bottom of the initial cow image, and be
as tall as the cow image. These grass blades do not move with the cow moves or tips. The grass is not
redrawn when it is stomped by the cow.
The PennSim graphics display the screen is by pixels. We use an x y coordinate system
to describe a location on the screen. Location is the top left corner. The x coordinate increases as
we move to the right, and the y coordinate increases as we move down. In other words, is one
pixel to the right of and location is one pixel below Location is the
bottom right corner of the screen.
The user interacts with the program using onecharacter commands. The commands are typed on the
keyboard, but are not echoed to the console display. Nothing will be printed to the console during the
execution of this program. The program will wait for a key press, perform the corresponding command,
and repeat. If the keystroke does not correspond to a legal command, it will have no effect.
There are four commands for changing the location of the Pen. We use the WASD scheme of
navigation, used by various computer games.
Details
The PennSim graphics display is bitmapped, meaning that each pixel has a corresponding memory
location. The content of that memory location controls the color of the pixel.
Pixel Addresses
Addresses xC through xFDFF are assigned to the graphics display. The low address corresponds to
the top left corner Moving one pixel to the right adds one to the address, and it wraps around to
the next row when it gets to the right edge. Since the display is pixels wide, this means that moving
down one pixel is equivalent to adding to the address.
The address of point x y can be calculated as: xC x y
For this assignment, you will not need to calculate arbitrary pixel addresses, except to figure out where
the initial location is You will be moving left right up or down from the
current address.
You will, however, need to recognize when the Cow is at an edge of the display, so that you dont go
beyond the edge.
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
