-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Risc-V Assembler program to print "Hello World!" | ||
# to stdout. | ||
# | ||
# a0-a2 - parameters to linux function services | ||
# a7 - linux function number | ||
# | ||
|
||
# Setup the parameters to print hello world | ||
# and then call Linux to do it. | ||
.text | ||
_start: | ||
addi a0, x0, 1 # 1 = StdOut | ||
la a1, helloworld # load address of helloworld | ||
addi a2, x0, 13 # length of our string | ||
addi a7, x0, 64 # linux write system call | ||
ecall # Call linux to output the string | ||
|
||
# Setup the parameters to exit the program | ||
# and then call Linux to do it. | ||
|
||
addi a0, x0, 0 # Use 0 return code | ||
addi a7, x0, 93 # Service command code 93 terminates | ||
ecall # Call linux to terminate the program | ||
|
||
.data | ||
helloworld: .string "Hello World!\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters