Assembly Code need help please!

Status
Not open for further replies.

jtulng

Solid State Member
Messages
6
I don't quite get this from my lecture that he want us to do.

Can someone please help me on this? Yes I tried googling and class mates are bunch of jack asses..

This is what I need to do;

To modify this program below to accept multi-digit integers with perhaps different numbers of digits of up to 3 digits each.

Enter two integers separated by a space:

[697 81]

The sum is 778

You may assume that the input is in the correct format

Any idea guys? Much appreciated for any help
 
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.

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.

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
 
Status
Not open for further replies.
Back
Top Bottom