1 /*---------------------------------------------------------------------------+
2 | fpu_arith.c |
3 | |
4 | Code to implement the FPU register/register arithmetis instructions |
5 | |
6 | Copyright (C) 1992 W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
7 | Australia. E-mail apm233m@vaxc.cc.monash.edu.au |
8 | |
9 | |
10 +---------------------------------------------------------------------------*/
11
12 #include "fpu_system.h"
13 #include "fpu_emu.h"
14
15
16 void fadd__()
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
17 {
18 /* fadd st,st(i) */
19 reg_add(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr);
20 }
21
22
23 void fmul__()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
24 {
25 /* fmul st,st(i) */
26 reg_mul(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr);
27 }
28
29
30
31 void fsub__()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
32 {
33 /* fsub st,st(i) */
34 reg_sub(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr);
35 }
36
37
38 void fsubr_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
39 {
40 /* fsubr st,st(i) */
41 reg_sub(&st(FPU_rm), FPU_st0_ptr, FPU_st0_ptr);
42 }
43
44
45 void fdiv__()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
46 {
47 /* fdiv st,st(i) */
48 reg_div(FPU_st0_ptr, &st(FPU_rm), FPU_st0_ptr);
49 }
50
51
52 void fdivr_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
53 {
54 /* fdivr st,st(i) */
55 reg_div(&st(FPU_rm), FPU_st0_ptr, FPU_st0_ptr);
56 }
57
58
59
60 void fadd_i()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
61 {
62 /* fadd st(i),st */
63 reg_add(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
64 }
65
66
67 void fmul_i()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
68 {
69 /* fmul st(i),st */
70 reg_mul(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
71 }
72
73
74 void fsubri()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
75 {
76 /* fsubr st(i),st */
77 /* This is the sense of the 80486 manual
78 reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm)); */
79 reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
80 }
81
82
83 void fsub_i()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
84 {
85 /* fsub st(i),st */
86 /* This is the sense of the 80486 manual
87 reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm)); */
88 reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
89 }
90
91
92 void fdivri()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
93 {
94 /* fdivr st(i),st */
95 reg_div(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
96 }
97
98
99 void fdiv_i()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
100 {
101 /* fdiv st(i),st */
102 reg_div(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
103 }
104
105
106
107 void faddp_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
108 {
109 /* faddp st(i),st */
110 reg_add(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
111 pop();
112 }
113
114
115 void fmulp_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
116 {
117 /* fmulp st(i),st */
118 reg_mul(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
119 pop();
120 }
121
122
123
124 void fsubrp()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
125 {
126 /* fsubrp st(i),st */
127 /* This is the sense of the 80486 manual
128 reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm)); */
129 reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
130 pop();
131 }
132
133
134 void fsubp_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
135 {
136 /* fsubp st(i),st */
137 /* This is the sense of the 80486 manual
138 reg_sub(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm)); */
139 reg_sub(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
140 pop();
141 }
142
143
144 void fdivrp()
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
145 {
146 /* fdivrp st(i),st */
147 reg_div(FPU_st0_ptr, &st(FPU_rm), &st(FPU_rm));
148 pop();
149 }
150
151
152 void fdivp_()
/* ![[previous]](../icons/left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
153 {
154 /* fdivp st(i),st */
155 reg_div(&st(FPU_rm), FPU_st0_ptr, &st(FPU_rm));
156 pop();
157 }
158