From f20fff9ea982bca987893223486b091c4d2dd18b Mon Sep 17 00:00:00 2001 From: cebix <> Date: Tue, 25 Jul 2000 17:02:24 +0000 Subject: [PATCH] - added EMUL_OP opcodes for sound input driver, created stubs for driver routines --- BasiliskII/src/audio.cpp | 125 +++++++++++++++++++++++++++++++ BasiliskII/src/emul_op.cpp | 20 +++++ BasiliskII/src/include/audio.h | 6 ++ BasiliskII/src/include/emul_op.h | 5 ++ 4 files changed, 156 insertions(+) diff --git a/BasiliskII/src/audio.cpp b/BasiliskII/src/audio.cpp index d6259d04..bcbb790d 100644 --- a/BasiliskII/src/audio.cpp +++ b/BasiliskII/src/audio.cpp @@ -470,3 +470,128 @@ delegate: // Delegate call to Apple Mixer return badComponentSelector; } } + + +/* + * Sound input driver Open() routine + */ + +int16 SoundInOpen(uint32 pb, uint32 dce) +{ + D(bug("SoundInOpen\n")); + return noErr; +} + + +/* + * Sound input driver Prime() routine + */ + +int16 SoundInPrime(uint32 pb, uint32 dce) +{ + D(bug("SoundInPrime\n")); + //!! + return paramErr; +} + + +/* + * Sound input driver Control() routine + */ + +int16 SoundInControl(uint32 pb, uint32 dce) +{ + uint16 code = ReadMacInt16(pb + csCode); + D(bug("SoundInControl %d\n", code)); + + if (code == 1) { + D(bug(" SoundInKillIO\n")); + //!! + return noErr; + } + + if (code != 2) + return -231; // siUnknownInfoType + + uint32 *param = (uint32 *)Mac2HostAddr(pb + csParam); + uint32 selector = param[0]; + D(bug(" selector %c%c%c%c\n", selector >> 24, selector >> 16, selector >> 8, selector)); + + switch (selector) { + default: + return -231; // siUnknownInfoType + } +} + + +/* + * Sound input driver Status() routine + */ + +int16 SoundInStatus(uint32 pb, uint32 dce) +{ + uint16 code = ReadMacInt16(pb + csCode); + D(bug("SoundInStatus %d\n", code)); + if (code != 2) + return -231; // siUnknownInfoType + + uint32 *param = (uint32 *)Mac2HostAddr(pb + csParam); + uint32 selector = param[0]; + D(bug(" selector %c%c%c%c\n", selector >> 24, selector >> 16, selector >> 8, selector)); + switch (selector) { +#if 0 + case siDeviceName: { + const char *str = GetString(STR_SOUND_IN_NAME); + param[0] = 0; + memcpy((void *)param[1], str, strlen(str)); + return noErr; + } + + case siDeviceIcon: { + M68kRegisters r; + static const uint16 proc[] = { + 0x558f, // subq.l #2,sp + 0xa994, // CurResFile + 0x4267, // clr.w -(sp) + 0xa998, // UseResFile + 0x598f, // subq.l #4,sp + 0x4879, 0x4943, 0x4e23, // move.l #'ICN#',-(sp) + 0x3f3c, 0xbf76, // move.w #-16522,-(sp) + 0xa9a0, // GetResource + 0x245f, // move.l (sp)+,a2 + 0xa998, // UseResFile + 0x200a, // move.l a2,d0 + 0x6604, // bne 1 + 0x7000, // moveq #0,d0 + M68K_RTS, + 0x2f0a, //1 move.l a2,-(sp) + 0xa992, // DetachResource + 0x204a, // move.l a2,a0 + 0xa04a, // HNoPurge + 0x7001, // moveq #1,d0 + M68K_RTS + }; + Execute68k((uint32)proc, &r); + if (r.d[0]) { + param[0] = 4; // Length of returned data + param[1] = r.a[2]; // Handle to icon suite + return noErr; + } else + return -192; // resNotFound + } +#endif + default: + return -231; // siUnknownInfoType + } +} + + +/* + * Sound input driver Close() routine + */ + +int16 SoundInClose(uint32 pb, uint32 dce) +{ + D(bug("SoundInClose\n")); + return noErr; +} diff --git a/BasiliskII/src/emul_op.cpp b/BasiliskII/src/emul_op.cpp index ecc4f55c..f366d892 100644 --- a/BasiliskII/src/emul_op.cpp +++ b/BasiliskII/src/emul_op.cpp @@ -348,6 +348,26 @@ void EmulOp(uint16 opcode, M68kRegisters *r) EtherReadPacket((uint8 **)&r->a[0], r->a[3], r->d[3], r->d[1]); break; + case M68K_EMUL_OP_SOUNDIN_OPEN: // Sound input driver functions + r->d[0] = SoundInOpen(r->a[0], r->a[1]); + break; + + case M68K_EMUL_OP_SOUNDIN_PRIME: + r->d[0] = SoundInPrime(r->a[0], r->a[1]); + break; + + case M68K_EMUL_OP_SOUNDIN_CONTROL: + r->d[0] = SoundInControl(r->a[0], r->a[1]); + break; + + case M68K_EMUL_OP_SOUNDIN_STATUS: + r->d[0] = SoundInStatus(r->a[0], r->a[1]); + break; + + case M68K_EMUL_OP_SOUNDIN_CLOSE: + r->d[0] = SoundInClose(r->a[0], r->a[1]); + break; + case M68K_EMUL_OP_SCSI_DISPATCH: { // SCSIDispatch() replacement uint32 ret = ReadMacInt32(r->a[7]); // Get return address uint16 sel = ReadMacInt16(r->a[7] + 4); // Get selector diff --git a/BasiliskII/src/include/audio.h b/BasiliskII/src/include/audio.h index 2c80797e..d42b59f1 100644 --- a/BasiliskII/src/include/audio.h +++ b/BasiliskII/src/include/audio.h @@ -25,6 +25,12 @@ extern int32 AudioDispatch(uint32 params, uint32 ti); extern bool AudioAvailable; // Flag: audio output available (from the software point of view) +extern int16 SoundInOpen(uint32 pb, uint32 dce); +extern int16 SoundInPrime(uint32 pb, uint32 dce); +extern int16 SoundInControl(uint32 pb, uint32 dce); +extern int16 SoundInStatus(uint32 pb, uint32 dce); +extern int16 SoundInClose(uint32 pb, uint32 dce); + // System specific and internal functions/data extern void AudioInit(void); extern void AudioExit(void); diff --git a/BasiliskII/src/include/emul_op.h b/BasiliskII/src/include/emul_op.h index 4af5aece..66d7cd6e 100644 --- a/BasiliskII/src/include/emul_op.h +++ b/BasiliskII/src/include/emul_op.h @@ -82,6 +82,11 @@ enum { M68K_EMUL_OP_EXTFS_COMM, M68K_EMUL_OP_EXTFS_HFS, M68K_EMUL_OP_BLOCK_MOVE, + M68K_EMUL_OP_SOUNDIN_OPEN, // 0x7130 + M68K_EMUL_OP_SOUNDIN_PRIME, + M68K_EMUL_OP_SOUNDIN_CONTROL, + M68K_EMUL_OP_SOUNDIN_STATUS, + M68K_EMUL_OP_SOUNDIN_CLOSE, M68K_EMUL_OP_MAX // highest number };