I am a student from lovely sunny Queensland in Australia. I am currently studying for a Bachelor of Technology (Infomation Systems). I am the 1/2 point and am really enjoying the challenge.
This current assignment that I am doing is a little too challenging for me. It has a list of 4 requirements that progressively build on each other. I have managed to get requirement 2 working. I am not sure if it is acceptable to post the assignment specs here or not so I will paraphrase them.
requirement 1: add two digits that are entered seperated by a space and then display the answer ie 6 8 The sum is 14. That is all good, got that working.
requirement 2: modify to accept multi-digit integers with the same number of digits up to 3 almost got that bit under control, it works until there is an overflow. ie the sum results in a 4 digit answer I end up getting an odd hex answer, I think I know where the problem is but really have no idea how to solve it, any help would be greatly appreciated. Once I have that bit sorted then maybe I can move on, or ask for more help
requirement 3: modify the program to accept multi-digit integers with numbers of different lengths. This I think I can work out but any hints wouldn't be rejected
and finally requirement 4: modify the program to accept floating point number of up to 3 digits each with exactly the same format,that is , with the same number of digits to either side of the decimal. This I have absolutely no idea how to do, again any hints would be greatly appreciated.
This is the segment of code where I think I have the problem, if more code is need I am happy to add all of it, but thought just for starter this would be a good place to be.
Sorry I am not very good at this, my whole assignment is a mismatch of bits of code found here and there, I am sure there is quite a bit of it that does absolutely nothing. I really do apologise for my ignorance, but I am giving this assignment 120% effort, I am just not getting it very well.
Thanks in advance for any help given, it will be very much appreciated.
CONVERT MOVE.W D2,D0;get the number ASR.W D1,D0;shift the number first right bit AND.W #$000F,D0;discard the other bits for this exercise ;(we can only work on one digit at a time) ADD.W #'0',D0;convert to ascii by adding zero CMP.W #'9',D0; check if the number is greater than 9 (hex digit max) BLE NEXT_BIT;if it is greater than nine move the bit left ADD.W #$07,D0; add seven to the value to take to the next bit NEXT_BIT TRAP #14;complete the outch function and display character SUBQ.W #04,D1; subtract 4 to point to the next digit BGE CONVERT;repeat convert subroutine if there are more digits to process MOVE.W D2,D0 MOVE.W (SP)+,D1;restore stack registers MOVE.W (SP)+,D2 MOVE.W (SP)+,D7 RTS ;;return from subroutine
This post has been edited by giddyupgirl: 16 May 2008 - 05:56 PM