.global _start # let's us export an elf file so the linker can see it _start: ### Invoking the Write syscalls ### # Check `man 2 write` # ssize_t write(int fd, const void *buf, size_t count) # stdout FD =1 by the way in standard linux # Setup syscall number in a7 to be the write syscall (which is 64) addi a7, zero, 64 # put the file descriptor value into a0 addi a0, zero, 1 # We need to load into a1 the address of our helloworld label la a1, helloworld # Now we need to set the last argument to the string of the string we want to write addi a2, zero, 15 ecall ### SYSTEM EXIT ### # Adding into a7 the number 93 which is syscall number for exit addi a7, zero, 93 # check man exit `void exit(int status)`. We need to put into a0 the argument to exit syscall addi a0, zero, 13 # invoke the syscall ecall # This is a label called helloworld. # The string is 15 bytes long since this is ascii helloworld: .ascii "Hello, RISC V\n"