Lecture 5
- Syscall
- Used for input / output
- Very primitive
- Unique to system
- Spim on unix
- See text appendix A48 and the lesson number one
- Invoked using syscall
- $v0 will contain the service number (there are 10 services)
- $a0..$a3 arguments
- Print integer service number n = 1
- Used for input / output
- Multiply In MIPS
- mult rs, rt
- mult rs, rt
- Division in MIPS
- div rs, rt
- rs/rt
- rs/rt
- Structured loops
- While (save[i] == k ) i = i+j
- Loop in MIPS
- Loop in MIPS
- Get address of save[i]
- Load save[i]
- Go to exit if save != k
- I ß i+ j increment i
- Go to loop
- Loop
Add $t1, $s3, $s3
Add $t1, $t1, $t1
Lw $t0, 0($t1)
Bne $t0, $s5, exit
Add $s3, $s3, $s4
J loop
Exit:
- Branch less than
- Set on less than
- Slt a, b, c
- Set a to 1 when b < c
- This was on the TEST we wrote TWO DAYS AGO. This guy needs a new job.
- Slt a, b, c
No comments:
Post a Comment