For this assignment, we give you the precise algorithms for the code you need to write, so this shouldn't be a problem. You may find it useful to modify these algorithms slightly, in order to express them in ANT, but make sure that you have the basic ideas totally nailed down before diving into the code.
If you can't precisely specify what it is that your algorithm is supposed to do and how to do it, then there's little chance you'll get it right be tinkering with it in assembly language. Since the beginning of the semester, you have been learning how to express algorithms precisely by writing them in C. Use this experience!
Note that the most appropriate or elegant algorithms in C may not be the most appropriate or elegant algorithms in ANT. Think about what's going to be easiest to express in ANT; it may change your algorithm.
If you don't know how to express yourself in ANT, then even the best algorithm is doomed to failure.
Eventually, each piece of the algorithm should start to look like something that you can easily convert into a sequence of ANT instructions and/or data declarations.
Do this before you write any code, and once you start to write code be very reluctant to change the register allocations without good reason! If you change the meaning of a register in one part of your code, you may need to change many other parts of your code in order to avoid clobbering something else.
Write small pieces that you can check and test carefully. An example of this in included later in this handout.
Make use of the ANT debugger (ad) to test your code. You can execute your code line by line, checking to make sure that what is in the registers and data memory is what you expect after each step.
ANT comes with a decent debugger. Learn your way around it! You will not be able to debug your programs by staring at them- most people find the debugger invaluable (the rest find ANT programming impossible, because they can't find their bugs without using the debugger).
The debugger takes five minutes to learn and can save you hours.
Make sure you keep track of what each scratch file is used for (i.e. what idea you were experimenting with in it) so you can pick out the good stuff later. There's no reason why the programs you need to write for this assignment should be the only ANT programs you ever write!
Dan Ellard - (firstname.lastname@example.org)