Computer Organization

Computer Organization - lw $a0, 0($sp) jal print # Use the...

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

View Full Document Right Arrow Icon
The Load/Store family Sw – Store word, lw – load word Addi $t0, $0, 55 Sw $t0, 400($0) {addi $t5, $0, 400 {sw $t0, 0($t5) T5 = 300, sw 100($t5) Mem.s .data Num: .word 0 # reserve 1 word with init val 0 .space 55 # reserve 55 bytes .text Main: add $s0, $0, $ra #Arbitrary Location – DON’T DO IT! addi $t0, $0, 55 Sw $t0, 0x10000010($0) Lw $a0, 0x10000010($0) Jal print addi $t0, $0, 56 Sw $t0, 0x10000000($0) Addi $t5, $0, 0x10 Lw $a0, 0x10000000($t5) Jal print # Use the stack - Stack Pointer = sp, addi $t0, $0, 65 sw $t0, 0($sp) addi $sp, $sp, -4 # Increment stack after adding, and decrement before retrieving
Background image of page 1

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

View Full DocumentRight Arrow Icon
addi $sp, $sp, 4
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lw $a0, 0($sp) jal print # Use the heap Addi $t0, $0, 75 Addi $t1, $0, -75 Addi $a0, $0, 8 # Reserve 8 bytes Addi $v0, $0, 9 Syscall # v0 points at and 8B block Add $s5, $0, $v0 Sw $t0, 0($v0) Sw $t1, 4($v0) Lw $a0, 0($s5) Jal print Lw $a0, 4($s5) Jal print # Use .data Addi $t0, $0, 85 Sw $t0, num($0) Lw $a0, num($0) Jal print add $ra, $0, $s0 Jr $ra # Method for printing print: Addi $v0, $0, 1 Syscall Addi $a0, $0, 10 Addi $v0, $0, 11 syscall Jr $ra Leaking means you allocate memory location but never de-allocated it....
View Full Document

This note was uploaded on 01/26/2011 for the course CSE 2021 taught by Professor Asif during the Winter '10 term at York University.

Page1 / 3

Computer Organization - lw $a0, 0($sp) jal print # Use the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online