- disk insertions are now checked for by the 60Hz interrupt routine

- localizable strings are split into a common and a platform-specific set
- fixed bug in CR->LF translation in AmigaOS/clip_amiga.cpp
This commit is contained in:
cebix 1999-10-12 20:00:56 +00:00
parent 34d8f7a90e
commit 6d926e553a
20 changed files with 294 additions and 265 deletions

View File

@ -1,3 +1,11 @@
V0.7 -
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for
by an interrupt routine
- Localizable strings are now split into a common and a platform-
specific set
- AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation
[Giacomo Magnini]
V0.7 (release 0.7-2) - 6.Oct.1999
- Added BasiliskII.spec for making RPMs [with assistance from
Roman Niewiarowski]

View File

@ -3,9 +3,6 @@ Bugs:
- 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)
- Lauri reports that when a "please insert volume foo" dialog comes up,
disk insertions are not recognized. The PostEvent() code in sony.cpp
etc. in Control()/accRun should probably be moved to an interrupt handler.
- MacOS 8: Finder threads don't work
General:

View File

@ -116,7 +116,7 @@ void PutScrap(uint32 type, void *scrap, int32 length)
uint8 c = *p++;
if (c < 0x80) {
if (c == 13) // CR -> LF
c == 10;
c = 10;
} else
c = mac2iso[c & 0x7f];
*q++ = c;

View File

@ -14,7 +14,7 @@ OBJS = prefs.o rom_patches.o slot_rom.o rsrc_patches.o emul_op.o macos_util.o \
video.o audio.o user_strings.o \
main_amiga.o asm_support.o prefs_amiga.o prefs_editor_amiga.o \
sys_amiga.o xpram_amiga.o timer_amiga.o clip_amiga.o serial_amiga.o \
ether_amiga.o scsi_amiga.o audio_amiga.o video_amiga.o
ether_amiga.o scsi_amiga.o audio_amiga.o video_amiga.o user_strings_amiga.o
APP = BasiliskII
## Rules
@ -87,3 +87,5 @@ audio_amiga.o: audio_amiga.cpp
$(CC) $(INCLUDES) $(CFLAGS) audio_amiga.cpp
video_amiga.o: video_amiga.cpp
$(CC) $(INCLUDES) $(CFLAGS) video_amiga.cpp
user_strings_amiga.o: user_strings_amiga.cpp
$(CC) $(INCLUDES) $(CFLAGS) user_strings_amiga.cpp

View File

@ -28,6 +28,8 @@
#include <stdlib.h>
#include <string.h>
#include "user_strings_amiga.h"
// Are the Mac and the host address space the same?
#define REAL_ADDRESSING 1

View File

@ -39,12 +39,13 @@ 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=../prefs.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \
../macos_util.cpp ../xpram.cpp ../timer.cpp ../adb.cpp ../serial.cpp ../ether.cpp ../sony.cpp \
../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp ../audio.cpp ../user_strings.cpp \
main_beos.cpp prefs_beos.cpp prefs_editor_beos.cpp sys_beos.cpp xpram_beos.cpp \
timer_beos.cpp clip_beos.cpp serial_beos.cpp ether_beos.cpp scsi_beos.cpp video_beos.cpp \
audio_beos.cpp \
SRCS = 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 \
../user_strings.cpp user_strings_beos.cpp \
$(CPUSRCS)
# specify the resource files to use

View File

@ -25,6 +25,8 @@
#include <support/SupportDefs.h>
#include <support/ByteOrder.h>
#include "user_strings_beos.h"
// Are the Mac and the host address space the same?
#ifdef __i386__
#define REAL_ADDRESSING 0

View File

@ -26,11 +26,12 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
INSTALL_DATA = @INSTALL_DATA@
## Files
SRCS = ../prefs.cpp ../rom_patches.cpp ../slot_rom.cpp ../rsrc_patches.cpp ../emul_op.cpp \
../macos_util.cpp ../xpram.cpp ../timer.cpp ../adb.cpp ../serial.cpp ../ether.cpp ../sony.cpp \
../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp ../audio.cpp ../user_strings.cpp \
main_unix.cpp prefs_unix.cpp sys_unix.cpp xpram_unix.cpp timer_unix.cpp clip_unix.cpp \
serial_unix.cpp video_x.cpp \
SRCS = 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 serial_unix.cpp ../ether.cpp ../sony.cpp \
../disk.cpp ../cdrom.cpp ../scsi.cpp ../video.cpp video_x.cpp ../audio.cpp \
../user_strings.cpp user_strings_unix.cpp \
$(SYSSRCS) $(CPUSRCS)
APP = BasiliskII

View File

@ -678,16 +678,16 @@ static void create_graphics_pane(GtkWidget *top)
combo = gtk_combo_new();
gtk_widget_show(combo);
GList *glist1 = NULL;
glist1 = g_list_append(glist1, (char *)"512");
glist1 = g_list_append(glist1, (char *)"640");
glist1 = g_list_append(glist1, (char *)"800");
glist1 = g_list_append(glist1, (char *)"1024");
glist1 = g_list_append(glist1, (char *)"MAX");
glist1 = g_list_append(glist1, GetString(STR_SIZE_512_LAB));
glist1 = g_list_append(glist1, GetString(STR_SIZE_640_LAB));
glist1 = g_list_append(glist1, GetString(STR_SIZE_800_LAB));
glist1 = g_list_append(glist1, GetString(STR_SIZE_1024_LAB));
glist1 = g_list_append(glist1, GetString(STR_SIZE_MAX_LAB));
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1);
if (dis_width)
sprintf(str, "%d", dis_width);
else
strcpy(str, "MAX");
strcpy(str, GetString(STR_SIZE_MAX_LAB));
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
w_display_x = GTK_COMBO(combo)->entry;
@ -699,16 +699,16 @@ static void create_graphics_pane(GtkWidget *top)
combo = gtk_combo_new();
gtk_widget_show(combo);
GList *glist2 = NULL;
glist2 = g_list_append(glist2, (char *)"384");
glist2 = g_list_append(glist2, (char *)"480");
glist2 = g_list_append(glist2, (char *)"600");
glist2 = g_list_append(glist2, (char *)"768");
glist2 = g_list_append(glist2, (char *)"MAX");
glist2 = g_list_append(glist2, GetString(STR_SIZE_384_LAB));
glist2 = g_list_append(glist2, GetString(STR_SIZE_480_LAB));
glist2 = g_list_append(glist2, GetString(STR_SIZE_600_LAB));
glist2 = g_list_append(glist2, GetString(STR_SIZE_768_LAB));
glist2 = g_list_append(glist2, GetString(STR_SIZE_MAX_LAB));
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2);
if (dis_height)
sprintf(str, "%d", dis_height);
else
strcpy(str, "MAX");
strcpy(str, GetString(STR_SIZE_MAX_LAB));
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
w_display_y = GTK_COMBO(combo)->entry;
@ -777,7 +777,7 @@ static GList *add_serial_names(void)
if (glist)
g_list_sort(glist, gl_str_cmp);
else
glist = g_list_append(glist, (char *)"<none>");
glist = g_list_append(glist, GetString(STR_NONE_LAB));
return glist;
}
@ -813,7 +813,7 @@ static GList *add_ether_names(void)
if (glist)
g_list_sort(glist, gl_str_cmp);
else
glist = g_list_append(glist, (char *)"<none>");
glist = g_list_append(glist, GetString(STR_NONE_LAB));
return glist;
}

View File

@ -26,6 +26,7 @@
#endif
#include "config.h"
#include "user_strings_unix.h"
#ifndef STDC_HEADERS
#error "You don't have ANSI C header files."

View File

@ -151,6 +151,12 @@ static DriveInfo *first_drive_info;
// Icon address (Mac address space, set by PatchROM())
uint32 CDROMIconAddr;
// Number of ticks between checks for disk insertion
const int driver_delay = 120;
// Flag: Control(accRun) has been called, interrupt routine is now active
static bool acc_run_called = false;
/*
* Get pointer to drive info, NULL = invalid drive number
@ -335,6 +341,39 @@ bool CDROMMountVolume(void *fh)
}
/*
* Mount volumes for which the to_be_mounted flag is set
* (called during interrupt time)
*/
static void mount_mountable_volumes(void)
{
DriveInfo *info = first_drive_info;
while (info != NULL) {
// Disk in drive?
if (ReadMacInt8(info->status + dsDiskInPlace) == 0) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
CDROMMountVolume(info->fh);
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
}
/*
* Driver Open() routine
*/
@ -345,6 +384,7 @@ int16 CDROMOpen(uint32 pb, uint32 dce)
// Set up DCE
WriteMacInt32(dce + dCtlPosition, 0);
acc_run_called = false;
// Install drives
for (DriveInfo *info = first_drive_info; info; info = info->next) {
@ -456,30 +496,10 @@ int16 CDROMControl(uint32 pb, uint32 dce)
case 1: // KillIO
return noErr;
case 65: { // Periodic action ("insert" disks on startup and check for disk changes)
DriveInfo *info = first_drive_info;
while (info != NULL) {
// Disk in drive?
if (ReadMacInt8(info->status + dsDiskInPlace) == 0) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
CDROMMountVolume(info->fh);
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
case 65: { // Periodic action (accRun, "insert" disks on startup)
mount_mountable_volumes();
WriteMacInt16(dce + dCtlFlags, ReadMacInt16(dce + dCtlFlags) & ~0x2000); // Disable periodic action
acc_run_called = true;
return noErr;
}
@ -939,3 +959,21 @@ int16 CDROMStatus(uint32 pb, uint32 dce)
return statusErr;
}
}
/*
* Driver interrupt routine - check for volumes to be mounted
*/
void CDROMInterrupt(void)
{
static int tick_count = 0;
if (!acc_run_called)
return;
tick_count++;
if (tick_count > driver_delay) {
tick_count = 0;
mount_mountable_volumes();
}
}

View File

@ -90,6 +90,12 @@ static DriveInfo *first_drive_info;
// Icon address (Mac address space, set by PatchROM())
uint32 DiskIconAddr;
// Number of ticks between checks for disk insertion
const int driver_delay = 120;
// Flag: Control(accRun) has been called, interrupt routine is now active
static bool acc_run_called = false;
/*
* Get pointer to drive info, NULL = invalid drive number
@ -183,6 +189,39 @@ bool DiskMountVolume(void *fh)
}
/*
* Mount volumes for which the to_be_mounted flag is set
* (called during interrupt time)
*/
static void mount_mountable_volumes(void)
{
DriveInfo *info = first_drive_info;
while (info != NULL) {
// Disk in drive?
if (!ReadMacInt8(info->status + dsDiskInPlace)) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
DiskMountVolume(info->fh);
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
}
/*
* Driver Open() routine
*/
@ -193,6 +232,7 @@ int16 DiskOpen(uint32 pb, uint32 dce)
// Set up DCE
WriteMacInt32(dce + dCtlPosition, 0);
acc_run_called = false;
// Install drives
for (DriveInfo *info = first_drive_info; info; info = info->next) {
@ -306,30 +346,10 @@ int16 DiskControl(uint32 pb, uint32 dce)
case 1: // KillIO
return noErr;
case 65: { // Periodic action ("insert" disks on startup and check for disk changes)
DriveInfo *info = first_drive_info;
while (info != NULL) {
// Disk in drive?
if (!ReadMacInt8(info->status + dsDiskInPlace)) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
DiskMountVolume(info->fh);
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
case 65: { // Periodic action (accRun, "insert" disks on startup)
mount_mountable_volumes();
WriteMacInt16(dce + dCtlFlags, ReadMacInt16(dce + dCtlFlags) & ~0x2000); // Disable periodic action
acc_run_called = true;
return noErr;
}
}
@ -472,3 +492,21 @@ int16 DiskStatus(uint32 pb, uint32 dce)
return statusErr;
}
}
/*
* Driver interrupt routine - check for volumes to be mounted
*/
void DiskInterrupt(void)
{
static int tick_count = 0;
if (!acc_run_called)
return;
tick_count++;
if (tick_count > driver_delay) {
tick_count = 0;
mount_mountable_volumes();
}
}

View File

@ -434,10 +434,13 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
ClearInterruptFlag(INTFLAG_60HZ);
if (HasMacStarted()) {
// Mac has started, execute video, ADB and Time Manager interrupt functions
// Mac has started, execute all 60Hz interrupt functions
ADBInterrupt();
TimerInterrupt();
VideoInterrupt();
SonyInterrupt();
DiskInterrupt();
CDROMInterrupt();
// Call DoVBLTask(0)
if (ROMVersion == ROM_VERSION_32) {

View File

@ -23,7 +23,6 @@
const int CDROMRefNum = -62; // RefNum of driver
const uint16 CDROMDriverFlags = 0x6d04; // Driver flags
const uint16 CDROMDriverDelay = 120; // Driver delay
extern const uint8 CDROMIcon[258]; // Icon data (copied to ROM by PatchROM())
@ -32,6 +31,8 @@ extern uint32 CDROMIconAddr; // Icon address (Mac address space, set by PatchR
extern void CDROMInit(void);
extern void CDROMExit(void);
extern void CDROMInterrupt(void);
extern bool CDROMMountVolume(void *fh);
extern int16 CDROMOpen(uint32 pb, uint32 dce);

View File

@ -23,7 +23,6 @@
const int DiskRefNum = -63; // RefNum of driver
const uint16 DiskDriverFlags = 0x6f04; // Driver flags
const uint16 DiskDriverDelay = 120; // Driver delay
extern const uint8 DiskIcon[258]; // Icon data (copied to ROM by PatchROM())
@ -32,6 +31,8 @@ extern uint32 DiskIconAddr; // Icon address (Mac address space, set by PatchR
extern void DiskInit(void);
extern void DiskExit(void);
extern void DiskInterrupt(void);
extern bool DiskMountVolume(void *fh);
extern int16 DiskOpen(uint32 pb, uint32 dce);

View File

@ -23,7 +23,6 @@
const int SonyRefNum = -5; // RefNum of driver
const uint16 SonyDriverFlags = 0x6f00; // Driver flags
const uint16 SonyDriverDelay = 120; // Driver delay
extern const uint8 SonyDiskIcon[258]; // Icon data (copied to ROM by PatchROM())
extern const uint8 SonyDriveIcon[258];
@ -34,6 +33,8 @@ extern uint32 SonyDriveIconAddr;
extern void SonyInit(void);
extern void SonyExit(void);
extern void SonyInterrupt(void);
extern bool SonyMountVolume(void *fh);
extern int16 SonyOpen(uint32 pb, uint32 dce);

View File

@ -21,7 +21,7 @@
#ifndef USER_STRINGS_H
#define USER_STRINGS_H
// String numbers
// Common string numbers
enum {
// General messages
STR_ABOUT_TEXT1 = 0,
@ -57,6 +57,8 @@ enum {
// Warning messages
STR_SMALL_RAM_WARN = 2000,
STR_CREATE_VOLUME_WARN,
STR_VOLUME_IS_MOUNTED_WARN,
STR_CANNOT_UNMOUNT_WARN,
// Preferences window
STR_PREFS_TITLE = 3000,
@ -65,13 +67,8 @@ enum {
STR_PREFS_ITEM_START,
STR_PREFS_ITEM_ZAP_PRAM,
STR_PREFS_ITEM_QUIT,
STR_PREFS_MENU_FILE_GTK = 3040,
STR_PREFS_ITEM_START_GTK,
STR_PREFS_ITEM_ZAP_PRAM_GTK,
STR_PREFS_ITEM_SEPL_GTK,
STR_PREFS_ITEM_QUIT_GTK,
STR_HELP_MENU_GTK,
STR_HELP_ITEM_ABOUT_GTK,
STR_NONE_LAB = 3100,
STR_VOLUMES_PANE_TITLE = 3200, // Volumes pane
STR_VOLUMES_CTRL,
@ -126,6 +123,15 @@ enum {
STR_REF_60HZ_LAB,
STR_DISPLAY_X_CTRL,
STR_DISPLAY_Y_CTRL,
STR_SIZE_384_LAB,
STR_SIZE_480_LAB,
STR_SIZE_512_LAB,
STR_SIZE_600_LAB,
STR_SIZE_640_LAB,
STR_SIZE_768_LAB,
STR_SIZE_800_LAB,
STR_SIZE_1024_LAB,
STR_SIZE_MAX_LAB,
STR_COLOR_DEPTH_CTRL,
STR_1_BIT_LAB,
STR_2_BIT_LAB,
@ -180,47 +186,19 @@ enum {
STR_WINDOW_ITEM_ABOUT,
STR_WINDOW_ITEM_REFRESH,
STR_WINDOW_ITEM_MOUNT,
STR_SUSPEND_WINDOW_TITLE,
// BeOS specific messages
STR_NO_SHEEP_DRIVER_ERR = 10000,
STR_SHEEP_UP_ERR,
STR_NO_KERNEL_DATA_ERR,
STR_VOLUME_IS_MOUNTED_WARN,
STR_CANNOT_UNMOUNT_WARN,
STR_NO_NET_ADDON_WARN,
STR_NET_CONFIG_MODIFY_WARN,
STR_NET_ADDON_INIT_FAILED,
STR_NET_ADDON_CLONE_FAILED,
// Unix specific messages
STR_NO_XSERVER_ERR = 11000,
STR_NO_XVISUAL_ERR,
STR_UNSUPP_DEPTH_ERR,
STR_NO_SHEEP_NET_DRIVER_WARN,
STR_SHEEP_NET_ATTACH_WARN,
STR_SCSI_DEVICE_OPEN_WARN,
STR_SCSI_DEVICE_NOT_SCSI_WARN,
STR_NO_AUDIO_DEV_WARN,
STR_AUDIO_FORMAT_WARN,
STR_KEYCODE_FILE_WARN,
STR_KEYCODE_VENDOR_WARN,
// AmigaOS specific messages
STR_NO_PREPARE_EMUL_ERR = 12000,
STR_NO_GADTOOLS_LIB_ERR,
STR_NO_ASL_LIB_ERR,
STR_NO_TIMER_DEV_ERR,
STR_NO_P96_MODE_ERR,
STR_WRONG_SCREEN_DEPTH_ERR,
STR_WRONG_SCREEN_FORMAT_ERR,
STR_NOT_ETHERNET_WARN,
STR_NO_MULTICAST_WARN,
STR_NO_GTLAYOUT_LIB_WARN,
STR_NO_AHI_WARN,
STR_NO_AHI_CTRL_WARN
STR_SUSPEND_WINDOW_TITLE
};
extern char *GetString(int num);
// Common and platform-specific string definitions
struct user_string_def {
int num;
const char *str;
};
extern user_string_def common_strings[];
extern user_string_def platform_strings[];
// Fetch pointer to string, given the string number
extern const char *GetString(int num);
#endif

View File

@ -146,7 +146,7 @@ again:
static const uint8 sony_driver[] = { // Replacement for .Sony driver
// Driver header
SonyDriverFlags >> 8, SonyDriverFlags & 0xff, SonyDriverDelay >> 8, SonyDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00,
SonyDriverFlags >> 8, SonyDriverFlags & 0xff, 0, 0, 0, 0, 0, 0,
0x00, 0x18, // Open() offset
0x00, 0x1c, // Prime() offset
0x00, 0x20, // Control() offset
@ -194,7 +194,7 @@ static const uint8 sony_driver[] = { // Replacement for .Sony driver
static const uint8 disk_driver[] = { // Generic disk driver
// Driver header
DiskDriverFlags >> 8, DiskDriverFlags & 0xff, DiskDriverDelay >> 8, DiskDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00,
DiskDriverFlags >> 8, DiskDriverFlags & 0xff, 0, 0, 0, 0, 0, 0,
0x00, 0x18, // Open() offset
0x00, 0x1c, // Prime() offset
0x00, 0x20, // Control() offset
@ -242,7 +242,7 @@ static const uint8 disk_driver[] = { // Generic disk driver
static const uint8 cdrom_driver[] = { // CD-ROM driver
// Driver header
CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, CDROMDriverDelay >> 8, CDROMDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00,
CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, 0, 0, 0, 0, 0, 0,
0x00, 0x1c, // Open() offset
0x00, 0x20, // Prime() offset
0x00, 0x24, // Control() offset
@ -555,7 +555,6 @@ void InstallDrivers(uint32 pb)
uint32 dce = ReadMacInt32(r.a[0]);
WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x100);
WriteMacInt16(dce + dCtlFlags, DiskDriverFlags);
WriteMacInt16(dce + dCtlDelay, DiskDriverDelay);
// Open disk driver
WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x112);
@ -574,7 +573,6 @@ void InstallDrivers(uint32 pb)
dce = ReadMacInt32(r.a[0]);
WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x200);
WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags);
WriteMacInt16(dce + dCtlDelay, CDROMDriverDelay);
// Open CD-ROM driver
WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x212);

View File

@ -123,8 +123,11 @@ static DriveInfo *first_drive_info;
uint32 SonyDiskIconAddr;
uint32 SonyDriveIconAddr;
// Flag: accRun called for the first time, run PatchAfterStartup()
static bool periodic_first_time = false;
// Number of ticks between checks for disk insertion
const int driver_delay = 120;
// Flag: Control(accRun) has been called, interrupt routine is now active
static bool acc_run_called = false;
/*
@ -215,6 +218,41 @@ bool SonyMountVolume(void *fh)
}
/*
* Mount volumes for which the to_be_mounted flag is set
* (called during interrupt time)
*/
static void mount_mountable_volumes(void)
{
DriveInfo *info = first_drive_info;
while (info != NULL) {
#if DISK_INSERT_CHECK
// Disk in drive?
if (!ReadMacInt8(info->status + dsDiskInPlace)) {
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
SonyMountVolume(info->fh);
}
#endif
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
}
/*
* Driver Open() routine
*/
@ -226,7 +264,7 @@ int16 SonyOpen(uint32 pb, uint32 dce)
// Set up DCE
WriteMacInt32(dce + dCtlPosition, 0);
WriteMacInt16(dce + dCtlQHdr + qFlags, ReadMacInt16(dce + dCtlQHdr + qFlags) & 0xff00 | 3); // Version number, must be >=3 or System 8 will replace us
periodic_first_time = true;
acc_run_called = false;
// Install driver again with refnum -2 (HD20)
uint32 utab = ReadMacInt32(0x11c);
@ -354,38 +392,12 @@ int16 SonyControl(uint32 pb, uint32 dce)
case 9: // Track cache
return noErr;
case 65: { // Periodic action ("insert" disks on startup and check for disk changes)
DriveInfo *info = first_drive_info;
while (info != NULL) {
// Disk in drive?
if (!ReadMacInt8(info->status + dsDiskInPlace)) {
#if DISK_INSERT_CHECK
// No, check if disk was inserted
if (SysIsDiskInserted(info->fh))
SonyMountVolume(info->fh);
#endif
}
// Mount disk if flagged
if (info->to_be_mounted) {
D(bug(" mounting drive %d\n", info->num));
M68kRegisters r;
r.d[0] = info->num;
r.a[0] = 7; // diskEvent
Execute68kTrap(0xa02f, &r); // PostEvent()
info->to_be_mounted = false;
}
info = info->next;
}
if (periodic_first_time) {
periodic_first_time = false;
PatchAfterStartup(); // Install patches after system startup
}
case 65: // Periodic action (accRun, "insert" disks on startup)
mount_mountable_volumes();
PatchAfterStartup(); // Install patches after system startup
WriteMacInt16(dce + dCtlFlags, ReadMacInt16(dce + dCtlFlags) & ~0x2000); // Disable periodic action
acc_run_called = true;
return noErr;
}
}
// Drive valid?
@ -505,3 +517,21 @@ int16 SonyStatus(uint32 pb, uint32 dce)
return statusErr;
}
}
/*
* Driver interrupt routine - check for volumes to be mounted
*/
void SonyInterrupt(void)
{
static int tick_count = 0;
if (!acc_run_called)
return;
tick_count++;
if (tick_count > driver_delay) {
tick_count = 0;
mount_mountable_volumes();
}
}

View File

@ -1,5 +1,5 @@
/*
* user_strings.cpp - Localizable strings
* user_strings.cpp - Common localizable strings
*
* Basilisk II (C) 1997-1999 Christian Bauer
*
@ -34,33 +34,14 @@
#include "user_strings.h"
#ifdef __BEOS__
#define UTF8_ELLIPSIS "\xE2\x80\xA6"
#define ELLIPSIS "\xE2\x80\xA6"
#else
#define UTF8_ELLIPSIS "..."
#define ELLIPSIS "..."
#endif
struct str_def {
int num;
char *str;
};
// Localized strings
#if 0
static const str_def loc_strings[] = {
{STR_READING_ROM_FILE, "ROM-Datei wird gelesen...\n"},
{-1, NULL} // End marker
};
#else
static const str_def loc_strings[] = {
{-1, NULL} // End marker
};
#endif
// Default strings
static const str_def default_strings[] = {
// Common string definitions
user_string_def common_strings[] = {
{STR_ABOUT_TEXT1, "Basilisk II V%d.%d"},
{STR_ABOUT_TEXT2, "by Christian Bauer et al."},
{STR_READING_ROM_FILE, "Reading ROM file...\n"},
@ -92,26 +73,23 @@ static const str_def default_strings[] = {
{STR_SMALL_RAM_WARN, "Selected less than 1MB Mac RAM, using 1MB."},
{STR_CREATE_VOLUME_WARN, "Cannot create hardfile (%s)."},
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted. Basilisk II will try to unmount it."},
{STR_CANNOT_UNMOUNT_WARN, "The volume '%s' could not be unmounted. Basilisk II will not use it."},
{STR_PREFS_TITLE, "Basilisk II Settings"},
{STR_PREFS_MENU, "Settings"},
{STR_PREFS_ITEM_ABOUT, "About Basilisk II" UTF8_ELLIPSIS},
{STR_PREFS_ITEM_ABOUT, "About Basilisk II" ELLIPSIS},
{STR_PREFS_ITEM_START, "Start Basilisk II"},
{STR_PREFS_ITEM_ZAP_PRAM, "Zap PRAM File"},
{STR_PREFS_ITEM_QUIT, "Quit Basilisk II"},
{STR_PREFS_MENU_FILE_GTK, "/_File"},
{STR_PREFS_ITEM_START_GTK, "/File/_Start Basilisk II"},
{STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"},
{STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"},
{STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit Basilisk II"},
{STR_HELP_MENU_GTK, "/_Help"},
{STR_HELP_ITEM_ABOUT_GTK, "/Help/_About Basilisk II"},
{STR_NONE_LAB, "<none>"},
{STR_VOLUMES_PANE_TITLE, "Volumes"},
{STR_VOLUMES_CTRL, "Mac Volumes"},
{STR_ADD_VOLUME_BUTTON, "Add" UTF8_ELLIPSIS},
{STR_CREATE_VOLUME_BUTTON, "Create" UTF8_ELLIPSIS},
{STR_EDIT_VOLUME_BUTTON, "Edit" UTF8_ELLIPSIS},
{STR_ADD_VOLUME_BUTTON, "Add" ELLIPSIS},
{STR_CREATE_VOLUME_BUTTON, "Create" ELLIPSIS},
{STR_EDIT_VOLUME_BUTTON, "Edit" ELLIPSIS},
{STR_REMOVE_VOLUME_BUTTON, "Remove"},
{STR_ADD_VOLUME_PANEL_BUTTON, "Add"},
{STR_CREATE_VOLUME_PANEL_BUTTON, "Create"},
@ -160,6 +138,15 @@ static const str_def default_strings[] = {
{STR_REF_60HZ_LAB, "60 Hz"},
{STR_DISPLAY_X_CTRL, "Width"},
{STR_DISPLAY_Y_CTRL, "Height"},
{STR_SIZE_384_LAB, "384"},
{STR_SIZE_480_LAB, "480"},
{STR_SIZE_512_LAB, "512"},
{STR_SIZE_600_LAB, "600"},
{STR_SIZE_640_LAB, "640"},
{STR_SIZE_768_LAB, "768"},
{STR_SIZE_800_LAB, "800"},
{STR_SIZE_1024_LAB, "1024"},
{STR_SIZE_MAX_LAB, "Maximum"},
{STR_COLOR_DEPTH_CTRL, "Color Depth"},
{STR_1_BIT_LAB, "B/W (1 Bit)"},
{STR_2_BIT_LAB, "4 (2 Bit)"},
@ -210,70 +197,10 @@ static const str_def default_strings[] = {
{STR_WINDOW_TITLE, "Basilisk II"},
{STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"},
{STR_WINDOW_MENU, "Basilisk II"},
{STR_WINDOW_ITEM_ABOUT, "About Basilisk II" UTF8_ELLIPSIS},
{STR_WINDOW_ITEM_ABOUT, "About Basilisk II" ELLIPSIS},
{STR_WINDOW_ITEM_REFRESH, "Refresh Rate"},
{STR_WINDOW_ITEM_MOUNT, "Mount"},
{STR_SUSPEND_WINDOW_TITLE, "Basilisk II suspended. Press space to reactivate."},
{STR_NO_SHEEP_DRIVER_ERR, "Cannot open /dev/sheep: %s (%08x). Basilisk II is not properly installed."},
{STR_SHEEP_UP_ERR, "Cannot allocate Low Memory Globals: %s (%08x)."},
{STR_NO_KERNEL_DATA_ERR, "Cannot create Kernel Data area: %s (%08x)."},
{STR_VOLUME_IS_MOUNTED_WARN, "The volume '%s' is mounted under BeOS. Basilisk II will try to unmount it."},
{STR_CANNOT_UNMOUNT_WARN, "The volume '%s' could not be unmounted. Basilisk II will not use it."},
{STR_NO_NET_ADDON_WARN, "The SheepShaver net server add-on cannot be found. Ethernet will not be available."},
{STR_NET_CONFIG_MODIFY_WARN, "To enable Ethernet networking for Basilisk II, your network configuration has to be modified and the network restarted. Do you want this to be done now (selecting \"Cancel\" will disable Ethernet under Basilisk II)?."},
{STR_NET_ADDON_INIT_FAILED, "SheepShaver net server add-on found\nbut there seems to be no network hardware.\nPlease check your network preferences."},
{STR_NET_ADDON_CLONE_FAILED, "Cloning of the network transfer area failed."},
{STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."},
{STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."},
{STR_UNSUPP_DEPTH_ERR, "Unsupported color depth of screen."},
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
{STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."},
{STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."},
{STR_AUDIO_FORMAT_WARN, "Audio hardware doesn't support signed 16 bit format. Audio output will be disabled."},
{STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
{STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
{STR_NO_PREPARE_EMUL_ERR, "PrepareEmul is not installed. Run PrepareEmul and then try again to start Basilisk II."},
{STR_NO_GADTOOLS_LIB_ERR, "Cannot open gadtools.library V39."},
{STR_NO_ASL_LIB_ERR, "Cannot open asl.library V36."},
{STR_NO_TIMER_DEV_ERR, "Cannot open timer.device."},
{STR_NO_P96_MODE_ERR, "The selected screen mode is not a Picasso96 mode."},
{STR_WRONG_SCREEN_DEPTH_ERR, "Basilisk II only supports 8, 16 or 24 bit screens."},
{STR_WRONG_SCREEN_FORMAT_ERR, "Basilisk II only supports big-endian chunky ARGB screen modes."},
{STR_NOT_ETHERNET_WARN, "The selected network device is not an Ethernet device. Networking will be disabled."},
{STR_NO_MULTICAST_WARN, "Your Ethernet card does not support multicast and is not usable with AppleTalk. Please report this to the manufacturer of the card."},
{STR_NO_GTLAYOUT_LIB_WARN, "Cannot open gtlayout.library V39. The preferences editor GUI will not be available."},
{STR_NO_AHI_WARN, "Cannot open ahi.device V2. Audio output will be disabled."},
{STR_NO_AHI_CTRL_WARN, "Cannot open AHI control structure. Audio output will be disabled."},
{-1, NULL} // End marker
};
/*
* Fetch pointer to string, given the string number
*/
char *GetString(int num)
{
// First search for localized string
int i = 0;
while (loc_strings[i].num >= 0) {
if (loc_strings[i].num == num)
return loc_strings[i].str;
i++;
}
// Not found, then get default string
i = 0;
while (default_strings[i].num >= 0) {
if (default_strings[i].num == num)
return default_strings[i].str;
i++;
}
return NULL;
}