## hello.asm A "Hello World" program. ## Registers used: ## $v0 - syscall parameter and return value. ## $a0 - syscall parameter-- the string to print. .text #Code starts at 0x00400024 in SPIM .globl main main: la $a0, hello_msg # load addr of hello_msg into $a0. li $v0, 4 # 4 is the print_string syscall. syscall # do the syscall. li $v0, 10 # 10 is the exit syscall. syscall # do the syscall. .data #Data starts at 0x10010000 in SPIM hello_msg: .asciiz "Hello World\n" ## Notes: ## la $a0, hello_msg assembles as ## lui $1, 0x1001 ## ori $4, $1, 0 ## ## li $v0, 4 assembles as ## ori $2, $0, 4