1 / 3

Simple MIPS Program with Syscalls for String Manipulation

This MIPS assembly program demonstrates basic syscalls, including printing messages and copying strings. It begins by printing a greeting message, then waits for user input, and finally displays a message indicating that the program is done. The string copy function, `strcpy`, is implemented to clone data from one location to another in memory. This code serves as a practical example of handling data in MIPS assembly and utilizing system calls effectively.

karena
Télécharger la présentation

Simple MIPS Program with Syscalls for String Manipulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MIPS coding

  2. SPIM syscalls • http://www.inf.pucrs.br/~eduardob/disciplinas/arqi/mips/syscall_codes.html

  3. .data msg_hello: .asciiz "Hello! This is CDA3100!\n" msg_empty: .space 400 msg_done: .asciiz "done!\n" .text .globl main main: done: li $v0,1 li $a0,100 syscall li $v0,5 syscall li $v0,4 la $a0,msg_hello syscall li $v0,4 la $a0,msg_empty syscall la $a0,msg_empty #dst la $a1,msg_hello #src jal strcpy li $v0,4 la $a0,msg_empty syscall li $v0,10 #exit syscall strcpy: addi $t0, $a0, 0 addi $t1, $a1, 0 strcpyloop: lb $t3, 0($t1) sb $t3, 0($t0) beq $t3, $0, strcpydone addi $t0, $t0, 1 addi $t1, $t1, 1 j strcpyloop strcpydone: jr $ra

More Related