0

Hello Evreryone,

I am new here and would love some help with a project I have. I have to create a MIPS program where we implement different funcntions. I was able to do strcopy but Im having trouble finding how to code the strchr, strcmp, and memset functions. Unfortunately I am new to MIPS and do not know how the funcntions are written. Could anyone show me how to write the code or some code examples for the three library functions please? The functions will be called by a test file so no main is needed. Thanks for all the help. Heres my str copy, I hope it is right

strcpy:

addi $sp, $sp, -4

sw $s0, 0($sp)

add $s0, $zero, $zero

L1:

add $t1, $s0, $a1

lb $t2, 0($t1)

add $t3, $s0, $a0

sb $t2, 0($t3)

beq $t2, $zero, L2

addi $s0, $s0, 1

j L1

L2:

lw $s0, 0($sp)

addi $sp, $sp, 4

jr $ra

Edited by Reverend Jim: Corrected code formatting

2
Contributors
1
Reply
17
Views
1 Week
Discussion Span
Last Post by rproffitt
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.