SB: add registers for setting DSP version, IRQ/DMA settings readback and emulation options

This commit is contained in:
wbcbz7 committed 2026-03-21 20:34:00 +07:00
1 parent 5e77fbc90b
commit f54d9a5840
2 files changed
+39 -2

No files matched your search

+4
View File
@@ -68,6 +68,10 @@ static const char *modenames[8] = {
#define CMD_MPUFAKE 0x22 // MPU fake all notes off
#define CMD_OPLWAIT 0x30 // Adlib speed sensitive fix
#define CMD_SBOPTS 0x30 // SB options (mixer lock, time constant fix, etc.) - aliased to CMD_OPLWAIT
#define CMD_SBDSPVER 0x31 // SB DSP version
#define CMD_SBIRQ 0x32 // SB IRQ
#define CMD_SBDMA 0x33 // SB DMA
#define CMD_MOUSEPORT 0x40 // Mouse Base port
#define CMD_MOUSEPROTO 0x41 // Mouse protocol
+35 -2
View File
@@ -172,7 +172,8 @@ void processSettings(void);
const char* firmware_string = PICO_PROGRAM_NAME " v" PICO_PROGRAM_VERSION_STRING;
static uint8_t basePort_low;
static uint8_t mouseSensitivity_low;
static uint8_t mouseSensitivity_low;
static uint8_t picogus_dataLatch_low;
__force_inline void select_picogus(uint8_t value) {
// printf("select picogus %x\n", value);
@@ -243,6 +244,13 @@ __force_inline void select_picogus(uint8_t value) {
cur_read_idx = 0;
#endif
break;
#ifdef SOUND_SB
case CMD_SBDSPVER:
picogus_dataLatch_low = 0;
case CMD_SBIRQ:
case CMD_SBDMA:
break;
#endif
case CMD_CDSTATUS:
case CMD_CDLOAD:
case CMD_CDAUTOADV:
@@ -288,6 +296,12 @@ __force_inline void write_picogus_low(uint8_t value) {
case CMD_MOUSESEN: // USB Mouse Sensitivity (8.8 fixedpoint)
mouseSensitivity_low = value;
break;
#ifdef SOUND_SB
case CMD_SBDSPVER:
picogus_dataLatch_low = value;
break;
#endif
break;
}
}
@@ -358,7 +372,26 @@ __force_inline void write_picogus_high(uint8_t value) {
#endif
break;
case CMD_OPLWAIT: // Adlib speed sensitive fix
settings.SB.oplSpeedSensitive = value;
//case CMD_SBOPTS: // ... and SB emulation options
settings.SB.oplSpeedSensitive = value & 1; // HACK until settings struct resolved
#ifdef SOUND_SB
sbdsp_set_options(value);
#endif
break;
case CMD_SBDSPVER:
#ifdef SOUND_SB
sbdsp_set_dsp_version((value << 8) | picogus_dataLatch_low);
#endif
break;
case CMD_SBIRQ:
#ifdef SOUND_SB
sbdsp_set_irq(value);
#endif
break;
case CMD_SBDMA:
#ifdef SOUND_SB
sbdsp_set_dma(value);
#endif
break;
case CMD_MOUSEPORT: // USB Mouse port (0 - disabled)
settings.Mouse.basePort = (value || basePort_low) ? ((value << 8) | basePort_low) : 0xFFFF;