diff --git a/BasiliskII/README b/BasiliskII/README index 70c120d9..7b607d1d 100644 --- a/BasiliskII/README +++ b/BasiliskII/README @@ -658,20 +658,21 @@ Please see the included file "TECH" for a technical overview of the emulator. Acknowledgements ---------------- -Contributions by: - - Bernd Schmidt : UAE 68k emulation - - Marc Hellwig : audio output, BeOS video code - and networking - - Lauri Pesonen : Windows NT port +Contributions by (in alphabetical order): - Orlando Bassotto : FreeBSD support - - Brian J. Johnson : IRIX support - - Marc Chabanas : Solaris sound support - - Bill Huey : 15/16 bit DGA and 15/16/32 bit X11 - window support - - David Lawrence : incremental window refresh code - - Samuel Lander : tile-based window refresh code - Gwenole Beauchesne : SPARC assembly optimizations and fbdev video code + - Marc Chabanas : Solaris sound support + - Marc Hellwig : audio output, BeOS video code + and networking + - Bill Huey : 15/16 bit DGA and 15/16/32 bit X11 + window support + - Brian J. Johnson : IRIX support + - Jürgen Lachmann : AmigaOS CyberGraphX support + - Samuel Lander : tile-based window refresh code + - David Lawrence : incremental window refresh code + - Lauri Pesonen : Windows NT port + - Bernd Schmidt : UAE 68k emulation - and others... Special thanks to: diff --git a/BasiliskII/TODO b/BasiliskII/TODO index b8d8bdf4..d4a40228 100644 --- a/BasiliskII/TODO +++ b/BasiliskII/TODO @@ -1,6 +1,5 @@ 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 still seems to be wrong with the UAE FPU (Calculator and scroll bars in MacOS 8 don't work properly), Lauri has fixed this and it has to be integrated into the main sources @@ -13,8 +12,6 @@ General: - Sound output rate/bits/channels switching - Sound in - Video: gamma tables, resolution/depth switching, multiple monitor support -- Double mouse pointer in window mode (should be fixed by blanking the - Mac mouse pointer because the host mouse position is more accurate) - More accurate Time Manager - Serial driver: XOn/XOff handshaking - regs.spcflags in UAE CPU should be handled atomically @@ -24,14 +21,12 @@ General: AmigaOS: - "Create Hardfile..." button -- Mouse pointer in window mode - Support for ShapeShifter External Video Drivers - Direct SCSI transfers, i.e. no buffering for contiguous transfers (can't check if the device supports that); buffer is always in Chip memory now - Preemptive threads don't work? - clip_amiga.cpp: clip AmigaOS->Basilisk - sys_amiga.cpp: MaxTransfer/BufMemType/TransferMask, SysAddCDROMPrefs(), SysFormat() -- sony.cpp: DISK_INSERT_CHECK: disks are not ejected and automatically remounted on eject - Patch 512K ROM for 68040/060 caches - Input handler instead of IDCMP? - Last sound buffer is not played diff --git a/BasiliskII/src/AmigaOS/Makefile b/BasiliskII/src/AmigaOS/Makefile index 41d00b63..9054abe1 100644 --- a/BasiliskII/src/AmigaOS/Makefile +++ b/BasiliskII/src/AmigaOS/Makefile @@ -12,8 +12,8 @@ AS = PhxAss ASFLAGS = OPT ! INCPATH GG:os-include MACHINE=68020 FPU=1 ## Files -SRCS = ../main.cpp main_amiga.cpp ../prefs.cpp prefs_amiga.cpp \ - prefs_editor_amiga.cpp sys_amiga.cpp ../rom_patches.cpp \ +SRCS = ../main.cpp main_amiga.cpp ../prefs.cpp ../prefs_items.cpp \ + prefs_amiga.cpp prefs_editor_amiga.cpp sys_amiga.cpp ../rom_patches.cpp \ ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \ ../macos_util.cpp ../xpram.cpp xpram_amiga.cpp ../timer.cpp \ timer_amiga.cpp clip_amiga.cpp ../adb.cpp ../serial.cpp \ diff --git a/BasiliskII/src/BeOS/Makefile b/BasiliskII/src/BeOS/Makefile index a6c53e6a..890399a1 100644 --- a/BasiliskII/src/BeOS/Makefile +++ b/BasiliskII/src/BeOS/Makefile @@ -39,13 +39,14 @@ else CPUSRCS = ../uae_cpu/basilisk_glue.cpp ../uae_cpu/newcpu.cpp \ ../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp cpuemu.cpp endif -SRCS = ../main.cpp main_beos.cpp ../prefs.cpp prefs_beos.cpp prefs_editor_beos.cpp \ - sys_beos.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp \ - ../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_beos.cpp ../timer.cpp \ - timer_beos.cpp clip_beos.cpp ../adb.cpp ../serial.cpp serial_beos.cpp \ - ../ether.cpp ether_beos.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp \ - scsi_beos.cpp ../video.cpp video_beos.cpp ../audio.cpp audio_beos.cpp \ - ../extfs.cpp extfs_beos.cpp ../user_strings.cpp user_strings_beos.cpp \ +SRCS = ../main.cpp main_beos.cpp ../prefs.cpp ../prefs_items.cpp prefs_beos.cpp \ + prefs_editor_beos.cpp sys_beos.cpp ../rom_patches.cpp ../slot_rom.cpp \ + ../rsrc_patches.cpp ../emul_op.cpp ../macos_util.cpp ../xpram.cpp \ + xpram_beos.cpp ../timer.cpp timer_beos.cpp clip_beos.cpp ../adb.cpp \ + ../serial.cpp serial_beos.cpp ../ether.cpp ether_beos.cpp ../sony.cpp \ + ../disk.cpp ../cdrom.cpp ../scsi.cpp scsi_beos.cpp ../video.cpp \ + video_beos.cpp ../audio.cpp audio_beos.cpp ../extfs.cpp extfs_beos.cpp \ + ../user_strings.cpp user_strings_beos.cpp \ $(CPUSRCS) # specify the resource files to use diff --git a/BasiliskII/src/BeOS/serial_beos.cpp b/BasiliskII/src/BeOS/serial_beos.cpp index ff4021b5..48b51409 100644 --- a/BasiliskII/src/BeOS/serial_beos.cpp +++ b/BasiliskII/src/BeOS/serial_beos.cpp @@ -76,14 +76,14 @@ public: suspend_thread(input_thread); // Unblock thread snooze(1000); resume_thread(input_thread); - wait_for_thread(input_thread, &l); + while (wait_for_thread(input_thread, &l) == B_INTERRUPTED) ; } if (output_thread > 0) { send_data(output_thread, CMD_QUIT, NULL, 0); suspend_thread(output_thread); // Unblock thread snooze(1000); resume_thread(output_thread); - wait_for_thread(output_thread, &l); + while (wait_for_thread(output_thread, &l) == B_INTERRUPTED) ; } acquire_sem(device_sem); delete_sem(device_sem); diff --git a/BasiliskII/src/Unix/Makefile.in b/BasiliskII/src/Unix/Makefile.in index a3a864a7..df4b865e 100644 --- a/BasiliskII/src/Unix/Makefile.in +++ b/BasiliskII/src/Unix/Makefile.in @@ -26,12 +26,13 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s INSTALL_DATA = @INSTALL_DATA@ ## Files -SRCS = ../main.cpp main_unix.cpp ../prefs.cpp prefs_unix.cpp sys_unix.cpp \ - ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \ - ../macos_util.cpp ../xpram.cpp xpram_unix.cpp ../timer.cpp timer_unix.cpp \ - clip_unix.cpp ../adb.cpp ../serial.cpp ../ether.cpp ../sony.cpp \ - ../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp video_x.cpp ../audio.cpp \ - ../extfs.cpp extfs_unix.cpp ../user_strings.cpp user_strings_unix.cpp \ +SRCS = ../main.cpp main_unix.cpp ../prefs.cpp ../prefs_items.cpp prefs_unix.cpp \ + sys_unix.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp \ + ../emul_op.cpp ../macos_util.cpp ../xpram.cpp xpram_unix.cpp ../timer.cpp \ + timer_unix.cpp clip_unix.cpp ../adb.cpp ../serial.cpp ../ether.cpp \ + ../sony.cpp ../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp video_x.cpp \ + ../audio.cpp ../extfs.cpp extfs_unix.cpp ../user_strings.cpp \ + user_strings_unix.cpp \ $(SYSSRCS) $(CPUSRCS) APP = BasiliskII diff --git a/BasiliskII/src/cdrom.cpp b/BasiliskII/src/cdrom.cpp index 78098196..71ca0525 100644 --- a/BasiliskII/src/cdrom.cpp +++ b/BasiliskII/src/cdrom.cpp @@ -874,7 +874,7 @@ int16 CDROMStatus(uint32 pb, uint32 dce) WriteMacInt32(pb + csParam + 4, FOURCC('c','d','r','m')); break; case FOURCC('i','n','t','f'): // Interface type - WriteMacInt32(pb + csParam + 4, FOURCC('b','a','s','i')); + WriteMacInt32(pb + csParam + 4, EMULATOR_ID_4); break; case FOURCC('s','y','n','c'): // Only synchronous operation? WriteMacInt32(pb + csParam + 4, 0x01000000); diff --git a/BasiliskII/src/disk.cpp b/BasiliskII/src/disk.cpp index 36e3da0e..6fed2689 100644 --- a/BasiliskII/src/disk.cpp +++ b/BasiliskII/src/disk.cpp @@ -440,7 +440,7 @@ int16 DiskStatus(uint32 pb, uint32 dce) WriteMacInt32(pb + csParam + 4, FOURCC('d','i','s','k')); break; case FOURCC('i','n','t','f'): // Interface type - WriteMacInt32(pb + csParam + 4, FOURCC('b','a','s','i')); + WriteMacInt32(pb + csParam + 4, EMULATOR_ID_4); break; case FOURCC('s','y','n','c'): // Only synchronous operation? WriteMacInt32(pb + csParam + 4, 0x01000000); diff --git a/BasiliskII/src/extfs.cpp b/BasiliskII/src/extfs.cpp index 31f2789e..aea67d71 100644 --- a/BasiliskII/src/extfs.cpp +++ b/BasiliskII/src/extfs.cpp @@ -107,8 +107,8 @@ static bool ready = false; static struct stat root_stat; // File system ID/media type -const int16 MY_FSID = 0x6261; // 'ba' -const uint32 MY_MEDIA_TYPE = FOURCC('b','a','s','i'); +const int16 MY_FSID = EMULATOR_ID_2; +const uint32 MY_MEDIA_TYPE = EMULATOR_ID_4; // CNID of root and root's parent const uint32 ROOT_ID = 2; diff --git a/BasiliskII/src/include/audio_defs.h b/BasiliskII/src/include/audio_defs.h index ec807566..25dffda5 100644 --- a/BasiliskII/src/include/audio_defs.h +++ b/BasiliskII/src/include/audio_defs.h @@ -94,7 +94,12 @@ enum { // ComponentResource struct componentIconID = 42, componentVersion = 44, componentRegisterFlags = 48, - componentIconFamily = 52 + componentIconFamily = 52, + componentPFCount = 54, + componentPFFlags = 58, + componentPFResType = 62, + componentPFResID = 66, + componentPFPlatform = 68 }; // Component feature flags diff --git a/BasiliskII/src/include/clip.h b/BasiliskII/src/include/clip.h index cc8f32fc..01f9a8d4 100644 --- a/BasiliskII/src/include/clip.h +++ b/BasiliskII/src/include/clip.h @@ -25,5 +25,6 @@ extern void ClipInit(void); extern void ClipExit(void); extern void PutScrap(uint32 type, void *scrap, int32 length); +extern void GetScrap(void **handle, uint32 type, int32 offset); #endif diff --git a/BasiliskII/src/include/macos_util.h b/BasiliskII/src/include/macos_util.h index 279dd0c4..25619c0b 100644 --- a/BasiliskII/src/include/macos_util.h +++ b/BasiliskII/src/include/macos_util.h @@ -254,6 +254,10 @@ extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t // Construct four-character-code from string #define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) +// Emulator identification codes (4 and 2 characters) +const uint32 EMULATOR_ID_4 = 0x62617369; // 'basi' +const uint16 EMULATOR_ID_2 = 0x6261; // 'ba' + // Test if basic MacOS initializations (of the ROM) are done static inline bool HasMacStarted(void) { diff --git a/BasiliskII/src/include/prefs.h b/BasiliskII/src/include/prefs.h index 9feb8249..31bf79f4 100644 --- a/BasiliskII/src/include/prefs.h +++ b/BasiliskII/src/include/prefs.h @@ -26,6 +26,7 @@ extern void PrefsInit(void); extern void PrefsExit(void); +extern void AddPrefsDefaults(void); extern void AddPlatformPrefsDefaults(void); // Preferences loading/saving diff --git a/BasiliskII/src/include/serial.h b/BasiliskII/src/include/serial.h index 875b6ae4..a5b8272a 100644 --- a/BasiliskII/src/include/serial.h +++ b/BasiliskII/src/include/serial.h @@ -29,11 +29,21 @@ * 3 - .BOut */ +#ifdef POWERPC_ROM +extern int16 SerialOpen(uint32 pb, uint32 dce); +extern int16 SerialPrimeIn(uint32 pb, uint32 dce); +extern int16 SerialPrimeOut(uint32 pb, uint32 dce); +extern int16 SerialControl(uint32 pb, uint32 dce); +extern int16 SerialStatus(uint32 pb, uint32 dce); +extern int16 SerialClose(uint32 pb, uint32 dce); +extern int16 SerialNothing(uint32 pb, uint32 dce); +#else extern int16 SerialOpen(uint32 pb, uint32 dce, int port); extern int16 SerialPrime(uint32 pb, uint32 dce, int port); extern int16 SerialControl(uint32 pb, uint32 dce, int port); extern int16 SerialStatus(uint32 pb, uint32 dce, int port); extern int16 SerialClose(uint32 pb, uint32 dce, int port); +#endif extern void SerialInterrupt(void); @@ -76,6 +86,10 @@ public: bool write_pending; // Write operation pending bool write_done; // Write operation complete uint32 output_dt; // Mac address of Deferred Task for writing + +#ifdef POWERPC_ROM + uint8 dt_store[SIZEOF_serdt * 2]; +#endif }; extern SERDPort *the_serd_port[2]; diff --git a/BasiliskII/src/prefs.cpp b/BasiliskII/src/prefs.cpp index 05f8aa9e..6e266c23 100644 --- a/BasiliskII/src/prefs.cpp +++ b/BasiliskII/src/prefs.cpp @@ -28,43 +28,7 @@ #include "prefs.h" -// Common preferences items (those which exist on all platforms) -// Except for "disk", "floppy", "cdrom", "scsiX", "screen", "rom" and "ether", -// these are guaranteed to be in the prefs; "disk", "floppy" and "cdrom" can -// occur multiple times -prefs_desc common_prefs_items[] = { - {"disk", TYPE_STRING, true}, // Device/file names of Mac volumes (disk.cpp) - {"floppy", TYPE_STRING, true}, // Device/file names of Mac floppy drives (sony.cpp) - {"cdrom", TYPE_STRING, true}, // Device/file names of Mac CD-ROM drives (cdrom.cpp) - {"extfs", TYPE_STRING, false}, // Root path of ExtFS (extfs.cpp) - {"scsi0", TYPE_STRING, false}, // SCSI targets for Mac SCSI ID 0..6 (scsi_*.cpp) - {"scsi1", TYPE_STRING, false}, - {"scsi2", TYPE_STRING, false}, - {"scsi3", TYPE_STRING, false}, - {"scsi4", TYPE_STRING, false}, - {"scsi5", TYPE_STRING, false}, - {"scsi6", TYPE_STRING, false}, - {"screen", TYPE_STRING, false}, // Video mode (video.cpp) - {"seriala", TYPE_STRING, false}, // Device name of Mac serial port A (serial_*.cpp) - {"serialb", TYPE_STRING, false}, // Device name of Mac serial port B (serial_*.cpp) - {"ether", TYPE_STRING, false}, // Device name of Mac ethernet adapter (ether_*.cpp) - {"rom", TYPE_STRING, false}, // Path of ROM file (main_*.cpp) - {"bootdrive", TYPE_INT16, false}, // Boot drive number (main.cpp) - {"bootdriver", TYPE_INT16, false}, // Boot driver number (main.cpp) - {"ramsize", TYPE_INT32, false}, // Size of Mac RAM in bytes (main_*.cpp) - {"frameskip", TYPE_INT32, false}, // Number of frames to skip in refreshed video modes (video_*.cpp) - {"modelid", TYPE_INT32, false}, // Mac Model ID (Gestalt Model ID minus 6) (rom_patches.cpp) - {"cpu", TYPE_INT32, false}, // CPU type (0 = 68000, 1 = 68010 etc.) (main.cpp) - {"fpu", TYPE_BOOLEAN, false}, // Enable FPU emulation (main.cpp) - {"nocdrom", TYPE_BOOLEAN, false}, // Don't install CD-ROM driver (cdrom.cpp/rom_patches.cpp) - {"nosound", TYPE_BOOLEAN, false}, // Don't enable sound output (audio_*.cpp) - {"noclipconversion", TYPE_BOOLEAN, false}, // Don't convert clipboard contents (clip_*.cpp) - {"nogui", TYPE_BOOLEAN, false}, // Disable GUI (main_*.cpp) - {NULL, TYPE_END, false} // End of list -}; - - -// Prefs item are stored in a linked list of these nodes +// Prefs items are stored in a linked list of these nodes struct prefs_node { prefs_node *next; const char *name; @@ -86,18 +50,7 @@ void PrefsInit(void) the_prefs = NULL; // Set defaults - SysAddSerialPrefs(); - PrefsAddInt16("bootdriver", 0); - PrefsAddInt16("bootdrive", 0); - PrefsAddInt32("ramsize", 8 * 1024 * 1024); - PrefsAddInt32("frameskip", 6); - PrefsAddInt32("modelid", 5); // Mac IIci - PrefsAddInt32("cpu", 3); // 68030 - PrefsAddBool("fpu", false); - PrefsAddBool("nocdrom", false); - PrefsAddBool("nosound", false); - PrefsAddBool("noclipconversion", false); - PrefsAddBool("nogui", false); + AddPrefsDefaults(); AddPlatformPrefsDefaults(); // Load preferences from settings file diff --git a/BasiliskII/src/prefs_items.cpp b/BasiliskII/src/prefs_items.cpp new file mode 100644 index 00000000..c64c2ba7 --- /dev/null +++ b/BasiliskII/src/prefs_items.cpp @@ -0,0 +1,78 @@ +/* + * prefs_items.cpp - Common preferences items + * + * Basilisk II (C) 1997-2000 Christian Bauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "prefs.h" + + +// Common preferences items (those which exist on all platforms) +// Except for "disk", "floppy", "cdrom", "scsiX", "screen", "rom" and "ether", +// these are guaranteed to be in the prefs; "disk", "floppy" and "cdrom" can +// occur multiple times +prefs_desc common_prefs_items[] = { + {"disk", TYPE_STRING, true}, // Device/file names of Mac volumes (disk.cpp) + {"floppy", TYPE_STRING, true}, // Device/file names of Mac floppy drives (sony.cpp) + {"cdrom", TYPE_STRING, true}, // Device/file names of Mac CD-ROM drives (cdrom.cpp) + {"extfs", TYPE_STRING, false}, // Root path of ExtFS (extfs.cpp) + {"scsi0", TYPE_STRING, false}, // SCSI targets for Mac SCSI ID 0..6 (scsi_*.cpp) + {"scsi1", TYPE_STRING, false}, + {"scsi2", TYPE_STRING, false}, + {"scsi3", TYPE_STRING, false}, + {"scsi4", TYPE_STRING, false}, + {"scsi5", TYPE_STRING, false}, + {"scsi6", TYPE_STRING, false}, + {"screen", TYPE_STRING, false}, // Video mode (video.cpp) + {"seriala", TYPE_STRING, false}, // Device name of Mac serial port A (serial_*.cpp) + {"serialb", TYPE_STRING, false}, // Device name of Mac serial port B (serial_*.cpp) + {"ether", TYPE_STRING, false}, // Device name of Mac ethernet adapter (ether_*.cpp) + {"rom", TYPE_STRING, false}, // Path of ROM file (main_*.cpp) + {"bootdrive", TYPE_INT16, false}, // Boot drive number (main.cpp) + {"bootdriver", TYPE_INT16, false}, // Boot driver number (main.cpp) + {"ramsize", TYPE_INT32, false}, // Size of Mac RAM in bytes (main_*.cpp) + {"frameskip", TYPE_INT32, false}, // Number of frames to skip in refreshed video modes (video_*.cpp) + {"modelid", TYPE_INT32, false}, // Mac Model ID (Gestalt Model ID minus 6) (rom_patches.cpp) + {"cpu", TYPE_INT32, false}, // CPU type (0 = 68000, 1 = 68010 etc.) (main.cpp) + {"fpu", TYPE_BOOLEAN, false}, // Enable FPU emulation (main.cpp) + {"nocdrom", TYPE_BOOLEAN, false}, // Don't install CD-ROM driver (cdrom.cpp/rom_patches.cpp) + {"nosound", TYPE_BOOLEAN, false}, // Don't enable sound output (audio_*.cpp) + {"noclipconversion", TYPE_BOOLEAN, false}, // Don't convert clipboard contents (clip_*.cpp) + {"nogui", TYPE_BOOLEAN, false}, // Disable GUI (main_*.cpp) + {NULL, TYPE_END, false} // End of list +}; + + +/* + * Set default values for preferences items + */ + +void AddPrefsDefaults(void) +{ + SysAddSerialPrefs(); + PrefsAddInt16("bootdriver", 0); + PrefsAddInt16("bootdrive", 0); + PrefsAddInt32("ramsize", 8 * 1024 * 1024); + PrefsAddInt32("frameskip", 6); + PrefsAddInt32("modelid", 5); // Mac IIci + PrefsAddInt32("cpu", 3); // 68030 + PrefsAddBool("fpu", false); + PrefsAddBool("nocdrom", false); + PrefsAddBool("nosound", false); + PrefsAddBool("noclipconversion", false); + PrefsAddBool("nogui", false); +}