Need help figuring this out (complete noob) HC11

Status
Not open for further replies.

Widny Jean

Newbie level 2
Joined
Dec 5, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
14
Using HC11 instruction set
Write a program code to calculate the average of 7 numbers
requirements:
-The program should start at address $0000
-Assume that the 8 bit numbers are stored at the starting location of $00A0
-Use accumulator B as the counter
-Use indexed addressing to access the numbers
-Store the final result at location $00AB (Must use indexed addressing)
~Explanations and recommended software to run similar programs would be appreciated.
 

Have you talked to your professor or teachers assistant yet? When is the homework due? What have you tried?
 

Yes, I have; he has been of great help. It's due on Monday. Here is a snapshot of what I have been trying:
 

You should start with loading A with the first value and add the next 6 before you divide by 7.
When you do what you do in your example you start with an unknown A register adding the first value. You can of course clear the A register or load it with 0 before you start the adding(with 7 values.

Remember to check that the 7 values does not add up to more than 255(carry) for a single 8 bit value. If more, you need to use a 16bit (D=A+B) value in your computation. To use the IDIV instruction you need to use the D-register any way. IDIV-> D= (D/IX).
If you don't know if the sum of the 7 values is >255 you should use D as the accumulator. Remember to addc A, #0 \after each addition to add in the carry. Also remember to clear the carry before you add in each of the digits or use the add a,.... that does not use carry.

Good luck.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…