#This program contains some very basic instructions #to demonstrate the fundamentals fo assembly language programming. #author: Hornick #CS2710 - 12/12/12 .text #.text directive (default) just tells the assembler where to put the instructions in memory main: #this label is assigned the value of the address of the next instruction #examples of numeric formats addi $t0, $zero, 100 # load t0=100 via a base-10 value addi $t1, $zero, 0144# 0144 is base-8 (octal) = 100 base-10 addi $t2, $zero, 0x64# 0x64 is base-16 (hexadecimal) = 100 base-10 #examples of instructions andi $t0, $zero, 1 # increment t0 (equivalent to t0++); sll $t1, $t0, 1 # t0 = t1<<1; this effectively muliplies by 2 addu $t0, $s1, $s2 # t0 = s1 + s2; treat as unsigned add $t1, $s1, $s2 # t1 = s1 + s2; treat as signed lw $t1, x # t1 = value of memory at location x .data 0x10010020 #.data directive tells the assembler where to put data in memory x: #this label=address in memory of the MSB of the following word .word 0x12345678 y: #this label=address in memory of the first of the following bytes .byte 1,2,3,4,5,6,7,8 #Caution: observe how the assembler places these in memory!