Search code examples
assemblymips32qtspim

How to declare string variable in assembly?


How can I declare a string variable without initialization in MIPS assembly? And then it receives an amount from the user.

For example: string judge;


Solution

  • By using the .space directive to reserve some space:

    .data
    foo: .space 100  # Reserve 100 bytes of space
    
    .text
    la $a0, foo      # Load the address of foo
    # Do whatever