Gasper Gulotta
Gasper Gulotta

Reputation: 159

Converting C to MIPS assembly with pointers

I'm trying to store a pointer initialized as:

int* x;

into a regular variable initialized as

int y;

thus:

y = *x;

In mips is it just as simple as

$s1 = ($a0);?

And vice versa?

Upvotes: 3

Views: 6686

Answers (1)

Carl Norum
Carl Norum

Reputation: 224844

Assembly language usually doesn't have operators. You probably want the lw instruction:

lw $s1, 0($a0)

The use of $s1 and $a0 is of course context dependent. If those register match the rest of the code you're using, it'll be fine.

Upvotes: 3

Related Questions