Exercise2 - 0306-250 Assembly Language Programming Fall...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0306-250 Assembly Language Programming Fall 2009 Laboratory Exercise Two: Basic Arithmetic Operations This exercise investigates arithmetic in an HCS12 assembly language program. The objective of this exercise is familiarization with movement of data into registers, with constant values, and with basic arithmetic operations using HCS12 instructions. An assembly language program is created and simulated in CodeWarrior. Prelab Work For the expression in step 2 of the lab procedure, calculate and write the results of each arithmetic operation in evaluating the expression from left to right, observing standard algebraic order of operations. In lab, these intermediate and final results will be used to verify the correct contents of the HCS12 registers. Include these calculations in your report’s results section to validate your program’s results. Lab Procedure 1. Create a new CodeWarrior directory (folder) and project on your X: drive for this exercise. 2. Following the guidelines listed below, write a properly commented and properly formatted HCS12 assembly language program to compute the result of this expression. 31 - 64 + (17 ´ 2) - (5 ´ 8) + 42 - 21 · The expression, as written above without any simplification, must be evaluated from left to right, observing standard algebraic order of operations. · All arithmetic operations must be performed on byte values. Any constants needed must be moved into registers as byte values before using them. · The only HCS12 arithmetic instructions that may be used are addition and subtraction. · Multiplication operations must be implemented with a combination of HCS12 shift, addition, and/or subtraction instructions. · The values in the expression must be declared or obtained as follows. – 31 and 64: Immediate values in load instructions – 17 and 5: Assembler EQUates as TERM3 and TERM4, respectively – 42 and 21: Assembler DCs as Term5 and Term 6, respectively 3. Assemble the program in CodeWarrior compiler to create a listing file. 4. Link the program in CodeWarrior to create a linker map file. Page 1 of 2 0306-250 20081 Lab Exercise 2: Basic Arithmetic Operations Page 2 of 2 5. Run the program in the simulator, and verify that the results match your prelab calculations. 6. Capture the final simulation results (i.e., generate a bitmap copy of the simulator window by pressing Ctrl-Alt-Print Screen). 7. Print your listing file, map file, simulation results, and grading sheet, and then demonstrate steps 3-5 for your lab instructor, who will sign your printed output. Report Write a report consisting of the following sections. · Abstract · Procedure · Results · Conclusion Your writing should follow the rules of professional technical writing and should meet the specifications in “Laboratory and Report Guidelines” on the course reference material web page. Staple your cover page, report, listing file, map file, simulator results, and grading sheet (in that order), and submit them at the beginning of the next lab session. Late reports are penalized 20% per day late, where “day late” is calculated by rounding submitted time to the nearest greater or equal integer number of days late (i.e., ceiling function). ...
View Full Document

This note was uploaded on 05/06/2010 for the course EECC 0306-250 taught by Professor Roymelton during the Fall '10 term at RIT.

Ask a homework question - tutors are online