| 1 |
# Original source from https://eng.libretexts.org |
| 2 |
# Kann, Charles W., "Introduction To MIPS Assembly Language Programming" (2015). Open Textbooks. 2. |
| 3 |
# https://cupola.gettysburg.edu/oer/2 |
| 4 |
|
| 5 |
# Program File: Program2-1.asm |
| 6 |
# Author: Charles Kann |
| 7 |
# Purpose: First program, Hello World |
| 8 |
.text # Define the program instructions. |
| 9 |
main: # Label to define the main program. |
| 10 |
li $v0,4 # Load 4 into $v0 to indicate a print string. |
| 11 |
la $a0, greeting # Load the address of the greeting into $a0. |
| 12 |
syscall # Print greeting. The print is indicated by |
| 13 |
# $v0 having a value of 4, and the string to |
| 14 |
# print is stored at the address in $a0. |
| 15 |
li $v0, 10 # Load a 10 (halt) into $v0. |
| 16 |
syscall # The program ends. |
| 17 |
.data # Define the program data. |
| 18 |
greeting: .asciiz "Hello World" #The string to print. |