Skip to content

Commit

Permalink
feat: add code sample file
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Oct 4, 2024
1 parent 84c9613 commit 5917c7d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions samples/mipsasm.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.text
.global AckermannFunc

# Preconditions:
# 1st parameter ($a0) m
# 2nd parameter ($a1) n
# Postconditions:
# result in ($v0) = value of A(m,n)

AckermannFunc:
addi $sp, $sp, -8
sw $s0, 4($sp)
sw $ra, 0($sp)

# move the parameter registers to temporary - no, only when nec.

LABEL_IF: bne $a0, $zero, LABEL_ELSE_IF

addi $v0, $a1, 1

# jump to LABEL_DONE
j LABEL_DONE

# From https://github.com/highlightjs/highlight.js/blob/81e450f3eba5c3e9112a249ae85b696371d738f9/test/markup/mipsasm/default.txt

0 comments on commit 5917c7d

Please sign in to comment.