Warning, /frameworks/syntax-highlighting/autotests/input/highlight.asm-mips is written in an unsupported language. File is not indexed.
0001 # A demonstration of some simple MIPS instructions 0002 # used to test QtSPIM 0003 0004 # Declare main as a global function 0005 .globl main 0006 0007 # All program code is placed after the 0008 # .text assembler directive 0009 .text 0010 0011 # The label 'main' represents the starting point 0012 main: 0013 li $t2, 25 # Load immediate value (25) 0014 lw $t3, value # Load the word stored in value (see bottom) 0015 add $t4, $t2, $t3 # Add 0016 sub $t5, $t2, $t3 # Subtract 0017 sw $t5, Z #Store the answer in Z (declared at the bottom) 0018 0019 # Exit the program by means of a syscall. 0020 # There are many syscalls - pick the desired one 0021 # by placing its code in $v0. The code for exit is "10" 0022 li $v0, 10 # Sets $v0 to "10" to select exit syscall 0023 syscall # Exit 0024 0025 # All memory structures are placed after the 0026 # .data assembler directive 0027 .data 0028 0029 # The .word assembler directive reserves space 0030 # in memory for a single 4-byte word (or multiple 4-byte words) 0031 # and assigns that memory location an initial value 0032 # (or a comma separated list of initial values) 0033 value: .word 12 0034 Z: .word 0