I have a larger program that I want to write, but I can't complete it unless I get this down. I have an array, need to put in a string value to be read out. the program generates characters of data at a time, not as a whole string so I have ot be constantly writing to it. so I made the data into bytes. Heres an attempt at the problem on a small scale:

This is my first time dealing with the byte datatype so I don't know what I'm doing.

.text
	.globl __start
__start:

	la $a0,buf
	li $a1,64
	move $t2,$a0

	li $t0,0
	lb $t1,a

loop:	beq $t0,7,done
	sb $t1,0($t2)
	add $t2,$t2,1
	add $t0,$t0,1
	j loop

	li $t0,0
done:	sub $t2,$t2,8
loop2:	
#	move $a0,$t2
#	li $v0,4
#	syscall

	lb $a0,0($t2)
	li $v0,4
	syscall

	add $t2,$t2,8
	add $t0,$t0,1
	ble $t0,8,loop2

	li $v0,10
	syscall
	
	.data
a:	.byte 'a'
buf:	.space 64

While not a solution I just went with a workaround:
I take in a string, change the individual bytes and print the string back out. I don't have to worry about making sure its in string format since it already is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.