MIPS Print String that was red without BREAKS -


.data: str2: .space 20   #read string   la $a0,str2  li $a1,20  li $v0,8 syscall  #print string   la $a0, str2 li $v0, 4  syscall   #print string       la $a0, str2     li $v0, 4      syscall 

the result:

exampletex

(i dont want break... how remove it?)

exampletext

-- program finished running (dropped off bottom) --

your problem service 8 adds newline @ end of input string, have replace null byte (0) add code after syscall reads str2:

  # remove trailing newline   li $a3, '\n' newlineloop:   beqz $a1, newlineloopend   subu $a1, $a1, 1   lb $a2, str2($a1)   bne $a2, $a3, newlineloop   li $a3, 0   sb $a3, str2($a1) newlineloopend:  

it search newline character , replace null byte


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -