# Define variables .data .align 4 num1: .word 5 # First number num2: .word 7 # Second number result: .word 0 # Variable to store the result msg: .ascii "Hello, World!\n" array: .space 100 # 100 bytes of space # Main program entry point .globl start .text start: call test_routine call hello_manual # call hello # This doesn't work call end ebreak # Arbitrary test routine test_routine: la a0, num1 # Load the address of num1 into register a6 li a1, 10 # Load the value 10 into register a5 xori a2, a1, 0x1 # Calculate the value of a2 sw a1, 0(a0) # Store the value in memory ret # Prints "hello" manually hello_manual: addi a0, x0, 0x68 li a1, 0x10000000 sb a0, (a1) # 'h' addi a0, x0, 0x65 sb a0, (a1) # 'e' addi a0, x0, 0x6C sb a0, (a1) # 'l' addi a0, x0, 0x6C sb a0, (a1) # 'l' addi a0, x0, 0x6F sb a0, (a1) # 'o' addi a0, x0, 0x0A sb a0, (a1) # '\n' ret # Is supposed to print "Hello, World!\n" to stdout via ecall, but doesn't work hello: # Write the string "Hello, World!\n" to stdout la a0, msg # Load the address of the string into a0 li a7, 4 # syscall number for write li a1, 13 # Length of the string li a2, 1 # File descriptor: stdout ecall # Make the system call to write ret # Return from the function # Another routine, presumably written for the rars emulator? hello2: li a0, 0x1 la a1, msg li a2, 13 li a7, 64 ecall # To avoid the program from exiting loop: j loop