Hello!
I'm a newbie in assembly and i'm facing some difficulties with handling 64 bit integers in pcSpim.
What i am trying to do is read a string, convert it to a 64-bit number and then store it in two 32-bit registers.
Should i create a 'for' loop which reads the characters of the string one-by-one and somehow stores the first 32 bits in the first register and the 32 bits left in the other one??
And what about the convertion?

I guess i should also check for errors, like dealing with numbers of length greater than 64 bits etc...


Thanks in advance for any help you could provide me and sorry for the messy writing:)

Yes, use them in a loop. You should be looking at the mult and add opcodes.

Remember how a number is constructed: by powers of ten.

5 * 10^2 = 500
4 * 10^1 = 40
3 * 10^0 = 3

add them all up to get 543.

Hope this helps.

Yes, use them in a loop. You should be looking at the mult and add opcodes.

Remember how a number is constructed: by powers of ten.

5 * 10^2 = 500
4 * 10^1 = 40
3 * 10^0 = 3

add them all up to get 543.

Hope this helps.

I don't know about ziggyz, but your idea worked for me.

Thanx a lot for that technique. I spent almost 3 days trying to get a number (1987) to store as a variable so I could manipulate it (+, -, /, *)

Again,

Thanks a lot. (Can't say that enough)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.