00001 static char *sccsid = 00002 "@(#) disfp.c, Ver. 2.1 created 00:00:00 87/09/01"; 00003 00004 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00005 * * 00006 * Copyright (C) 1987 G. M. Harding, all rights reserved * 00007 * * 00008 * Permission to copy and redistribute is hereby granted, * 00009 * provided full source code, with all copyright notices, * 00010 * accompanies any redistribution. * 00011 * * 00012 * This file contains handler routines for the numeric op- * 00013 * codes of the 8087 co-processor, as well as a few other * 00014 * opcodes which are related to 8087 emulation. * 00015 * * 00016 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00017 00018 #include "dis.h" /* Disassembler declarations */ 00019 00020 #define FPINT0 0xd8 /* Floating-point interrupts */ 00021 #define FPINT1 0xd9 00022 #define FPINT2 0xda 00023 #define FPINT3 0xdb 00024 #define FPINT4 0xdc 00025 #define FPINT5 0xdd 00026 #define FPINT6 0xde 00027 #define FPINT7 0xdf 00028 00029 /* Test for floating opcodes */ 00030 #define ISFLOP(x) \ 00031 (((x) >= FPINT0) && ((x) <= FPINT7)) 00032 00033 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00034 * * 00035 * This is the handler for the escape family of opcodes. * 00036 * These opcodes place the contents of a specified memory * 00037 * location on the system bus, for access by a peripheral * 00038 * or by a co-processor such as the 8087. (The 8087 NDP is * 00039 * accessed only via bus escapes.) Due to a bug in the * 00040 * PC/IX assembler, the "esc" mnemonic is not recognized; * 00041 * consequently, escape opcodes are disassembled as .byte * 00042 * directives, with the appropriate mnemonic and operand * 00043 * included as a comment. FOR NOW, those escape sequences * 00044 * corresponding to 8087 opcodes are treated as simple * 00045 * escapes. * 00046 * * 00047 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00048 00049 void 00050 eshand(j) 00051 00052 register int j; /* Pointer to optab[] entry */ 00053 00054 {/* * * * * * * * * * START OF eshand() * * * * * * * * * */ 00055 00056 register char *a; 00057 register int k; 00058 00059 objini(j); 00060 00061 FETCH(k); 00062 00063 a = mtrans((j & 0xfd),(k & 0xc7),TR_STD); 00064 00065 mtrunc(a); 00066 00067 printf("\t.byte\t0x%02.2x\t\t| esc\t%s\n",j,a); 00068 00069 for (k = 1; k < objptr; ++k) 00070 printf("\t.byte\t0x%02.2x\n",objbuf[k]); 00071 00072 }/* * * * * * * * * * * END OF eshand() * * * * * * * * * * */ 00073 00074 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00075 * * 00076 * This is the handler routine for floating-point opcodes. * 00077 * Since PC/IX must accommodate systems with and without * 00078 * 8087 co-processors, it allows floating-point operations * 00079 * to be initiated in either of two ways: by a software * 00080 * interrput whose type is in the range 0xd8 through 0xdf, * 00081 * or by a CPU escape sequence, which is invoked by an op- * 00082 * code in the same range. In either case, the subsequent * 00083 * byte determines the actual numeric operation to be per- * 00084 * formed. However, depending on the method of access, * 00085 * either one or two code bytes will precede that byte, * 00086 * and the fphand() routine has no way of knowing whether * 00087 * it was invoked by interrupt or by an escape sequence. * 00088 * Therefore, unlike all of the other handler routines ex- * 00089 * cept dfhand(), fphand() does not initialize the object * 00090 * buffer, leaving that chore to the caller. * 00091 * * 00092 * FOR NOW, fphand() does not disassemble floating-point * 00093 * opcodes to floating mnemonics, but simply outputs the * 00094 * object code as .byte directives. * 00095 * * 00096 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00097 00098 void 00099 fphand(j) 00100 00101 register int j; /* Pointer to optab[] entry */ 00102 00103 {/* * * * * * * * * * START OF fphand() * * * * * * * * * */ 00104 00105 register int k; 00106 00107 segflg = 0; 00108 00109 FETCH(k); 00110 00111 printf("\t.byte\t0x%02.2x\t\t| 8087 code sequence\n", 00112 objbuf[0]); 00113 00114 for (k = 1; k < objptr; ++k) 00115 printf("\t.byte\t0x%02.2x\n",objbuf[k]); 00116 00117 /* objout(); FOR NOW */ 00118 00119 }/* * * * * * * * * * * END OF fphand() * * * * * * * * * * */ 00120 00121 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00122 * * 00123 * This is the handler for variable software interrupt * 00124 * opcodes. It is included in this file because PC/IX im- * 00125 * plements its software floating-point emulation by means * 00126 * of interrupts. Any interrupt in the range 0xd8 through * 00127 * 0xdf is an NDP-emulation interrupt, and is specially * 00128 * handled by the assembler. * 00129 * * 00130 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00131 00132 void 00133 inhand(j) 00134 00135 register int j; /* Pointer to optab[] entry */ 00136 00137 {/* * * * * * * * * * START OF inhand() * * * * * * * * * */ 00138 00139 register int k; 00140 00141 objini(j); 00142 00143 FETCH(k); 00144 00145 if (ISFLOP(k)) 00146 { 00147 fphand(k); 00148 return; 00149 } 00150 00151 printf("%s\t%d\n",optab[j].text,k); 00152 00153 objout(); 00154 00155 }/* * * * * * * * * * * END OF inhand() * * * * * * * * * * */ 00156 00157
1.4.6