No reading assignment this week.
If you are given a corner and the center of a rectangle, you can compute the other three points of the rectangle. It doesn't matter which corner you are given, the computation is the same. Think about the diagonal across the rectangle that starts at the corner you are given. The center of the rectangle is the midpoint of that line, thus, you can use the midpoint formula and a little algebra to calculate the corner at the other side of the diagonal. Once you have that, the rest is easy. Work it out on paper before you start programming. Also make sure you pay attention to how you use the HC11 registers.
Write an assembly program to computes the other three corners given one corner and the center point of the rectangle. Your program should:
rmb
to declare variables for the
X and Y coordinates for the three corners you are to compute.
These should appear in memory locations
00
- 05
. At the end of your program,
the values must be correct in memory, not just in registers.
You can assume that all values are 8-bit positive integer values.
fcb
to declare the given
data (the one corner and the center) as constants. For example:
Xcnr1 FCB 2 Ycnr1 FCB 6 Xcntr FCB 7 Ycntr FCB 13These constants need to start in location
$f900
.
equ
to define symbols for the start of
RAM
, the start of EEPROM
,
the start of CONSTS
, and the
RESET
interrupt vector location.
and here's a bad example:ldaa Xcnr1 * copy p1 X value staa Xcnr2 * ...into p2 X value
ldaa Xcnr1 * load Xcnr1 into accumulator a staa Xcnr2 * store accumulator a into Xcnr2
You may (in fact, you probably will) find it helpful to start by writing the program in some imperative high-level language of your choice, and translate that program into assembly code. But that's not an explicit part of the assignment.
Assemble, simulate, and debug your program before submitting it through the Web Submission page. Note: You will receive no points for a program that does not assemble.
Last modified: Fri Oct 19 22:55:34 MST 2001