Skip to content

Instantly share code, notes, and snippets.

@argoc
Last active January 26, 2023 03:14
Show Gist options
  • Save argoc/77ffe85738c12d4bf178ccdb935d1aae to your computer and use it in GitHub Desktop.
Save argoc/77ffe85738c12d4bf178ccdb935d1aae to your computer and use it in GitHub Desktop.
Hello World in RISC-V
.data # declare and initialize variables
hello: .asciz "Hello world!" # string with null terminator
.text # code starts here
main: # label marking the entry point of the program
la a0, hello # load the address of hello into $a0 (1st argument)
addi a7, zero, 4 # code to print the string at the address a0
ecall # make the system call
addi a7, zero, 10 # code to exit
ecall # make the system call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment