assembly - storing a value into a data segment in MIPS -


hello brand new using mips , confused on wording, simple cannot find in notes or online question.

here code:

.data val1: .word 1 val2: .word 2 val3: .word 3  .asciiz "daniel" .asciiz "enter number " .asciiz "\n"  .globl main .text  main:  addi $s0, $0, 23 # initializes register $s0 23  lui $a0, 0x1001 ori $a0, $a0, 19 ori $v0, $0, 4 syscall addi $v0, $0, 5 syscall addi $s1, $v0, 0 

my question is: how a. store value in $s1 data segment labeled “val1” ?? know how store register not value please , thank you!

la $t0, val1 sw $s1, 0($t0) 

$t0 chosen arbitrarily, doesn't matter register choose use hold base address of val1 array. la (load address) pseudo operation make sure able use first.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -