71 |
|
#include "memory.h" |
72 |
|
#include "readcpu.h" |
73 |
|
#include "newcpu.h" |
74 |
+ |
#include "main.h" |
75 |
|
|
76 |
|
#define DEBUG 0 |
77 |
|
#include "debug.h" |
872 |
|
int mode; |
873 |
|
int reg; |
874 |
|
uae_u32 ad; |
875 |
< |
static int sz1[8] = |
876 |
< |
{4, 4, 12, 12, 2, 8, 1, 0}; |
876 |
< |
static int sz2[8] = |
877 |
< |
{4, 4, 12, 12, 2, 8, 2, 0}; |
875 |
> |
static int sz1[8] = {4, 4, 12, 12, 2, 8, 1, 0}; |
876 |
> |
static int sz2[8] = {4, 4, 12, 12, 2, 8, 2, 0}; |
877 |
|
|
878 |
|
// D(bug("put_fp_value(%.04f,%X,%X)\r\n",(float)value,(int)opcode,(int)extra)); |
879 |
|
|
1233 |
|
return; |
1234 |
|
} |
1235 |
|
|
1236 |
< |
// Put 28 byte IDLE frame. |
1237 |
< |
// NOTE!!! IDLE frame is only 4 bytes on a 68040!! |
1238 |
< |
|
1239 |
< |
if (incr < 0) { |
1240 |
< |
D(bug("fsave_opp pre-decrement\r\n")); |
1241 |
< |
ad -= 4; |
1242 |
< |
// What's this? Some BIU flags, or (incorrectly placed) command/condition? |
1243 |
< |
put_long (ad, 0x70000000); |
1245 |
< |
for (i = 0; i < 5; i++) { |
1246 |
< |
ad -= 4; |
1247 |
< |
put_long (ad, 0x00000000); |
1248 |
< |
} |
1249 |
< |
ad -= 4; |
1250 |
< |
put_long (ad, 0x1f180000); // IDLE, vers 1f |
1251 |
< |
} else { |
1252 |
< |
put_long (ad, 0x1f180000); // IDLE, vers 1f |
1253 |
< |
ad += 4; |
1254 |
< |
for (i = 0; i < 5; i++) { |
1255 |
< |
put_long (ad, 0x00000000); |
1256 |
< |
ad += 4; |
1236 |
> |
if (CPUType == 4) { |
1237 |
> |
// Put 4 byte 68040 IDLE frame. |
1238 |
> |
if (incr < 0) { |
1239 |
> |
ad -= 4; |
1240 |
> |
put_long (ad, 0x41000000); |
1241 |
> |
} else { |
1242 |
> |
put_long (ad, 0x41000000); |
1243 |
> |
ad += 4; |
1244 |
|
} |
1245 |
< |
// What's this? Some BIU flags, or (incorrectly placed) command/condition? |
1246 |
< |
put_long (ad, 0x70000000); |
1247 |
< |
ad += 4; |
1248 |
< |
} |
1245 |
> |
} else { |
1246 |
> |
// Put 28 byte 68881 IDLE frame. |
1247 |
> |
if (incr < 0) { |
1248 |
> |
D(bug("fsave_opp pre-decrement\r\n")); |
1249 |
> |
ad -= 4; |
1250 |
> |
// What's this? Some BIU flags, or (incorrectly placed) command/condition? |
1251 |
> |
put_long (ad, 0x70000000); |
1252 |
> |
for (i = 0; i < 5; i++) { |
1253 |
> |
ad -= 4; |
1254 |
> |
put_long (ad, 0x00000000); |
1255 |
> |
} |
1256 |
> |
ad -= 4; |
1257 |
> |
put_long (ad, 0x1f180000); // IDLE, vers 1f |
1258 |
> |
} else { |
1259 |
> |
put_long (ad, 0x1f180000); // IDLE, vers 1f |
1260 |
> |
ad += 4; |
1261 |
> |
for (i = 0; i < 5; i++) { |
1262 |
> |
put_long (ad, 0x00000000); |
1263 |
> |
ad += 4; |
1264 |
> |
} |
1265 |
> |
// What's this? Some BIU flags, or (incorrectly placed) command/condition? |
1266 |
> |
put_long (ad, 0x70000000); |
1267 |
> |
ad += 4; |
1268 |
> |
} |
1269 |
> |
} |
1270 |
|
if ((opcode & 0x38) == 0x18) { |
1271 |
|
m68k_areg (regs, opcode & 7) = ad; // Never executed on a 68881 |
1272 |
|
D(bug("PROBLEM: fsave_opp post-increment\r\n")); |
1277 |
|
} |
1278 |
|
} |
1279 |
|
|
1280 |
< |
// FSAVE has no pre-decrement |
1280 |
> |
// FRESTORE has no pre-decrement |
1281 |
|
void frestore_opp(uae_u32 opcode) |
1282 |
|
{ |
1283 |
|
uae_u32 ad; |
1292 |
|
return; |
1293 |
|
} |
1294 |
|
|
1295 |
< |
if (incr < 0) { |
1296 |
< |
|
1297 |
< |
D(bug("PROBLEM: frestore_opp incr < 0\r\n")); |
1298 |
< |
|
1299 |
< |
// this may be wrong, but it's never called. |
1300 |
< |
ad -= 4; |
1301 |
< |
d = get_long (ad); |
1302 |
< |
if ((d & 0xff000000) != 0) { |
1303 |
< |
if ((d & 0x00ff0000) == 0x00180000) |
1304 |
< |
ad -= 6 * 4; |
1305 |
< |
else if ((d & 0x00ff0000) == 0x00380000) |
1306 |
< |
ad -= 14 * 4; |
1307 |
< |
else if ((d & 0x00ff0000) == 0x00b40000) |
1308 |
< |
ad -= 45 * 4; |
1295 |
> |
if (CPUType == 4) { |
1296 |
> |
// 68040 |
1297 |
> |
if (incr < 0) { |
1298 |
> |
D(bug("PROBLEM: frestore_opp incr < 0\r\n")); |
1299 |
> |
// this may be wrong, but it's never called. |
1300 |
> |
ad -= 4; |
1301 |
> |
d = get_long (ad); |
1302 |
> |
if ((d & 0xff000000) != 0) { // Not a NULL frame? |
1303 |
> |
if ((d & 0x00ff0000) == 0) { // IDLE |
1304 |
> |
D(bug("frestore_opp found IDLE frame at %X\r\n",ad-4)); |
1305 |
> |
} else if ((d & 0x00ff0000) == 0x00300000) { // UNIMP |
1306 |
> |
D(bug("PROBLEM: frestore_opp found UNIMP frame at %X\r\n",ad-4)); |
1307 |
> |
ad -= 44; |
1308 |
> |
} else if ((d & 0x00ff0000) == 0x00600000) { // BUSY |
1309 |
> |
D(bug("PROBLEM: frestore_opp found BUSY frame at %X\r\n",ad-4)); |
1310 |
> |
ad -= 92; |
1311 |
> |
} |
1312 |
> |
} |
1313 |
> |
} else { |
1314 |
> |
d = get_long (ad); |
1315 |
> |
D(bug("frestore_opp frame at %X = %X\r\n",ad,d)); |
1316 |
> |
ad += 4; |
1317 |
> |
if ((d & 0xff000000) != 0) { // Not a NULL frame? |
1318 |
> |
if ((d & 0x00ff0000) == 0) { // IDLE |
1319 |
> |
D(bug("frestore_opp found IDLE frame at %X\r\n",ad-4)); |
1320 |
> |
} else if ((d & 0x00ff0000) == 0x00300000) { // UNIMP |
1321 |
> |
D(bug("PROBLEM: frestore_opp found UNIMP frame at %X\r\n",ad-4)); |
1322 |
> |
ad += 44; |
1323 |
> |
} else if ((d & 0x00ff0000) == 0x00600000) { // BUSY |
1324 |
> |
D(bug("PROBLEM: frestore_opp found BUSY frame at %X\r\n",ad-4)); |
1325 |
> |
ad += 92; |
1326 |
> |
} |
1327 |
> |
} |
1328 |
|
} |
1329 |
< |
} else { |
1330 |
< |
d = get_long (ad); |
1331 |
< |
|
1332 |
< |
D(bug("frestore_opp frame at %X = %X\r\n",ad,d)); |
1333 |
< |
|
1334 |
< |
ad += 4; |
1335 |
< |
if ((d & 0xff000000) != 0) { // Not a NULL frame? |
1336 |
< |
if ((d & 0x00ff0000) == 0x00180000) { // IDLE |
1337 |
< |
D(bug("frestore_opp found IDLE frame at %X\r\n",ad-4)); |
1338 |
< |
ad += 6 * 4; |
1339 |
< |
} else if ((d & 0x00ff0000) == 0x00380000) {// UNIMP? shouldn't it be 3C? |
1340 |
< |
ad += 14 * 4; |
1341 |
< |
D(bug("PROBLEM: frestore_opp found UNIMP? frame at %X\r\n",ad-4)); |
1342 |
< |
} else if ((d & 0x00ff0000) == 0x00b40000) {// BUSY |
1343 |
< |
D(bug("PROBLEM: frestore_opp found BUSY frame at %X\r\n",ad-4)); |
1344 |
< |
ad += 45 * 4; |
1329 |
> |
} else { |
1330 |
> |
// 68881 |
1331 |
> |
if (incr < 0) { |
1332 |
> |
D(bug("PROBLEM: frestore_opp incr < 0\r\n")); |
1333 |
> |
// this may be wrong, but it's never called. |
1334 |
> |
ad -= 4; |
1335 |
> |
d = get_long (ad); |
1336 |
> |
if ((d & 0xff000000) != 0) { |
1337 |
> |
if ((d & 0x00ff0000) == 0x00180000) |
1338 |
> |
ad -= 6 * 4; |
1339 |
> |
else if ((d & 0x00ff0000) == 0x00380000) |
1340 |
> |
ad -= 14 * 4; |
1341 |
> |
else if ((d & 0x00ff0000) == 0x00b40000) |
1342 |
> |
ad -= 45 * 4; |
1343 |
> |
} |
1344 |
> |
} else { |
1345 |
> |
d = get_long (ad); |
1346 |
> |
D(bug("frestore_opp frame at %X = %X\r\n",ad,d)); |
1347 |
> |
ad += 4; |
1348 |
> |
if ((d & 0xff000000) != 0) { // Not a NULL frame? |
1349 |
> |
if ((d & 0x00ff0000) == 0x00180000) { // IDLE |
1350 |
> |
D(bug("frestore_opp found IDLE frame at %X\r\n",ad-4)); |
1351 |
> |
ad += 6 * 4; |
1352 |
> |
} else if ((d & 0x00ff0000) == 0x00380000) {// UNIMP? shouldn't it be 3C? |
1353 |
> |
ad += 14 * 4; |
1354 |
> |
D(bug("PROBLEM: frestore_opp found UNIMP? frame at %X\r\n",ad-4)); |
1355 |
> |
} else if ((d & 0x00ff0000) == 0x00b40000) {// BUSY |
1356 |
> |
D(bug("PROBLEM: frestore_opp found BUSY frame at %X\r\n",ad-4)); |
1357 |
> |
ad += 45 * 4; |
1358 |
> |
} |
1359 |
|
} |
1360 |
|
} |
1361 |
|
} |
2071 |
|
break; |
2072 |
|
case 0x23: /* FMUL */ |
2073 |
|
D(bug("FMUL %.04f\r\n",(float)src)); |
2074 |
+ |
#if HAVE_IEEE_DOUBLE |
2075 |
|
GET_DEST_FLAGS((uae_u32 *)®s.fp[reg]); |
2076 |
|
GET_SOURCE_FLAGS((uae_u32 *)&src); |
2077 |
|
if(fl_dest.in_range && fl_source.in_range) { |
2098 |
|
MAKE_INF_POSITIVE((uae_u32 *)®s.fp[reg]); |
2099 |
|
} |
2100 |
|
} |
2101 |
+ |
#else |
2102 |
+ |
D(bug("FMUL %.04f\r\n",(float)src)); |
2103 |
+ |
regs.fp[reg] *= src; |
2104 |
+ |
#endif |
2105 |
|
MAKE_FPSR(regs.fpsr,regs.fp[reg]); |
2106 |
|
break; |
2107 |
|
case 0x24: /* FSGLDIV */ |