sub.s
1013 Bytes
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
/*
*
*/
#
# define some symbolic registers to make this clearer: (I hope)
#
.name s_int, $v2
.name s_frac, $v3
.name t_int, $v4
.name t_frac, $v5
.name res_int, $v6
.name res_frac, $v7
.name invres_int, $v8
.name invres_frac, $v9
.name dev_null, $v0
.name in_base, $20
.name in_sip, $21
.name in_sfp, $22
.name in_tip, $23
.name in_tfp, $24
.name out_ip, $25
.name out_fp, $26
#define TASKDATABASE 0x3000
addi in_base, $0, TASKDATABASE
addi in_sip, in_base, 0 # s int
addi in_sfp, in_base, 2 # s frac
addi in_tip, in_base, 4 # t int
addi in_tfp, in_base, 6 # t frac
addi out_ip, in_base, 16 # result hi
addi out_fp, in_base, 18 # result lo
main: # get s and t:
lsv s_int[0], 0(in_sip)
lsv s_frac[0], 0(in_sfp)
lsv t_int[0], 0(in_tip)
lsv t_frac[0], 0(in_tfp)
nop
nop
nop
nop
vsubc res_frac, s_frac, t_frac
vsub res_int, s_int, t_int
nop
nop
nop
nop
nop
nop
vrcpdh invres_int, res_int[0]
vrcpdl invres_frac, res_frac[0]
nop
nop
nop
nop
nop
break