jason dancks
jason dancks

Reputation: 1142

Inconsistent compiling mips

Usually I don't have problems writing assembly and testing and debugging. But then sometimes the compiler doesn't like the newline character and I don't know why. This problem usually happens with the Berkeley spim simulator

sample code:

.text
.globl __start

__start:

la $a0,crlf
li $v0,4
syscall

li $v0,10
syscall

.data

crlf: .asciiz "\n"

what am I doing wrong?

Upvotes: 0

Views: 125

Answers (2)

iVikD
iVikD

Reputation: 296

Another way to do it would be

    crlf: .byte 13,10,00

This is what I use when \n gives me issues.

Upvotes: 1

m0skit0
m0skit0

Reputation: 25873

Maybe you should try with

crlf:
.db 0x0A 0x0D 0x00

Also keep in mind that only Windows uses CRLF for a new line. Most systems use CR only.

Upvotes: 0

Related Questions