Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Assembly Code need help please!
Closed Thread
Old 05-18-2008, 09:09 PM   #1 (permalink)
jtulng's Avatar
 
Newb Techie

Join Date: Mar 2008

Posts: 6

jtulng is on a distinguished road

Default Assembly Code need help please!

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
jtulng is offline  
Old 05-18-2008, 09:15 PM   #2 (permalink)
peterhuang913's Avatar
 
Retired.

Join Date: Dec 2005

Location: Los Angeles, California

Posts: 8,090

peterhuang913 is an unknown quantity at this point

Send a message via AIM to peterhuang913
Default Re: Assembly Code need help please!

We don't do homework here.
__________________


My computer uses 1.5A-load, .8A-idle, .65A-standby, .05A-turned off on 125V.
"The spaces between your fingers were created so that another's could fill them in."
Quote:
Originally Posted by Norcent View Post
I need to stop using the internet.
peterhuang913 is offline  
Old 05-18-2008, 09:40 PM   #3 (permalink)
jtulng's Avatar
 
Newb Techie

Join Date: Mar 2008

Posts: 6

jtulng is on a distinguished road

Default Re: Assembly Code need help please!

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.

Quote:
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

jtulng is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attack Code Posted For Microsoft Works Bug Osiris Virus - Spyware Protection / Detection 0 02-13-2008 07:33 PM
PHP: How to modify a downloaded JavaScript code and partly change the code within it? LincolnX Programming Discussions 4 01-25-2008 04:25 PM
Someone take a look at my Java code PnkFloyd27 Programming Discussions 4 06-21-2007 08:11 PM
NEED help with a Javascript code...(mouseover and stuff) Quintox Web Graphics, Design, Digital Images 7 05-02-2007 06:41 PM
Assembly Lanuguage ZeroShade Programming Discussions 3 04-13-2007 10:16 PM