mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-22 13:30:07 +00:00
- removed MemoryDispatch() replacement; routine from ROM is now used if
possible - rom_patches.cpp: check for double PACK 4 resources; if only one is found, assume that the ROM requires an FPU and issue a warning if FPU emulation is turned off - UAE CPU opcode routines no longer return the cycle count - main_unix.cpp: pressing Ctrl-C dumps the UAE CPU state before entering mon - sys_unix.cpp: under Linux, partition sizes are read with BLKGETSIZE instead of llseek()
This commit is contained in:
parent
3f9e2a9eba
commit
d60bc94de7
@ -4,10 +4,16 @@ V0.8 -
|
||||
- removed Windows sources from the source archive; a version of
|
||||
these that actually compiles and works can be downloaded from
|
||||
Lauri Pesonen's site
|
||||
- fixed one possible source of "unimplemented trap" errors on MacOS
|
||||
bootup
|
||||
- removed the MemoryDispatch() replacement routine; the routine
|
||||
in the ROM is now always used; this fixes the MacOS 8 Finder
|
||||
copying bug and also most "unimplemented trap" errors on MacOS
|
||||
bootup; yeah :-)
|
||||
- a warning is issued if the ROM seems to require an FPU but FPU
|
||||
emulation is turned off
|
||||
- medium removal is allowed in CDROMExit()
|
||||
- added (incomplete) emulation of 68040 instructions
|
||||
- added (incomplete) emulation of 68040 instructions (CINV, CPUSH,
|
||||
MOVE16 (Ax)+,(Ay)+, and FPU stack frames), enough to boot MacOS
|
||||
- UAE CPU: opcode routines no longer return the cycle count
|
||||
- extfs.cpp: fixed bug with fsResolveWDCB in fs_get_wd_info()
|
||||
- Unix: added support for ESD audio output; merged with OSS audio
|
||||
and put in a new "audio_oss_esd.cpp" file which is also used under
|
||||
@ -26,6 +32,7 @@ V0.8 -
|
||||
- Unix/audio_oss_esd.cpp: "silence" in 8-bit mode used wrong fill
|
||||
value (0 instead of 0x80) [Alexander R. Pruss]
|
||||
- Unix/video_x.cpp: added mouse wheel support [Alexander R. Pruss]
|
||||
- Unix/sys_unix.cpp: device size is read correctly under Linux
|
||||
|
||||
V0.8 (snapshot) - 21.Oct.1999
|
||||
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for
|
||||
|
@ -1,9 +1,8 @@
|
||||
Bugs:
|
||||
- System 7.1 with Quadra900 ModelID (1MB ROM): 0x108 gets strange value
|
||||
- Strange things happen when the Mac ROM is lower in memory than the RAM
|
||||
- Something seems to be wrong with the UAE FPU (Calculator and scroll bars in
|
||||
MacOS 8 don't work properly)
|
||||
- MacOS 8: Finder threads don't work
|
||||
- Something still seems to be wrong with the UAE FPU (Calculator and scroll
|
||||
bars in MacOS 8 don't work properly)
|
||||
|
||||
General:
|
||||
- Sony: rdVerify, Tag Buffer, DskErr
|
||||
|
@ -353,8 +353,11 @@ void FlushCodeCache(void *start, uint32 size)
|
||||
*/
|
||||
|
||||
#if ENABLE_MON
|
||||
extern void m68k_dumpstate(uaecptr *nextpc);
|
||||
static void sigint_handler(...)
|
||||
{
|
||||
uaecptr nextpc;
|
||||
m68k_dumpstate(&nextpc);
|
||||
char *arg[2] = {"rmon", NULL};
|
||||
mon(1, arg);
|
||||
QuitEmulator();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#ifdef __linux__
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/fd.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/unistd.h>
|
||||
@ -428,9 +429,11 @@ loff_t SysGetFileSize(void *arg)
|
||||
return fh->file_size;
|
||||
else {
|
||||
#if defined(__linux__)
|
||||
loff_t pos = 0;
|
||||
_llseek(fh->fd, 0, 0, &pos, SEEK_END);
|
||||
return pos - fh->start_byte;
|
||||
long blocks;
|
||||
if (ioctl(fh->fd, BLKGETSIZE, &blocks) < 0)
|
||||
return 0;
|
||||
D(bug(" BLKGETSIZE returns %d blocks\n", blocks));
|
||||
return (loff_t)blocks * 512;
|
||||
#else
|
||||
return lseek(fh->fd, 0, SEEK_END) - fh->start_byte;
|
||||
#endif
|
||||
|
@ -268,7 +268,7 @@ int16 DiskOpen(uint32 pb, uint32 dce)
|
||||
info->num_blocks = SysGetFileSize(info->fh) / 512;
|
||||
info->to_be_mounted = true;
|
||||
}
|
||||
D(bug(" %ld blocks\n", info->num_blocks));
|
||||
D(bug(" %d blocks\n", info->num_blocks));
|
||||
WriteMacInt16(info->status + dsDriveSize, info->num_blocks & 0xffff);
|
||||
WriteMacInt16(info->status + dsDriveS1, info->num_blocks >> 16);
|
||||
|
||||
|
@ -410,33 +410,6 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
||||
break;
|
||||
}
|
||||
|
||||
case M68K_EMUL_OP_MEMORY_DISPATCH: { // MemoryDispatch() replacement routine
|
||||
int16 sel = r->d[0];
|
||||
D(bug("MemoryDispatch(%d)\n", sel));
|
||||
switch (sel) {
|
||||
case -6: // GetLogicalRAMSize
|
||||
r->d[0] = RAMSize;
|
||||
break;
|
||||
case -3:
|
||||
r->d[0] = 0x1000;
|
||||
break;
|
||||
case 0: // HoldMemory
|
||||
case 1: // UnholdMemory
|
||||
case 2: // LockMemory
|
||||
case 3: // UnlockMemory
|
||||
case 4: // LockMemoryContiguous
|
||||
case 6: // ProtectMemory
|
||||
case 7: // UnprotectMemory
|
||||
r->d[0] = 0;
|
||||
break;
|
||||
default:
|
||||
printf("WARNING: MemoryDispatch(%d): unimplemented selector\n", sel);
|
||||
r->d[0] = (uint32)-502;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case M68K_EMUL_OP_IRQ: // Level 1 interrupt
|
||||
r->d[0] = 0;
|
||||
if (InterruptFlags & INTFLAG_60HZ) {
|
||||
|
@ -74,14 +74,13 @@ enum {
|
||||
M68K_EMUL_OP_PRIMETIME,
|
||||
M68K_EMUL_OP_MICROSECONDS,
|
||||
M68K_EMUL_OP_SCSI_DISPATCH, // 0x7128
|
||||
M68K_EMUL_OP_MEMORY_DISPATCH,
|
||||
M68K_EMUL_OP_IRQ,
|
||||
M68K_EMUL_OP_PUT_SCRAP,
|
||||
M68K_EMUL_OP_CHECKLOAD,
|
||||
M68K_EMUL_OP_AUDIO,
|
||||
M68K_EMUL_OP_EXTFS_COMM,
|
||||
M68K_EMUL_OP_EXTFS_HFS,
|
||||
M68K_EMUL_OP_BLOCK_MOVE, // 0x7130
|
||||
M68K_EMUL_OP_BLOCK_MOVE,
|
||||
M68K_EMUL_OP_MAX // highest number
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,6 @@ bool PrintROMInfo = false; // Flag: print ROM information in PatchROM()
|
||||
static uint32 sony_offset; // ROM offset of .Sony driver
|
||||
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers)
|
||||
static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine
|
||||
static uint32 memory_dispatch_offset; // ROM offset of MemoryDispatch() replacement routine
|
||||
|
||||
// Prototypes
|
||||
uint16 ROMVersion;
|
||||
@ -82,6 +81,8 @@ static uint32 find_rom_resource(uint32 s_type, int16 s_id, bool cont = false)
|
||||
|
||||
if (!cont)
|
||||
rsrc_ptr = x;
|
||||
else
|
||||
rsrc_ptr = ReadMacInt32(ROMBaseMac + rsrc_ptr + 8);
|
||||
|
||||
for (;;) {
|
||||
lp = ROMBaseMac + rsrc_ptr;
|
||||
@ -700,11 +701,6 @@ void InstallDrivers(uint32 pb)
|
||||
r.d[0] = 0xa093;
|
||||
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
|
||||
|
||||
// Install MemoryDispatch() replacement routine
|
||||
r.a[0] = ROMBaseMac + memory_dispatch_offset;
|
||||
r.d[0] = 0xa05c;
|
||||
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
|
||||
|
||||
// Install disk driver
|
||||
r.a[0] = ROMBaseMac + sony_offset + 0x100;
|
||||
r.d[0] = (uint32)DiskRefNum;
|
||||
@ -1459,7 +1455,7 @@ static bool patch_rom_32(void)
|
||||
static const uint8 memdisp_dat[] = {0x30, 0x3c, 0xa8, 0x9f, 0xa7, 0x46, 0x30, 0x3c, 0xa0, 0x5c, 0xa2, 0x47};
|
||||
base = find_rom_data(0x4f100, 0x4f180, memdisp_dat, sizeof(memdisp_dat));
|
||||
D(bug("memdisp %08lx\n", base));
|
||||
if (base) { // ROM15/32
|
||||
if (base) { // ROM15/22/23/26/27/32
|
||||
wp = (uint16 *)(ROMBaseHost + base + 10);
|
||||
*wp = htons(M68K_NOP);
|
||||
}
|
||||
@ -1565,12 +1561,6 @@ static bool patch_rom_32(void)
|
||||
*wp++ = htons(base >> 16);
|
||||
*wp = htons(base & 0xffff);
|
||||
|
||||
// Install MemoryDispatch() replacement routine (activated in PatchAfterStartup())
|
||||
memory_dispatch_offset = sony_offset + 0xc20;
|
||||
wp = (uint16 *)(ROMBaseHost + memory_dispatch_offset);
|
||||
*wp++ = htons(M68K_EMUL_OP_MEMORY_DISPATCH);
|
||||
*wp = htons(M68K_RTS);
|
||||
|
||||
#if EMULATED_68K
|
||||
// Replace BlockMove()
|
||||
wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa02e)); // BlockMove()
|
||||
@ -1579,6 +1569,11 @@ static bool patch_rom_32(void)
|
||||
*wp = htons(M68K_RTS);
|
||||
#endif
|
||||
|
||||
// Look for double PACK 4 resources
|
||||
if ((base = find_rom_resource('PACK', 4)) == 0) return false;
|
||||
if ((base = find_rom_resource('PACK', 4, true)) == 0 && FPUType == 0)
|
||||
printf("WARNING: This ROM seems to require an FPU\n");
|
||||
|
||||
// Patch VIA interrupt handler
|
||||
wp = (uint16 *)(ROMBaseHost + 0x9bc4); // Level 1 handler
|
||||
*wp++ = htons(0x7002); // moveq #2,d0 (always 60Hz interrupt)
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include "audio_defs.h"
|
||||
#include "rsrc_patches.h"
|
||||
|
||||
#if ENABLE_MON
|
||||
#include "mon.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
|
@ -2073,6 +2073,7 @@ void fpp_opp(uae_u32 opcode, uae_u16 extra)
|
||||
break;
|
||||
case 0x23: /* FMUL */
|
||||
D(bug("FMUL %.04f\r\n",(float)src));
|
||||
#if HAVE_IEEE_DOUBLE
|
||||
GET_DEST_FLAGS((uae_u32 *)®s.fp[reg]);
|
||||
GET_SOURCE_FLAGS((uae_u32 *)&src);
|
||||
if(fl_dest.in_range && fl_source.in_range) {
|
||||
@ -2099,6 +2100,10 @@ void fpp_opp(uae_u32 opcode, uae_u16 extra)
|
||||
MAKE_INF_POSITIVE((uae_u32 *)®s.fp[reg]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
D(bug("FMUL %.04f\r\n",(float)src));
|
||||
regs.fp[reg] *= src;
|
||||
#endif
|
||||
MAKE_FPSR(regs.fpsr,regs.fp[reg]);
|
||||
break;
|
||||
case 0x24: /* FSGLDIV */
|
||||
|
@ -2514,7 +2514,7 @@ static void generate_one_opcode (int rp)
|
||||
}
|
||||
fprintf (stblfile, "{ op_%lx_%d, 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
|
||||
fprintf (headerfile, "extern cpuop_func op_%lx_%d;\n", opcode, postfix);
|
||||
printf ("unsigned long REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
|
||||
printf ("void REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
|
||||
|
||||
switch (table68k[opcode].stype) {
|
||||
case 0: smsk = 7; break;
|
||||
@ -2628,7 +2628,6 @@ static void generate_one_opcode (int rp)
|
||||
gen_opcode (opcode);
|
||||
if (need_endlabel)
|
||||
printf ("%s: ;\n", endlabelstr);
|
||||
printf ("return %d;\n", insn_n_cycles);
|
||||
printf ("}\n");
|
||||
opcode_next_clev[rp] = next_cpu_level;
|
||||
opcode_last_postfix[rp] = postfix;
|
||||
|
@ -111,12 +111,11 @@ static __inline__ unsigned int cft_map (unsigned int f)
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned long REGPARAM2 op_illg_1 (uae_u32 opcode) REGPARAM;
|
||||
static void REGPARAM2 op_illg_1 (uae_u32 opcode) REGPARAM;
|
||||
|
||||
static unsigned long REGPARAM2 op_illg_1 (uae_u32 opcode)
|
||||
static void REGPARAM2 op_illg_1 (uae_u32 opcode)
|
||||
{
|
||||
op_illg (cft_map (opcode));
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void build_cpufunctbl (void)
|
||||
@ -1051,7 +1050,7 @@ void m68k_reset (void)
|
||||
regs.fpcr = regs.fpsr = regs.fpiar = 0;
|
||||
}
|
||||
|
||||
unsigned long REGPARAM2 op_illg (uae_u32 opcode)
|
||||
void REGPARAM2 op_illg (uae_u32 opcode)
|
||||
{
|
||||
uaecptr pc = m68k_getpc ();
|
||||
|
||||
@ -1065,7 +1064,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
|
||||
if (opcode == M68K_EXEC_RETURN) {
|
||||
regs.spcflags |= SPCFLAG_BRK;
|
||||
quit_program = 1;
|
||||
return 4;
|
||||
return;
|
||||
}
|
||||
|
||||
// Call EMUL_OP opcode
|
||||
@ -1084,23 +1083,24 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode)
|
||||
MakeFromSR();
|
||||
m68k_incpc(2);
|
||||
fill_prefetch_0 ();
|
||||
return 4;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((opcode & 0xF000) == 0xA000) {
|
||||
Exception(0xA,0);
|
||||
return 4;
|
||||
return;
|
||||
}
|
||||
|
||||
// write_log ("Illegal instruction: %04x at %08lx\n", opcode, pc);
|
||||
|
||||
if ((opcode & 0xF000) == 0xF000) {
|
||||
Exception(0xB,0);
|
||||
return;
|
||||
}
|
||||
|
||||
write_log ("Illegal instruction: %04x at %08lx\n", opcode, pc);
|
||||
|
||||
if ((opcode & 0xF000) == 0xF000) {
|
||||
Exception(0xB,0);
|
||||
return 4;
|
||||
}
|
||||
|
||||
Exception (4,0);
|
||||
return 4;
|
||||
}
|
||||
|
||||
void mmu_op(uae_u32 opcode, uae_u16 extra)
|
||||
@ -1195,48 +1195,17 @@ static int do_specialties (void)
|
||||
|
||||
static void m68k_run_1 (void)
|
||||
{
|
||||
for (;;) {
|
||||
int cycles;
|
||||
uae_u32 opcode = GET_OPCODE;
|
||||
#if 0
|
||||
if (get_ilong (0) != do_get_mem_long (®s.prefetch)) {
|
||||
debugging = 1;
|
||||
return;
|
||||
for (;;) {
|
||||
uae_u32 opcode = GET_OPCODE;
|
||||
(*cpufunctbl[opcode])(opcode);
|
||||
if (regs.spcflags) {
|
||||
if (do_specialties())
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* assert (!regs.stopped && !(regs.spcflags & SPCFLAG_STOP)); */
|
||||
/* regs_backup[backup_pointer = (backup_pointer + 1) % 16] = regs;*/
|
||||
#if COUNT_INSTRS == 2
|
||||
if (table68k[cft_map (opcode)].handler != -1)
|
||||
instrcount[table68k[cft_map (opcode)].handler]++;
|
||||
#elif COUNT_INSTRS == 1
|
||||
instrcount[opcode]++;
|
||||
#endif
|
||||
#if defined(X86_ASSEMBLYxxx)
|
||||
__asm__ __volatile__("\tcall *%%ebx"
|
||||
: "=&a" (cycles) : "b" (cpufunctbl[opcode]), "0" (opcode)
|
||||
: "%edx", "%ecx",
|
||||
"%esi", "%edi", "%ebp", "memory", "cc");
|
||||
#else
|
||||
cycles = (*cpufunctbl[opcode])(opcode);
|
||||
#endif
|
||||
/*n_insns++;*/
|
||||
if (regs.spcflags) {
|
||||
if (do_specialties ())
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef X86_ASSEMBLYxxx
|
||||
static __inline__ void m68k_run1 (void)
|
||||
{
|
||||
/* Work around compiler bug: GCC doesn't push %ebp in m68k_run_1. */
|
||||
__asm__ __volatile__ ("pushl %%ebp\n\tcall *%0\n\tpopl %%ebp" : : "r" (m68k_run_1) : "%eax", "%edx", "%ecx", "memory", "cc");
|
||||
}
|
||||
#else
|
||||
#define m68k_run1 m68k_run_1
|
||||
#endif
|
||||
|
||||
int in_m68k_go = 0;
|
||||
|
||||
|
@ -55,7 +55,7 @@ extern int fpp_movem_next[256];
|
||||
|
||||
extern int broken_in;
|
||||
|
||||
typedef unsigned long REGPARAM2 cpuop_func (uae_u32) REGPARAM;
|
||||
typedef void REGPARAM2 cpuop_func (uae_u32) REGPARAM;
|
||||
|
||||
struct cputbl {
|
||||
cpuop_func *handler;
|
||||
@ -63,7 +63,7 @@ struct cputbl {
|
||||
uae_u16 opcode;
|
||||
};
|
||||
|
||||
extern unsigned long REGPARAM2 op_illg (uae_u32) REGPARAM;
|
||||
extern void REGPARAM2 op_illg (uae_u32) REGPARAM;
|
||||
|
||||
typedef char flagtype;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user