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