CS326 HW2 and HW3

CS326 HW2 and HW3 - Eric Diehl Base program for Homework#2...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
# Eric Diehl # Base program for Homework #2 # Enter your data definitions in the .data segment section .data input: .asciiz "Please enter a number: " # Part 1 num1: .byte 255 # Part 3 num2: .byte 255 num3: .byte 255 char: .byte 'N' # Part 5 volume: .word 16581375 # Part 4 output: .asciiz "Final result: " # Part 2 # Make no changes below this comment line .text main: exit: ori $v0, $zero, 10 syscall # Eric Diehl # Homework #3 #Registry Usage # $t1 - Y, C, (F+A+B)-E, # $t2 - W, D, (C-D)-((F+A+B)-E) aka J # $t3 - (Y+W), (C-D), H+J aka K # $t4 - X, F # $t5 - (Y+W)-X, A # $t6 - Z, F+A # $t7 - ((Y+W)-X)+Z aka H, B # $s1 - H # $s2 - J # $s3 - K # $s4 - # $s5 - # $s6 - # $s7 - # $t8 - F+A+B # $t9 - E
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
# Variable Definitions .data a: .byte 4 b: .byte 8 c: .byte 50 d: .byte 1 e: .byte 7 f: .byte 2 h: .word 0 j: .word 0 k: .word 0 w: .byte 64 x: .byte 32 y: .byte 127 z: .byte 16 # Operation Statements .text lui $s1, 0x1001 #sets default registry # Equation 1 - H = ((Y+W)-X)+Z lw $t1, 0($s1) #load Y (127) lw $t2, 4($s1) #load W (64) add $t3, $t1, $t2 # adds then stores Y+W (191) lw $t3, 8($s1) #load Y+W (191) lw $t4, 12($s1) #load X (32) sub $t5, $t3, $t4 #subtracts then stores (Y+W)-X (159) lw $t5, 16($s1) #load (Y+W)-X (159) lw $t6, 20($s1) #load Z (16) add $t7, $t5, $t6 # add then stores ((Y+W)-X)+Z (175) sw
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern