- mon is called for illegal EMUL_OP selectors and when pressing Ctrl-C (Unix)

- moved MemoryDispatch() patch routine from PatchAfterStartup() to
  InstallDrivers()
- fixed one place where ROM replaces MemoryDispatch() by unimplemented trap
  when no MMU is present
- Unix: ROM breakpoint can now be set with "-break" command line argument
- some changes to configure script, mon is now compiled with readline support
This commit is contained in:
cebix 1999-10-26 16:28:38 +00:00
parent 3e80e61c25
commit a84f3d1334
9 changed files with 376 additions and 213 deletions

View File

@ -3,12 +3,16 @@ V0.8 -
- removed Windows sources from the source archive; a version of - removed Windows sources from the source archive; a version of
these that actually compiles and works can be downloaded from these that actually compiles and works can be downloaded from
Lauri Pesonen's site Lauri Pesonen's site
- fixed one possible source of "unimplemented trap" errors on MacOS
bootup
- medium removal is allowed in CDROMExit() - medium removal is allowed in CDROMExit()
- Unix: added support for ESD audio output; merged with OSS audio - 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 and put in a new "audio_oss_esd.cpp" file which is also used under
FreeBSD 3.x FreeBSD 3.x
- Unix: added mkinstalldirs to "make install" target - Unix: added mkinstalldirs to "make install" target
- Unix: cleaned up the configure script - Unix: cleaned up the configure script
- Unix: ROM breakpoint can be specified with "-break" command line
argument
- Unix/audio_oss_esd.cpp: AudioStatus is re-set after determining - Unix/audio_oss_esd.cpp: AudioStatus is re-set after determining
audio device capabilities (actual sample rate is also determined) audio device capabilities (actual sample rate is also determined)
[Alexander R. Pruss] [Alexander R. Pruss]

View File

@ -5,6 +5,8 @@ Basilisk II \- a free, portable Mac II emulator
.B BasiliskII .B BasiliskII
[\-display [\-display
.IR display-name ] .IR display-name ]
[\-break
.IR offset ]
.SH DESCRIPTION .SH DESCRIPTION
.B Basilisk II .B Basilisk II
is an attempt at creating a free, portable 68k Mac emulator. is an attempt at creating a free, portable 68k Mac emulator.
@ -14,6 +16,9 @@ For more information, see the included "README" file.
.BI "\-display " display-name .BI "\-display " display-name
specifies the display to use; see specifies the display to use; see
.BR X (1) .BR X (1)
.TP
.BI "\-break " offset
specifies a ROM offset where a breakpoint will be placed
.SH FILES .SH FILES
.TP .TP
.I /usr/share/BasiliskII/keycodes .I /usr/share/BasiliskII/keycodes

View File

@ -67,6 +67,12 @@
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define if you have the <readline/history.h> header file. */
#undef HAVE_READLINE_HISTORY_H
/* Define if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
/* Define if you have the <sys/time.h> header file. */ /* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H #undef HAVE_SYS_TIME_H
@ -78,3 +84,6 @@
/* Define if you have the pthread library (-lpthread). */ /* Define if you have the pthread library (-lpthread). */
#undef HAVE_LIBPTHREAD #undef HAVE_LIBPTHREAD
/* Define if you have the readline library (-lreadline). */
#undef HAVE_LIBREADLINE

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,9 @@ AC_CONFIG_HEADER(config.h)
dnl Options. dnl Options.
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
AC_ARG_ENABLE(esd, [ --enable-esd Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [WANT_ESD=yes]) AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface [default=yes]], [WANT_UI=$enableval], [WANT_UI=yes]) AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
dnl Checks for programs. dnl Checks for programs.
AC_PROG_CC AC_PROG_CC
@ -27,6 +28,8 @@ if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then
DEFINES="$DEFINES -DENABLE_MON=1" DEFINES="$DEFINES -DENABLE_MON=1"
MONSRCS="../../../mon/src/mon.cpp ../../../mon/src/mon_6502.cpp ../../../mon/src/mon_68k.cpp ../../../mon/src/mon_8080.cpp ../../../mon/src/mon_cmd.cpp ../../../mon/src/mon_ppc.cpp ../../../mon/src/mon_x86.cpp" MONSRCS="../../../mon/src/mon.cpp ../../../mon/src/mon_6502.cpp ../../../mon/src/mon_68k.cpp ../../../mon/src/mon_8080.cpp ../../../mon/src/mon_cmd.cpp ../../../mon/src/mon_ppc.cpp ../../../mon/src/mon_x86.cpp"
CXXFLAGS="$CXXFLAGS -I../../../mon/src" CXXFLAGS="$CXXFLAGS -I../../../mon/src"
AC_CHECK_LIB(readline, readline)
AC_CHECK_HEADERS(readline/readline.h readline/history.h)
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
WANT_MON=no WANT_MON=no
@ -85,7 +88,7 @@ fi
dnl We use GTK+ if possible. dnl We use GTK+ if possible.
UISRCS=../dummy/prefs_editor_dummy.cpp UISRCS=../dummy/prefs_editor_dummy.cpp
if [[ "x$WANT_UI" = "xyes" ]]; then if [[ "x$WANT_GTK" = "xyes" ]]; then
AM_PATH_GTK(1.2.0, [ AM_PATH_GTK(1.2.0, [
DEFINES="$DEFINES -DENABLE_GTK=1" DEFINES="$DEFINES -DENABLE_GTK=1"
CFLAGS="$CFLAGS $GTK_CFLAGS" CFLAGS="$CFLAGS $GTK_CFLAGS"
@ -94,7 +97,7 @@ if [[ "x$WANT_UI" = "xyes" ]]; then
UISRCS=prefs_editor_gtk.cpp UISRCS=prefs_editor_gtk.cpp
], [ ], [
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) AC_MSG_WARN([Could not find GTK+, disabling user interface.])
WANT_UI=no WANT_GTK=no
]) ])
fi fi
@ -291,7 +294,7 @@ echo
echo XFree86 DGA support .............. : $WANT_XF86_DGA echo XFree86 DGA support .............. : $WANT_XF86_DGA
echo fbdev DGA support ................ : $WANT_FBDEV_DGA echo fbdev DGA support ................ : $WANT_FBDEV_DGA
echo ESD sound support ................ : $WANT_ESD echo ESD sound support ................ : $WANT_ESD
echo GTK user interface ............... : $WANT_UI echo GTK user interface ............... : $WANT_GTK
echo mon debugger support ............. : $WANT_MON echo mon debugger support ............. : $WANT_MON
echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY
echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY

View File

@ -54,6 +54,10 @@
#include <X11/extensions/xf86dga.h> #include <X11/extensions/xf86dga.h>
#endif #endif
#if ENABLE_MON
#include "mon.h"
#endif
// Constants // Constants
const char ROM_FILE_NAME[] = "ROM"; const char ROM_FILE_NAME[] = "ROM";
@ -87,6 +91,11 @@ static struct sigaction timer_sa; // sigaction used for timer
static timer_t timer; // 60Hz timer static timer_t timer; // 60Hz timer
#endif #endif
#if ENABLE_MON
static struct sigaction sigint_sa; // sigaction for SIGINT handler
static void sigint_handler(...);
#endif
// Prototypes // Prototypes
static void *xpram_func(void *arg); static void *xpram_func(void *arg);
@ -132,6 +141,8 @@ int main(int argc, char **argv)
for (int i=1; i<argc; i++) { for (int i=1; i<argc; i++) {
if (strcmp(argv[i], "-display") == 0 && ++i < argc) if (strcmp(argv[i], "-display") == 0 && ++i < argc)
x_display_name = argv[i]; x_display_name = argv[i];
else if (strcmp(argv[i], "-break") == 0 && ++i < argc)
ROMBreakpoint = strtol(argv[i], NULL, 0);
} }
// Open display // Open display
@ -252,6 +263,14 @@ int main(int argc, char **argv)
} }
#endif #endif
#if ENABLE_MON
// Setup SIGINT handler to enter mon
sigemptyset(&sigint_sa.sa_mask);
sigint_sa.sa_flags = 0;
sigint_sa.sa_handler = sigint_handler;
sigaction(SIGINT, &sigint_sa, NULL);
#endif
// Start 68k and jump to ROM boot routine // Start 68k and jump to ROM boot routine
Start680x0(); Start680x0();
@ -327,6 +346,20 @@ void FlushCodeCache(void *start, uint32 size)
#endif #endif
/*
* SIGINT handler, enters mon
*/
#if ENABLE_MON
static void sigint_handler(...)
{
char *arg[2] = {"rmon", NULL};
mon(1, arg);
QuitEmulator();
}
#endif
/* /*
* Interrupt flags (must be handled atomically!) * Interrupt flags (must be handled atomically!)
*/ */

View File

@ -69,9 +69,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7], r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr); r->sr);
#if ENABLE_MON #if ENABLE_MON
char *arg[2]; char *arg[2] = {"rmon", NULL};
arg[0] = "rmon";
arg[1] = NULL;
mon(1, arg); mon(1, arg);
#endif #endif
QuitEmulator(); QuitEmulator();
@ -432,7 +430,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->d[0] = 0; r->d[0] = 0;
break; break;
default: default:
printf("FATAL: MemoryDispatch(%d): illegal selector\n", sel); printf("FATAL: MemoryDispatch(%d): unimplemented selector\n", sel);
r->d[0] = (uint32)-502; r->d[0] = (uint32)-502;
break; break;
} }
@ -527,6 +525,10 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7], r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7], r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr); r->sr);
#if ENABLE_MON
char *arg[2] = {"rmon", NULL};
mon(1, arg);
#endif
QuitEmulator(); QuitEmulator();
break; break;
} }

View File

@ -32,6 +32,9 @@ enum {
extern uint16 ROMVersion; extern uint16 ROMVersion;
// ROM offset of breakpoint
extern uint32 ROMBreakpoint;
// ROM offset of UniversalInfo, set by PatchROM() // ROM offset of UniversalInfo, set by PatchROM()
extern uint32 UniversalInfo; extern uint32 UniversalInfo;

View File

@ -38,9 +38,8 @@
#include "debug.h" #include "debug.h"
// Breakpoint // Breakpoint (offset into ROM)
//#define M68K_BREAKPOINT 0x2310 // CritError uint32 ROMBreakpoint = 0; // 0 = disabled, 0x2310 = CritError
//#define M68K_BREAKPOINT 0x1d10 // BootMe
// Global variables // Global variables
uint32 UniversalInfo; // ROM offset of UniversalInfo uint32 UniversalInfo; // ROM offset of UniversalInfo
@ -547,6 +546,11 @@ void InstallDrivers(uint32 pb)
r.d[0] = 0xa093; r.d[0] = 0xa093;
Execute68kTrap(0xa247, &r); // SetOSTrapAddress() 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 // Install disk driver
r.a[0] = ROMBaseMac + sony_offset + 0x100; r.a[0] = ROMBaseMac + sony_offset + 0x100;
r.d[0] = (uint32)DiskRefNum; r.d[0] = (uint32)DiskRefNum;
@ -642,12 +646,6 @@ void InstallSERD(void)
void PatchAfterStartup(void) void PatchAfterStartup(void)
{ {
// Install MemoryDispatch() replacement routine
M68kRegisters r;
r.a[0] = ROMBaseMac + memory_dispatch_offset;
r.d[0] = 0xa05c;
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
#if SUPPORTS_EXTFS #if SUPPORTS_EXTFS
// Install external file system // Install external file system
InstallExtFS(); InstallExtFS();
@ -1303,6 +1301,15 @@ static bool patch_rom_32(void)
} }
} }
// Don't set MemoryDispatch() to unimplemented trap
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
wp = (uint16 *)(ROMBaseHost + base + 10);
*wp = htons(M68K_NOP);
}
// Patch .EDisk driver (don't scan for EDisks in the area ROMBase..0xe00000) // Patch .EDisk driver (don't scan for EDisks in the area ROMBase..0xe00000)
uint32 edisk_offset = find_rom_resource('DRVR', 51); uint32 edisk_offset = find_rom_resource('DRVR', 51);
if (edisk_offset) { if (edisk_offset) {
@ -1455,11 +1462,11 @@ bool PatchROM(void)
return false; return false;
} }
#ifdef M68K_BREAKPOINT
// Install breakpoint // Install breakpoint
uint16 *wp = (uint16 *)(ROMBaseHost + M68K_BREAKPOINT); if (ROMBreakpoint) {
*wp = htons(M68K_EMUL_BREAK); uint16 *wp = (uint16 *)(ROMBaseHost + ROMBreakpoint);
#endif *wp = htons(M68K_EMUL_BREAK);
}
// Clear caches as we loaded and patched code // Clear caches as we loaded and patched code
FlushCodeCache(ROMBaseHost, ROMSize); FlushCodeCache(ROMBaseHost, ROMSize);