68K Assembly Language help

liunx

Guest
Hi wonderful people, <br /><br />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.<br /><br />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.<br /><br /><!--coloro:#33CC00--><span style="color:#33CC00"><!--/coloro-->requirement 1: add two digits that are entered seperated by a space and then display the answer ie 6 8 The sum is 14.<!--colorc--></span><!--/colorc--> That is all good, got that working.<br /><br /><!--coloro:#33CC00--><span style="color:#33CC00"><!--/coloro-->requirement 2: modify to accept multi-digit integers with the same number of digits up to 3 <!--colorc--></span><!--/colorc--> 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 <img src="http://static.dreamincode.net/forums/style_emoticons/default/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> <br /><br /><!--coloro:#33CC00--><span style="color:#33CC00"><!--/coloro-->requirement 3: modify the program to accept multi-digit integers with numbers of different lengths.<!--colorc--></span><!--/colorc--> This I think I can work out but any hints wouldn't be rejected <img src="http://static.dreamincode.net/forums/style_emoticons/default/wink2.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink2.gif" /> <br /><br />and finally <!--coloro:#33CC00--><span style="color:#33CC00"><!--/coloro-->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. <!--colorc--></span><!--/colorc--> This I have absolutely no idea how to do, again any hints would be greatly appreciated.<br /><br />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. <br /><br />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.<br /><br />Thanks in advance for any help given, it will be very much appreciated.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> CONVERT        MOVE.W    D2,D0;get the number<br />            ASR.W    D1,D0;shift the number first right bit<br />            AND.W    #$000F,D0;discard the other bits for this exercise<br />                    ;(we can only work on one digit at a time)<br />            ADD.W    #'0',D0;convert to ascii by adding zero<br />            CMP.W    #'9',D0;  check if the number is greater than 9 (hex digit max)<br />            <br />            BLE        NEXT_BIT;if it is greater than nine move the bit left<br />            ADD.W    #$07,D0; add seven to the value to take to the next bit<br />            <br />NEXT_BIT    TRAP    #14;complete the outch function and display character<br />            SUBQ.W    #04,D1; subtract 4 to point to the next digit<br />            BGE        CONVERT;repeat convert subroutine if there are more digits to process<br />            MOVE.W    D2,D0        <br />            <br />            MOVE.W     (SP)+,D1;restore stack registers<br />            MOVE.W    (SP)+,D2<br />            MOVE.W    (SP)+,D7<br />            <br />            RTS        ;;return from subroutine    <br /><!--c2--></div><!--ec2--><br /><br /><span class='edit'>This post has been edited by <b>giddyupgirl</b>: 16 May, 2008 - 05:56 PM</span>
</div>
 
Top