Getting Data in registers (MIPS Bare)?

427 views Asked by At

Can someone explain the concept of getting strings (data) into registers. I simply want to print a line from .data onto the screen. It seems so easy but I can't understand exactly what I'm doing.

Here's some code:

.data 
 input: .asciiz "Welcome to class 4"

.text
  main:
     addi $v0, $0, 4
     lui $v0, prompt 
     lui $a0, $v0 
     syscall

This is in bare (as the question mentions), so I don't have pseudo instr. My current thinking is I'm using addi to replace the "li" pseudo instruction. I'm adding 4 into register $v0 for a bit offset (which I'm not entirely sure why I need to do this). I was told by a TA this was necessary. I'm then loading the data into $v0 and from $v0 into $a0. Then syscall for printing onto the console.

What am I doing wrong and how can I better understand these concepts?

0

There are 0 answers