简体   繁体   中英

MIPS .space directive

how do I allocate an array in MIPS, of a size determined by the data in a register? pseudocode:

li $t0,30
.data
input_array:
.space $t0*4

everything I find about the .space directive indicates that it only takes an immediate value n.

In assembly program, you don't allocate anything, especially data structures. The data structures in assembly are how you use a block of memory. You can, of course, ask (allocate) more memory for your program from the OS (if you are not programming bare metal), but still it's just memory. The way you access it makes it an array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM