944,129 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 6136
  • Assembly RSS
Oct 29th, 2004
0

Easy (I hope) MIPS (SPIM) Question

Expand Post »
Alright, I got this assembler class, and we're doing mips, and such.
Anyway, I got this problem, see.

I have to read in a number in binary (sign magnitude), convert it to decimal, then convert that to a string of ascii characters, and then print them out, with a - sign if necessary.

The only thing I have problems with is printing them out.
Say I've made a character, on the stack.
Say it's
0x33000000
ASCII, 3<null><null><null>
So it would print 3, then stop (when it hits null)

However!
I have to load an ADDRESS into $a0 to print a string.

How do I load the address of a register??

Say I have my string in $t6. I want to print that string, which is basically one ascii character, from 0-9 (maybe -), then three null characters.
How do I load the ADDRESS and not the VALUE of $t6 into $a0.
(I can't use labels)

I bet it's simple... I hope...
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SexConker is offline Offline
2 posts
since Oct 2004
Oct 29th, 2004
0

Re: Easy (I hope) MIPS (SPIM) Question

I don't know MIPS, but you need to move the register value into a local variable.

in x86 assembler it would be something like:

mov esp[-3], eax

where esp is the stack pointer, and -3 was where you wanted the local variable.
Reputation Points: 36
Solved Threads: 11
Posting Pro in Training
Chainsaw is offline Offline
436 posts
since Jun 2004
Oct 29th, 2004
0

Re: Easy (I hope) MIPS (SPIM) Question

Yeah, I got it last night.
Apparantly I had to so a
la $a0, 0$(sp)

I thought I did that before.
I tried SO many things, loading words, bytes, etc,
addresses of all sorts of offsets, you name it.

Oh well, thanks anyway.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SexConker is offline Offline
2 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Next Thread in Assembly Forum Timeline: __int64 Addition with MSVC60 asm





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC