Advertisement
math230

MIPS Mars use of syscalls for prompting & reading in integer

May 20th, 2020
6,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.35 KB | None | 0 0
  1. #MIPS assembly: Use Mars syscall to prompt user and read value typed in
  2. .data
  3.  
  4. intPrompt:  .asciiz  "enter an integer: "
  5.  
  6. .text
  7.     # Prompt the user ($v0=4)
  8.     la  $a0, intPrompt
  9.     li  $v0, 4  
  10.     syscall
  11.    
  12.     # Read in an integer ($v0=5)
  13.     li  $v0, 5
  14.     syscall       # value read in will be saved to $v0
  15.    
  16.     add $t1, $zero, $v0  #save integer read.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement