tag234 0 Newbie Poster

Hello,

ive got a quick question about changing characters within a .asciiz. Here is a snippet from the code im working with:

## This is 300004D2 ##
la       $a0,value         # Initialize the value
lw       $a0,0($a0)


## This is equal to 8##
la       $a1,count          # Initialize the loop counter
lw       $a1,0($a1)


## hexmsg: .asciiz "hhhhhhhh(16)\n\n" <-- This is what its pointing to##
la       $a2,point         # Initialize the character pointer
lw       $a2,0($a2)

         ori      $a3,$0,1 
 	 sub      $a3,$a1,$a3
	 add      $a2,$a2,$a3       # Calculated output pos

##^^ Uses formula   outputpos = point(a2) + count(8) - 1;

loop4:	
andi     $a3,$a0,0xF
lw       $t8,0($a2)
sb       $a3,0($t8)        # Set the output string character

srl      $a0, $a0, 4

ori      $a3,$0,1 
sub      $a1,$a1,$a3         # decrement the input  string pointer
sub      $a2,$a2,$a3         # decrement the output string pointer
	
bgtz     $a1, loop4

jr       $ra               # Return

What this is supposed to do is modify the .asciiz hexmsg's h characters and replace them with their correct hex representations. $a0, or value, contain that hex value that i would like to imprint on the h characters.

I cant seem to get it to work >.< Ive tried this code and some variations but nothing seems to work.. Any help is appreciated