hi all
i'm trying to solve an exercise;
there's an unaligned word, shifted 1/4 word right. it's address (where it should be if was stored correctly) is at register $s0.
i'm interested in storing the word at register $t1 using aligned commands only.
i tried;

lw  $ta, $s0
sll $t1, $ta, 8
lw  $ta, 4($s0)
srl $t2,  $ta, 24
or $t1, $t1, $t2

is this solution correct?

Recommended Answers

All 3 Replies

> is this solution correct?
Try it yourself perhaps?

i can only write some basic assembly for virtual machine in theory :)

Well for a theory answer, it looks OK (well it has the general components I would expect for solving the problem).

Do you have a real CPU you can try your code on?
Do you have an emulated CPU you can try your code on?

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.