rename SAM to DAC functions
This commit is contained in:
parent
fa43e909ed
commit
feccde41bf
3 changed files with 32 additions and 20 deletions
|
@ -1297,7 +1297,7 @@ void MemInitialize()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (g_Slot5 == CT_SAM)
|
if (g_Slot5 == CT_SAM)
|
||||||
ConfigureDAC(pCxRomPeripheral, 5); // $C500 : Z80 card
|
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
|
||||||
|
|
||||||
DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w
|
DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w
|
||||||
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
|
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
|
||||||
|
|
|
@ -42,13 +42,21 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
static BYTE __stdcall IOWrite_DAC(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft)
|
static BYTE __stdcall IOWrite_SAM(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft)
|
||||||
{
|
{
|
||||||
// Emulate audio from an 8 bit DAC
|
// Emulate audio from a SAM / 8 bit DAC card
|
||||||
// only if using wave data
|
// Only supportable if AppleWin is using WAVE output
|
||||||
// uses the existing speaker for the timing but then
|
//
|
||||||
// substitutes the analog data which gets subsequently
|
// This works by using the existing speaker handling but then
|
||||||
// sent to audio out
|
// replacing the speaker audio with the 8 bit samples from the DAC
|
||||||
|
// before they get sent out to the soundcard buffer, whilst
|
||||||
|
// audio samples are being written to the SAM.
|
||||||
|
//
|
||||||
|
// Whilst very unusual, it is possible to intermingle use of SAM and the apple
|
||||||
|
// speaker. This is crudely supported with g_quieterSpeaker making the Apple
|
||||||
|
// speaker produce quieter clicks which will be crudely intermingled
|
||||||
|
// with the SAM data. The mute gets reset after the speaker code detects
|
||||||
|
// silence.
|
||||||
|
|
||||||
byte mb_res;
|
byte mb_res;
|
||||||
|
|
||||||
|
@ -57,20 +65,24 @@ static BYTE __stdcall IOWrite_DAC(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
||||||
// use existing speaker code to bring timing up to date
|
// use existing speaker code to bring timing up to date
|
||||||
mb_res = SpkrToggle(pc, addr, bWrite, d, nCyclesLeft);
|
mb_res = SpkrToggle(pc, addr, bWrite, d, nCyclesLeft);
|
||||||
|
|
||||||
// 8 bit card WAV driver (scaled by 256)
|
// The DAC in the SAM uses unsigned 8 bit samples
|
||||||
// 0xFF 255 0x7f 127
|
// The WAV data that g_nSpeakerData is loaded into is a signed short
|
||||||
// 0x80 128 0x00 0
|
//
|
||||||
// 0x7f 127 0xFF -1
|
// We convert unsigned 8 bit to signed by toggling the most significant bit
|
||||||
// 0x00 0 0x80 -128
|
//
|
||||||
|
// SAM card WAV driver SAM WAV
|
||||||
// replace regular speaker output with 8 bit DAC value
|
// 0xFF 255 0x7f 127 _ FF 7F
|
||||||
// regular speaker data still audible but quieter until speaker
|
// 0x81 129 0x01 1 / \
|
||||||
// goes idle (so both work simultaneously)
|
// 0x80 128 0x00 0 / \ /80 00
|
||||||
|
// 0x7f 127 0xFF -1 \_/
|
||||||
|
// 0x00 0 0x80 -128 00 80
|
||||||
|
//
|
||||||
|
// SAM is 8 bit, PC WAV is 16 so shift audio to the MSB (<< 8)
|
||||||
|
|
||||||
g_nSpeakerData = (d ^ 0x80) << 8;
|
g_nSpeakerData = (d ^ 0x80) << 8;
|
||||||
|
|
||||||
// make speaker quieter so eg: a metronome click through the
|
// make speaker quieter so eg: a metronome click through the
|
||||||
// Apple speaker is softer vs. the analogue SAM output
|
// Apple speaker is softer vs. the analogue SAM output.
|
||||||
g_quieterSpeaker = 1;
|
g_quieterSpeaker = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -79,7 +91,7 @@ static BYTE __stdcall IOWrite_DAC(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
|
||||||
return mb_res;
|
return mb_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDAC(LPBYTE pCxRomPeripheral, UINT uSlot)
|
void ConfigureSAM(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||||
{
|
{
|
||||||
RegisterIoHandler(uSlot,IO_Null,IOWrite_DAC,IO_Null,IO_Null, NULL, NULL);
|
RegisterIoHandler(uSlot,IO_Null,IOWrite_SAM,IO_Null,IO_Null, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
// SAM speech card (8 bit DAC):
|
// SAM speech card (8 bit DAC):
|
||||||
void ConfigureDAC(LPBYTE pCxRomPeripheral, UINT uSlot);
|
void ConfigureSAM(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||||
|
|
Loading…
Add table
Reference in a new issue