-
Notifications
You must be signed in to change notification settings - Fork 1
/
shapetest2.s
102 lines (102 loc) · 1.4 KB
/
shapetest2.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Plane Intersection Tester
.data
prompt:
.asciiz "Enter Ray Postion (x,y,z), Direction (x,y,z), Plane Point (x,y,z) and Plane Normal (x,y,z)\n"
ret:
.asciiz "\n"
plane: .word 0,0,0,0,0,0,0,0,0,0,0,0,0
ray: .word 0,0,0,0,0,0,0,0,0,0,0,0
.text
.globl main
main:
la $a0, prompt
li $v0, 4
syscall
la $s0, ray
la $s1, plane
li $v0, 7
syscall
s.d $f0, 0($s0)
syscall
s.d $f0, 8($s0)
syscall
s.d $f0, 16($s0)
syscall
s.d $f0, 24($s0)
syscall
s.d $f0, 32($s0)
syscall
s.d $f0, 40($s0)
syscall
s.d $f0, 4($s1)
syscall
s.d $f0, 12($s1)
syscall
s.d $f0, 20($s1)
syscall
s.d $f0, 28($s1)
syscall
s.d $f0, 36($s1)
syscall
s.d $f0, 44($s1)
# Test Intersect
la $a0, ray
la $a1, plane
jal plane.intersect
beq $v0, $zero, exit
add $a0, $v0, $zero
li $v0, 1
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
mov.d $f12, $f0
syscall
li $v0, 4
la $a0, ret
syscall
#Test Reflect
la $a0, ray
la $a1, plane
jal plane.reflect
add $s3, $v0, $zero
li $v0, 3
l.d $f12, 0($s3)
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
l.d $f12, 8($s3)
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
l.d $f12, 16($s3)
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
l.d $f12, 24($s3)
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
l.d $f12, 32($s3)
syscall
li $v0, 4
la $a0, ret
syscall
li $v0, 3
l.d $f12, 40($s3)
syscall
li $v0, 4
la $a0, ret
syscall
exit:
li $v0, 10
syscall