25.12.2012 Views

MIPS and SPIM tutorial

MIPS and SPIM tutorial

MIPS and SPIM tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.asciiz<br />

A directive that<br />

stores a NUL<br />

terminated string in<br />

the data segment.<br />

Ok, but how is a<br />

string<br />

represented?<br />

.data<br />

STR: .asciiz "abcdefghijklmnopqrstuvxyz"<br />

.text<br />

.globl main<br />

main: la $t0, STR<br />

lw $t1, 0($t0)<br />

lb $t2, 0($t0)<br />

lb $t3, 1($t0)<br />

lb $t4, 2($t0)<br />

lb $t5, 3($t0)<br />

string.s<br />

jr $ra Each character in the<br />

alphabet is assigned a 2<br />

digit hexadecimal number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!