From 2c413cce43c9faa500b08a2104464160bcf9159c Mon Sep 17 00:00:00 2001 From: nattthebear Date: Thu, 18 Jun 2020 07:20:20 -0400 Subject: [PATCH] blah --- waterbox/atarist/Makefile | 27 +++++++++--- waterbox/atarist/audio.c | 59 +++++++++++++++++++++++++ waterbox/atarist/glue.c | 91 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 170 insertions(+), 7 deletions(-) create mode 100644 waterbox/atarist/audio.c diff --git a/waterbox/atarist/Makefile b/waterbox/atarist/Makefile index f640f7444e..efcde4ee29 100644 --- a/waterbox/atarist/Makefile +++ b/waterbox/atarist/Makefile @@ -92,6 +92,9 @@ hatari/src/dialog.c \ hatari/src/faketosData.c \ hatari/src/main.c \ + hatari/src/rs232.c \ + hatari/src/statusbar.c \ + hatari/src/shortcut.c \ SRCS = \ hatari/src/acia.c \ @@ -164,17 +167,14 @@ SRCS = \ hatari/src/psg.c \ hatari/src/reset.c \ hatari/src/resolution.c \ - hatari/src/rs232.c \ hatari/src/rtc.c \ hatari/src/scandir.c \ hatari/src/scc.c \ hatari/src/screenConvert.c \ hatari/src/screenSnapShot.c \ - hatari/src/shortcut.c \ hatari/src/sound.c \ hatari/src/spec512.c \ hatari/src/st.c \ - hatari/src/statusbar.c \ hatari/src/stMemory.c \ hatari/src/str.c \ hatari/src/tos.c \ @@ -186,9 +186,26 @@ SRCS = \ hatari/src/xbios.c \ hatari/src/ymFormat.c \ hatari/src/zip.c \ - glue.c - + hatari/src/cpu/cpudefs.c \ + hatari/src/cpu/cpustbl.c \ + hatari/src/cpu/cpuemu_0.c \ + hatari/src/cpu/cpuemu_11.c \ + hatari/src/cpu/cpuemu_13.c \ + hatari/src/cpu/cpuemu_20.c \ + hatari/src/cpu/cpuemu_21.c \ + hatari/src/cpu/cpuemu_22.c \ + hatari/src/cpu/cpuemu_23.c \ + hatari/src/cpu/cpuemu_24.c \ + hatari/src/cpu/cpuemu_31.c \ + hatari/src/cpu/cpuemu_32.c \ + hatari/src/cpu/cpuemu_33.c \ + hatari/src/cpu/cpuemu_34.c \ + hatari/src/cpu/cpuemu_35.c \ + hatari/src/cpu/cpuemu_40.c \ + hatari/src/cpu/cpuemu_50.c \ + glue.c audio.c +EXTRA_LIBS := -lz CCFLAGS = -I. -Ihatari/src/includes -Ihatari/src/debug -Ihatari/src/cpu -I$(OUT_DIR)/gen \ -Ihatari/src/falcon -ISDL_include \ diff --git a/waterbox/atarist/audio.c b/waterbox/atarist/audio.c new file mode 100644 index 0000000000..e6c5046f86 --- /dev/null +++ b/waterbox/atarist/audio.c @@ -0,0 +1,59 @@ +#include +#include +#include "SDL_stdinc.h" +#include "audio.h" +#include "sound.h" +#include "configuration.h" +#include "crossbar.h" +#include "dmaSnd.h" + +int nAudioFrequency = 44100; + +/*-----------------------------------------------------------------------*/ +/** + * Set audio playback frequency variable, pass as PLAYBACK_xxxx + */ +void Audio_SetOutputAudioFreq(int nNewFrequency) +{ + /* Do not reset sound system if nothing has changed! */ + if (nNewFrequency != nAudioFrequency) + { + /* Set new frequency */ + nAudioFrequency = nNewFrequency; + + if (Config_IsMachineFalcon()) + { + /* Compute Ratio between host computer sound frequency and Hatari's sound frequency. */ + Crossbar_Compute_Ratio(); + } + else if (!Config_IsMachineST()) + { + /* Adapt LMC filters to this new frequency */ + DmaSnd_Init_Bass_and_Treble_Tables(); + } + + /* Re-open SDL audio interface if necessary: */ + // if (bSoundWorking) + // { + // Audio_UnInit(); + // Audio_Init(); + // } + } + + /* Apply YM2149 C10 low pass filter ? (except if forced to NONE) */ + if ( YM2149_LPF_Filter != YM2149_LPF_FILTER_NONE ) + { + if ( Config_IsMachineST() && nAudioFrequency >= 40000 ) + YM2149_LPF_Filter = YM2149_LPF_FILTER_LPF_STF; + else + YM2149_LPF_Filter = YM2149_LPF_FILTER_PWM; + } +} + +void Audio_Lock(void) +{} +void Audio_Unlock(void) +{} + +int SoundBufferSize = 1024 / 4; /* Size of sound buffer (in samples) */ +int CompleteSndBufIdx; /* Replay-index into MixBuffer */ diff --git a/waterbox/atarist/glue.c b/waterbox/atarist/glue.c index 86cab06857..a7386db9ed 100644 --- a/waterbox/atarist/glue.c +++ b/waterbox/atarist/glue.c @@ -7,8 +7,8 @@ #endif /* prototypes for dummy log/alert functions below */ -#include "hatari/src/includes/dialog.h" -#include "hatari/src/debug/log.h" +#include "dialog.h" +#include "log.h" /** * Print suitable output prefix based on log level @@ -71,3 +71,90 @@ int DlgAlert_Query(const char *text) do_newline(text); return TRUE; } + +int ExceptionDebugMask = 0; +// extern const char* Log_SetExceptionDebugMask(const char *OptionsStr); +Uint64 LogTraceFlags = 0; +void Log_SetLevels(void) +{} + +#include "statusbar.h" + +void Statusbar_EnableHDLed(drive_led_t state) +{} +void Statusbar_SetFloppyLed(drive_index_t drive, drive_led_t state) +{} + +#include "rs232.h" +#include "ioMem.h" +#include "m68000.h" +#define Dprintf(a) + +void RS232_SCR_ReadByte(void) +{ + M68000_WaitState(4); +} +void RS232_SCR_WriteByte(void) +{ + M68000_WaitState(4); + /*Dprintf(("RS232: Write to SCR: $%x\n", (int)IoMem[0xfffa27]));*/ +} +void RS232_UCR_ReadByte(void) +{ + M68000_WaitState(4); + Dprintf(("RS232: Read from UCR: $%x\n", (int)IoMem[0xfffa29])); +} +void RS232_UCR_WriteByte(void) +{ + M68000_WaitState(4); + Dprintf(("RS232: Write to UCR: $%x\n", (int)IoMem[0xfffa29])); + // RS232_HandleUCR(IoMem[0xfffa29]); +} +void RS232_RSR_ReadByte(void) +{ + M68000_WaitState(4); + IoMem[0xfffa2b] &= ~0x80; /* Buffer not full */ + Dprintf(("RS232: Read from RSR: $%x\n", (int)IoMem[0xfffa2b])); +} +void RS232_RSR_WriteByte(void) +{ + M68000_WaitState(4); + Dprintf(("RS232: Write to RSR: $%x\n", (int)IoMem[0xfffa2b])); +} +void RS232_TSR_ReadByte(void) +{ + M68000_WaitState(4); + IoMem[0xfffa2d] |= 0x80; /* Buffer empty */ + Dprintf(("RS232: Read from TSR: $%x\n", (int)IoMem[0xfffa2d])); +} +void RS232_TSR_WriteByte(void) +{ + M68000_WaitState(4); + Dprintf(("RS232: Write to TSR: $%x\n", (int)IoMem[0xfffa2d])); +} +void RS232_UDR_ReadByte(void) +{ + Uint8 InByte = 0; + M68000_WaitState(4); + // RS232_ReadBytes(&InByte, 1); + IoMem[0xfffa2f] = InByte; + Dprintf(("RS232: Read from UDR: $%x\n", (int)IoMem[0xfffa2f])); +} +void RS232_UDR_WriteByte(void) +{ + Uint8 OutByte; + M68000_WaitState(4); + OutByte = IoMem[0xfffa2f]; + // RS232_TransferBytesTo(&OutByte, 1); + Dprintf(("RS232: Write to UDR: $%x\n", (int)IoMem[0xfffa2f])); +} +void RS232_Init(void) +{} +void RS232_UnInit(void) +{} +void RS232_SetBaudRateFromTimerD(void) +{} + +#include "main.h" + +bool bQuitProgram = false;