# NOTES: 
# This is RISC-V version; 2020
# Use simulator RARS: https://github.com/TheThirdOne/rars/releases (Download only: rars1_4.jar)
# If unsure about an instruction or system-call (i.e., environment-call), always check:
# [instructions]  https://github.com/TheThirdOne/rars/wiki/Supported-Instructions 
# [system calls]  https://github.com/TheThirdOne/rars/wiki/Environment-Calls 

.globl main
.text
  
main:

  # print prompt "Enter your name: " at console
  li a7, 4
  la a0, yourname 
  ecall  
  
  # read string from console to buffer "name"
  li a7, 8
  la a0, name 
  li a1, 13 # limit reading to 12=13-1 chars only
  ecall  

  # print "Your name is: "
  li a7, 4
  la a0, nameprint
  ecall  
  
  # print what user has input earlier as name
  li a7, 4
  la a0, name
  ecall   

  # exit the program
  li a7, 10 
  ecall

.data

yourname:  .asciz "Please Enter Your Name: \n"
name:      .space 13
nameprint: .asciz "Your name is: \n"
