1 static char *sccsid =
2 "@(#) disfp.c, Ver. 2.1 created 00:00:00 87/09/01";
3
4 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5 * *
6 * Copyright (C) 1987 G. M. Harding, all rights reserved *
7 * *
8 * Permission to copy and redistribute is hereby granted, *
9 * provided full source code, with all copyright notices, *
10 * accompanies any redistribution. *
11 * *
12 * This file contains handler routines for the numeric op- *
13 * codes of the 8087 co-processor, as well as a few other *
14 * opcodes which are related to 8087 emulation. *
15 * *
16 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17
18 #include "dis.h" /* Disassembler declarations */
19
20 #define FPINT0 0xd8 /* Floating-point interrupts */
21 #define FPINT1 0xd9
22 #define FPINT2 0xda
23 #define FPINT3 0xdb
24 #define FPINT4 0xdc
25 #define FPINT5 0xdd
26 #define FPINT6 0xde
27 #define FPINT7 0xdf
28
29 /* Test for floating opcodes */
30 #define ISFLOP(x) \
31 (((x) >= FPINT0) && ((x) <= FPINT7))
32
33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
34 * *
35 * This is the handler for the escape family of opcodes. *
36 * These opcodes place the contents of a specified memory *
37 * location on the system bus, for access by a peripheral *
38 * or by a co-processor such as the 8087. (The 8087 NDP is *
39 * accessed only via bus escapes.) Due to a bug in the *
40 * PC/IX assembler, the "esc" mnemonic is not recognized; *
41 * consequently, escape opcodes are disassembled as .byte *
42 * directives, with the appropriate mnemonic and operand *
43 * included as a comment. FOR NOW, those escape sequences *
44 * corresponding to 8087 opcodes are treated as simple *
45 * escapes. *
46 * *
47 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
48
49 void
eshand(j)50 eshand(j)
51
52 register int j; /* Pointer to optab[] entry */
53
54 {/* * * * * * * * * * START OF eshand() * * * * * * * * * */
55
56 register char *a;
57 register int k;
58
59 objini(j);
60
61 FETCH(k);
62
63 a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
64
65 mtrunc(a);
66
67 printf("\t.byte\t0x%02.2x\t\t| esc\t%s\n",j,a);
68
69 for (k = 1; k < objptr; ++k)
70 printf("\t.byte\t0x%02.2x\n",objbuf[k]);
71
72 }/* * * * * * * * * * * END OF eshand() * * * * * * * * * * */
73
74 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
75 * *
76 * This is the handler routine for floating-point opcodes. *
77 * Since PC/IX must accommodate systems with and without *
78 * 8087 co-processors, it allows floating-point operations *
79 * to be initiated in either of two ways: by a software *
80 * interrput whose type is in the range 0xd8 through 0xdf, *
81 * or by a CPU escape sequence, which is invoked by an op- *
82 * code in the same range. In either case, the subsequent *
83 * byte determines the actual numeric operation to be per- *
84 * formed. However, depending on the method of access, *
85 * either one or two code bytes will precede that byte, *
86 * and the fphand() routine has no way of knowing whether *
87 * it was invoked by interrupt or by an escape sequence. *
88 * Therefore, unlike all of the other handler routines ex- *
89 * cept dfhand(), fphand() does not initialize the object *
90 * buffer, leaving that chore to the caller. *
91 * *
92 * FOR NOW, fphand() does not disassemble floating-point *
93 * opcodes to floating mnemonics, but simply outputs the *
94 * object code as .byte directives. *
95 * *
96 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
97
98 void
fphand(j)99 fphand(j)
100
101 register int j; /* Pointer to optab[] entry */
102
103 {/* * * * * * * * * * START OF fphand() * * * * * * * * * */
104
105 register int k;
106
107 segflg = 0;
108
109 FETCH(k);
110
111 printf("\t.byte\t0x%02.2x\t\t| 8087 code sequence\n",
112 objbuf[0]);
113
114 for (k = 1; k < objptr; ++k)
115 printf("\t.byte\t0x%02.2x\n",objbuf[k]);
116
117 /* objout(); FOR NOW */
118
119 }/* * * * * * * * * * * END OF fphand() * * * * * * * * * * */
120
121 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
122 * *
123 * This is the handler for variable software interrupt *
124 * opcodes. It is included in this file because PC/IX im- *
125 * plements its software floating-point emulation by means *
126 * of interrupts. Any interrupt in the range 0xd8 through *
127 * 0xdf is an NDP-emulation interrupt, and is specially *
128 * handled by the assembler. *
129 * *
130 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
131
132 void
inhand(j)133 inhand(j)
134
135 register int j; /* Pointer to optab[] entry */
136
137 {/* * * * * * * * * * START OF inhand() * * * * * * * * * */
138
139 register int k;
140
141 objini(j);
142
143 FETCH(k);
144
145 if (ISFLOP(k))
146 {
147 fphand(k);
148 return;
149 }
150
151 printf("%s\t$%02x\n",optab[j].text,k);
152
153 objout();
154
155 }/* * * * * * * * * * * END OF inhand() * * * * * * * * * * */
156
157
158