From 25e2d4af6f9ebe24bb8476d2444078ef23ee74b9 Mon Sep 17 00:00:00 2001 From: Seth Polsley Date: Fri, 11 Sep 2020 14:44:58 -0500 Subject: [PATCH] Removing vm_memcpy dependency for BII --- BasiliskII/src/audio.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/BasiliskII/src/audio.cpp b/BasiliskII/src/audio.cpp index 9485d75f..fa861f28 100644 --- a/BasiliskII/src/audio.cpp +++ b/BasiliskII/src/audio.cpp @@ -667,7 +667,7 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame // 0x72 // r // }; WriteMacInt32(pb + csParam, 0); // response will be written directly into buffer - vm_memcpy(bufferptr, str, sizeof(str)); + Host2Mac_memcpy(bufferptr, str, sizeof(str)); return noErr; } @@ -684,7 +684,7 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame return memFullErr; WriteMacInt32(bufferptr, h); uint32 sp = ReadMacInt32(h); - vm_memcpy(sp, CDROMIcon, sizeof(CDROMIcon)); + Host2Mac_memcpy(sp, CDROMIcon, sizeof(CDROMIcon)); return noErr; @@ -760,7 +760,7 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame return memFullErr; WriteMacInt32(bufferptr, h); uint32 sp = ReadMacInt32(h); - vm_memcpy(sp, str, sizeof(str)); + Host2Mac_memcpy(sp, str, sizeof(str)); return noErr; } @@ -794,12 +794,18 @@ int16 SoundInStatus(uint32 pb, uint32 dce) // A0 points to Device Manager parame case siSampleRateAvailable: { WriteMacInt32(pb + csParam, 0); + + M68kRegisters r; + r.d[0] = 4; + Execute68kTrap(0xa122, &r); // NewHandle() + uint32 h = r.a[0]; + if (h == 0) + return memFullErr; + WriteMacInt16(bufferptr, 1); // 1 sample rate available + WriteMacInt32(bufferptr + 2, h); // handle to sample rate list + uint32 sp = ReadMacInt32(h); + WriteMacInt32(sp, 0xac440000); // 44100.00000 Hz, of Fixed data type - uint32 virtual_addr = Mac_sysalloc(4); - WriteMacInt32(virtual_addr, 0xac440000); // 44100.00000 Hz, of Fixed data type - - WriteMacInt16(bufferptr, 1); // 1 sample rate available - WriteMacInt32(bufferptr + 2, virtual_addr); // handle to the sample rate list return noErr; }