- ExtFS works under AmigaOS

- fixed erroneous __regargs attributes in prefs_editor_amiga.cpp
  and audio_amiga.cpp for GCC
This commit is contained in:
cebix 1999-10-21 22:40:04 +00:00
parent f4a3224f42
commit f41718608c
15 changed files with 95 additions and 37 deletions

View File

@ -12,14 +12,15 @@ 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 ../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 \
SRCS = ../main.cpp main_amiga.cpp ../prefs.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 \
serial_amiga.cpp ../ether.cpp ether_amiga.cpp ../sony.cpp ../disk.cpp \
../cdrom.cpp ../scsi.cpp scsi_amiga.cpp ../video.cpp video_amiga.cpp \
../audio.cpp audio_amiga.cpp ../user_strings.cpp user_strings_amiga.cpp \
asm_support.asm
../audio.cpp audio_amiga.cpp ../extfs.cpp extfs_amiga.cpp \
../user_strings.cpp user_strings_amiga.cpp asm_support.asm
APP = BasiliskII
## Rules

View File

@ -57,7 +57,11 @@ static int audio_block_fetched = 0; // Number of audio blocks fetched by inte
// Prototypes
#ifdef __GNUC__
static __saveds __attribute__((regparm(3))) ULONG audio_callback(struct Hook *hook /*a0*/, struct AHISoundMessage *msg /*a1*/, struct AHIAudioCtrl *ahi_ctrl /*a2*/);
#else
static __saveds __regargs ULONG audio_callback(struct Hook *hook /*a0*/, struct AHISoundMessage *msg /*a1*/, struct AHIAudioCtrl *ahi_ctrl /*a2*/);
#endif
/*
@ -174,7 +178,11 @@ void audio_exit_stream()
* AHI sound callback, request next buffer
*/
#ifdef __GNUC__
static __saveds __attribute__((regparm(3))) ULONG audio_callback(struct Hook *hook /*a0*/, struct AHISoundMessage *msg /*a1*/, struct AHIAudioCtrl *ahi_ctrl /*a2*/)
#else
static __saveds __regargs ULONG audio_callback(struct Hook *hook /*a0*/, struct AHISoundMessage *msg /*a1*/, struct AHIAudioCtrl *ahi_ctrl /*a2*/)
#endif
{
play_buf ^= 1;

View File

@ -56,8 +56,9 @@
#include "debug.h"
// Our minimum stack requirement
unsigned long __stack = 0x4000;
// Options for libnix
unsigned long __stack = 0x4000; // Stack requirement
int __nocommandline = 1; // Disable command line parsing
// Constants

View File

@ -83,4 +83,5 @@ void SavePrefs(void)
void AddPlatformPrefsDefaults(void)
{
PrefsReplaceString("extfs", "WORK:");
}

View File

@ -142,7 +142,11 @@ static void read_settings(struct LayoutHandle *h);
* Locale hook - returns string for given ID
*/
#ifdef __GNUC__
static __saveds __attribute__((regparm(3))) const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
#else
static __saveds __regargs const char *locale_hook_func(struct Hook *hook /*a0*/, void *id /*a1*/, struct LayoutHandle *h /*a2*/)
#endif
{
return GetString((uint32)id);
}

View File

@ -39,6 +39,9 @@
// Is the Mac ROM write protected?
#define ROM_IS_WRITE_PROTECTED 0
// ExtFS is supported
#define SUPPORTS_EXTFS 1
// Data types
typedef unsigned char uint8;
typedef signed char int8;

View File

@ -71,6 +71,21 @@ void extfs_exit(void)
}
/*
* Add component to path name
*/
void add_path_component(char *path, const char *component, int max_len)
{
int l = strlen(path);
if (l < max_len-1 && path[l-1] != '/') {
path[l] = '/';
path[l+1] = 0;
}
strncat(path, s, max_len-1);
}
/*
* Get/set finder type/creator for file specified by full path
*/

View File

@ -40,6 +40,9 @@
// Is the Mac ROM write protected?
#define ROM_IS_WRITE_PROTECTED 1
// ExtFS is supported
#define SUPPORTS_EXTFS 1
// Time data type for Time Manager emulation
typedef bigtime_t tm_time_t;

View File

@ -56,6 +56,21 @@ void extfs_exit(void)
}
/*
* Add component to path name
*/
void add_path_component(char *path, const char *component, int max_len)
{
int l = strlen(path);
if (l < max_len-1 && path[l-1] != '/') {
path[l] = '/';
path[l+1] = 0;
}
strncat(path, s, max_len-1);
}
/*
* Get/set finder type/creator for file specified by full path
*/

View File

@ -69,6 +69,9 @@
/* Is the Mac ROM write protected? */
#define ROM_IS_WRITE_PROTECTED 1
/* ExtFS is supported */
#define SUPPORTS_EXTFS 1
/* Data types */
typedef unsigned char uint8;
typedef signed char int8;

View File

@ -493,6 +493,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->d[0] = AudioDispatch(r->a[3], r->a[4]);
break;
#if SUPPORTS_EXTFS
case M68K_EMUL_OP_EXTFS_COMM: // External file system routines
WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4)));
break;
@ -500,6 +501,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
case M68K_EMUL_OP_EXTFS_HFS:
WriteMacInt16(r->a[7] + 20, ExtFSHFS(ReadMacInt32(r->a[7] + 16), ReadMacInt16(r->a[7] + 14), ReadMacInt32(r->a[7] + 10), ReadMacInt32(r->a[7] + 6), ReadMacInt16(r->a[7] + 4)));
break;
#endif
default:
printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode);

View File

@ -204,14 +204,9 @@ static FSItem *find_fsitem(const char *name, FSItem *parent)
const int MAX_PATH_LENGTH = 1024;
static char full_path[MAX_PATH_LENGTH];
static void add_path_component(const char *s)
static void add_path_comp(const char *s)
{
int l = strlen(full_path);
if (l < MAX_PATH_LENGTH-1 && full_path[l-1] != '/') {
full_path[l] = '/';
full_path[l+1] = 0;
}
strncat(full_path, s, MAX_PATH_LENGTH-1);
add_path_component(full_path, s, MAX_PATH_LENGTH);
}
static void get_path_for_fsitem(FSItem *p)
@ -221,7 +216,7 @@ static void get_path_for_fsitem(FSItem *p)
full_path[MAX_PATH_LENGTH-1] = 0;
} else {
get_path_for_fsitem(p->parent);
add_path_component(p->name);
add_path_comp(p->name);
}
}
@ -440,7 +435,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7006); p+= 2; // UTAllocateVCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsAddNewVCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -450,7 +445,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7007); p+= 2; // UTAddNewVCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsDetermineVol)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -462,7 +457,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x701d); p+= 2; // UTDetermineVol
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsResolveWDCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -473,7 +468,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x700e); p+= 2; // UTResolveWDCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsGetDefaultVol)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -481,7 +476,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7012); p+= 2; // UTGetDefaultVol
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsGetPathComponentName)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -489,7 +484,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x701c); p+= 2; // UTGetPathComponentName
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsParsePathname)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -498,7 +493,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x701b); p+= 2; // UTParsePathname
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsDisposeVCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -506,7 +501,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7008); p+= 2; // UTDisposeVCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsCheckWDRefNum)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -514,7 +509,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7013); p+= 2; // UTCheckWDRefNum
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsSetDefaultVol)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -524,7 +519,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7011); p+= 2; // UTSetDefaultVol
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsAllocateFCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -533,7 +528,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7000); p+= 2; // UTAllocateFCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsReleaseFCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -541,7 +536,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7001); p+= 2; // UTReleaseFCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsIndexFCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -551,7 +546,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7004); p+= 2; // UTIndexFCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsResolveFCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -560,7 +555,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7005); p+= 2; // UTResolveFCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsAdjustEOF)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -568,7 +563,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x7010); p+= 2; // UTAdjustEOF
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsAllocateWDCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -576,7 +571,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x700c); p+= 2; // UTAllocateWDCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != fsReleaseWDCB)
goto fsdat_error;
WriteMacInt16(p, 0x4267); p+= 2; // clr.w -(sp)
@ -584,7 +579,7 @@ void InstallExtFS(void)
WriteMacInt16(p, 0x700d); p+= 2; // UTReleaseWDCB
WriteMacInt16(p, 0xa824); p+= 2; // FSMgr
WriteMacInt16(p, 0x301f); p+= 2; // move.w (sp)+,d0
WriteMacInt16(p, M68K_EXEC_RETURN); p+= 2;
WriteMacInt16(p, M68K_RTS); p+= 2;
if (p - fs_data != SIZEOF_fsdat)
goto fsdat_error;
@ -1192,7 +1187,7 @@ read_next_de:
goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names)
//!! suppress directories
}
add_path_component(de->d_name);
add_path_comp(de->d_name);
// Get FSItem for queried item
fs_item = find_fsitem(de->d_name, p);
@ -1320,7 +1315,7 @@ read_next_de:
if (de->d_name[0] == '.')
goto read_next_de; // Suppress name beginning with '.' (MacOS could interpret these as driver names)
}
add_path_component(de->d_name);
add_path_comp(de->d_name);
// Get FSItem for queried item
fs_item = find_fsitem(de->d_name, p);
@ -1978,7 +1973,7 @@ static int16 fs_cat_move(uint32 pb)
return result;
// Append old file/dir name
add_path_component(fs_item->name);
add_path_comp(fs_item->name);
// Does the new name already exist?
if (access(full_path, F_OK) == 0)

View File

@ -32,6 +32,7 @@ extern int16 ExtFSHFS(uint32 vcb, uint16 selectCode, uint32 paramBlock, uint32 g
// System specific and internal functions/data
extern void extfs_init(void);
extern void extfs_exit(void);
extern void add_path_component(char *path, const char *component, int max_len);
extern void get_finder_type(const char *path, uint32 &type, uint32 &creator);
extern void set_finder_type(const char *path, uint32 type, uint32 creator);
extern void get_finder_flags(const char *path, uint16 &flags);

View File

@ -95,8 +95,10 @@ bool InitAll(void)
CDROMInit();
SCSIInit();
#if SUPPORTS_EXTFS
// Init external file system
ExtFSInit();
#endif
// Init serial ports
SerialInit();
@ -159,8 +161,10 @@ void ExitAll(void)
// Exit network
EtherExit();
#if SUPPORTS_EXTFS
// Exit external file system
ExtFSExit();
#endif
// Exit drivers
SCSIExit();

View File

@ -648,8 +648,10 @@ void PatchAfterStartup(void)
r.d[0] = 0xa05c;
Execute68kTrap(0xa247, &r); // SetOSTrapAddress()
#if SUPPORTS_EXTFS
// Install external file system
InstallExtFS();
#endif
}
@ -666,7 +668,7 @@ bool CheckROM(void)
// Real addressing mode requires a 32-bit clean ROM
return ROMVersion == ROM_VERSION_32;
#else
// Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs (experimental)
// Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs
return (ROMVersion == ROM_VERSION_CLASSIC) || (ROMVersion == ROM_VERSION_32);
#endif
}