1

How do I initialize this .space to zeroes? I want every single bit to be 0.

My code subroutine:

.data
.align 2
memspace: .space 256
.text
la   $t7, memspace
move $t2, $zero
add  $t2, $t2, 64         # should this be 256 / 4? confused
loop:
    beq  $t2, $zero, done
    sw   $t0, ($t7)
    addi $t7, $t7,   4
    addi $t2, $t2,   -1
    j loop
done:
    jr $ra

I definitely am doing something wrong as when I use xspim and look under my data segment I don't see the reserved space of 256. I feel like my $t registers don't do anything to the actual memory locations. I'm really confused right now. Should I be using stack pointers?

Konrad Lindenbach
  • 4,911
  • 1
  • 26
  • 28
user3034572
  • 95
  • 1
  • 3
  • 9

1 Answers1

0

You want

memspace: .space 0:256

This will initialize everything to 0, although i believe 0 is the default. See How to initialise a huge array in MIPS assembly?

john k
  • 6,268
  • 4
  • 55
  • 59