#-------------------------------------------
# Subroutines - Main Function
# Author: Noah Gergel
# Date: May 11 2020
#-------------------------------------------

.text

# Example of the main function.
main:

    # Dummy code. This is where the first lines of the program will be run.
    addi    t0, zero, 1
    addi    t1, zero, 1
    sub     t0, t0, t1

    # ...

    # We can call functions from within main.
    jal     ra, foo

    # ...

    # Exit the program.
    addi    a7, zero, 10
    ecall

# Does a neat thing.
foo:
    # Ah yes, very neat.
    addi    t0, zero, 2

    # Return to main.
    jalr    zero, ra, 0