MIPS assembly: how to declare integer values in the .data section?
Posted
by Barney
on Stack Overflow
See other posts from Stack Overflow
or by Barney
Published on 2010-04-12T03:21:31Z
Indexed on
2010/04/12
3:33 UTC
Read the original article
Hit count: 566
I'm trying to get my feet wet with MIPS assembly language using the MARS simulator.
My main problem now is how do I initialize a set of memory locations so that I can access them later via assembly language instructions?
For example, I want to initialize addresses 0x1001000 - 0x10001003 with the values 0x99, 0x87, 0x23, 0x45. I think this can be done in the data declaration (.data) section of my assembly program but I'm not sure of the syntax. Is this possible?
Alternatively, in the .data section, how do I specify storing the integer values in some memory location (I don't care where, but I just want to reference them somewhere). So I'm looking for the C equivalent of "int x = 20, y=30, z=90;" I know how to do that using MIPS instructions but is it possible to declare something like that in the .data section of a MIPS assembly program?
© Stack Overflow or respective owner