1 / 5

SPIM syscalls

SPIM syscalls. I/O. Appendix A: SPIM syscalls. usage. Put in the proper code in $v0 Put in the proper argument in $a0, if required syscall See examples following. .text # Other code # write("How many pennies?"); la $a0, manyPennies li $v0, 4 syscall

liko
Download Presentation

SPIM syscalls

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. SPIM syscalls I/O

  2. Appendix A: SPIM syscalls

  3. usage • Put in the proper code in $v0 • Put in the proper argument in $a0, if required • syscall • See examples following

  4. .text # Other code # write("How many pennies?"); la $a0, manyPennies li $v0, 4 syscall # read(pennies); li $v0, 5 syscall sw $v0, pennies .data pennies: .space 4 manyPennies: .asciiz "How many pennies? "

  5. # write(totalCents); write integer lw $a0, totalCents li $v0, 1 syscall # write(" cents"); write string la $a0, cents li $v0, 4 syscall # System.exit(0) li $v0, 10 syscall .data # other data definitions / initializations .align 2 totalCents: .space 4 cents: .asciiz “ cents”

More Related