#################################################################### # # # NAME: # # # #################################################################### # # Example HW3 Program # The program is represented simply as a sequence of words in memory. # # You should feel free to use this file as a template for creating # your own test programs. # .data .globl code # the symbol code must be global code: .word 0xD0000000 # clear .word 0xE0000008 # push 8 .word 0xE0000009 # push 9 .word 0x10000000 # add .word 0x10000000 # add .word 0xF0000000 # show .word 0xE0000003 # push 3 .word 0xE0000004 # push 4 .word 0x30000000 # mult .word 0xF0000000 # show .word 0x20000000 # sub .word 0xF0000000 # show .word 0xEffffffe # push -2 .word 0x30000000 # mult .word 0xF0000000 # show .word 0x00000000 # stop #==================================================================== # Static data allocation and initialization #==================================================================== # PUT YOUR STATIC DATA DEFINITIONS HERE .text #==================================================================== # Program text #==================================================================== .globl main main: # # Main program entry # subu $sp, $sp, 4 # allocate stack frame sw $ra, 0($sp) # save return address # # Main body # # Register usage: # EXPLAIN USAGE OF ANY REGISTERS WHOSE USE IS DEDICATED TO ONE TASK # IN YOUR CODE HERE... # # main exit # exit: lw $ra, 0($sp) # restore return address addiu $sp, $sp, 4 # pop stack frame j $ra # return