Simultaneous MPU with most modes

This commit is contained in:
Ian Scott committed 2024-07-27 15:46:16 -06:00
1 parent 66a52b91e3
commit 8d5e5d7d60
2 files changed
+63 -62

No files matched your search

+57 -56
View File
@@ -116,14 +116,36 @@ function(config_target TARGET_NAME MULTIFW)
target_sources(${TARGET_NAME} PRIVATE
mouse/8250uart.cpp
mouse/sermouse.cpp
pico_pic.c
)
endif()
target_sources(${TARGET_NAME} PRIVATE M62429/M62429.cpp)
target_sources(${TARGET_NAME} PRIVATE
M62429/M62429.cpp
pico_pic.c
)
pico_generate_pio_header(${TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR}/M62429/M62429.pio)
pico_generate_pio_header(${TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR}/isa_io.pio)
if(SOUND_MPU)
target_sources(${TARGET_NAME} PRIVATE mpu401/mpu401.c mpu401/midi.c)
target_compile_definitions(${TARGET_NAME} PRIVATE SOUND_MPU=1)
endif()
if(SOUND_OPL)
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_OPL=1
USE_EMU8950_OPL=1
EMU8950_ASM=1
EMU8950_NO_TLL=1 # don't use lookup table for total level
EMU8950_NO_FLOAT=1 # double check there is no float
EMU8950_NO_TIMER=1 # disable timer which isn't used
EMU8950_NO_TEST_FLAG=1 # disable test flags (which aren't used)
EMU8950_SIMPLER_NOISE=1 # only generate noise bit when needed
EMU8950_SHORT_NOISE_UPDATE_CHECK=1 # only update short noise if it is used
)
target_link_libraries(${TARGET_NAME} opl)
endif()
target_link_libraries(
${TARGET_NAME}
pico_stdlib
@@ -137,6 +159,18 @@ function(config_target TARGET_NAME MULTIFW)
hardware_exception
)
pico_add_extra_outputs(${TARGET_NAME})
if (SOUND_MPU)
pico_enable_stdio_uart(${TARGET_NAME} 0)
else()
pico_enable_stdio_uart(${TARGET_NAME} 1)
endif()
if (USB_STACK)
pico_enable_stdio_usb(${TARGET_NAME} 0)
else()
pico_enable_stdio_usb(${TARGET_NAME} 1)
endif()
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tusb_xinput)
@@ -148,9 +182,13 @@ add_subdirectory(opl)
# Build GUS firmware
function(build_gus TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
set(SOUND_MPU TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-gus")
target_sources(${TARGET_NAME} PRIVATE gusplay.cpp pico_pic.c isa_dma.c)
target_sources(${TARGET_NAME} PRIVATE
gusplay.cpp
isa_dma.c
)
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_GUS=1
PSRAM=1
@@ -173,32 +211,26 @@ function(build_gus TARGET_NAME MULTIFW)
)
pico_generate_pio_header(${TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR}/isa_dma.pio)
target_link_libraries(${TARGET_NAME} rp2040-psram hardware_interp)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
# Build SB firmware
function(build_sb TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
set(SOUND_MPU TRUE)
set(SOUND_OPL TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-sb")
target_sources(${TARGET_NAME} PRIVATE sbdsp.cpp sbplay.cpp pico_pic.c isa_dma.c)
target_link_libraries(${TARGET_NAME} opl)
target_sources(${TARGET_NAME} PRIVATE
sbdsp.cpp
sbplay.cpp
isa_dma.c
)
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_SB=1
SOUND_OPL=1
SOUND_DSP=1
USE_ALARM=1
USE_EMU8950_OPL=1
EMU8950_ASM=1
# PICOW=1
)
pico_generate_pio_header(${TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR}/isa_dma.pio)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
@@ -206,45 +238,27 @@ endfunction()
function(build_adlib TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
set(USB_MOUSE TRUE)
set(SOUND_MPU TRUE)
set(SOUND_OPL TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-adlib")
target_sources(${TARGET_NAME} PRIVATE sbplay.cpp)
target_link_libraries(${TARGET_NAME} opl)
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_OPL=1
USE_ALARM=1
USE_EMU8950_OPL=1
EMU8950_ASM=1
# PICOW=1
)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
# Build MPU firmware
function(build_mpu TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
set(SOUND_MPU TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-mpu401")
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_MPU=1
)
target_sources(${TARGET_NAME} PRIVATE
pico_pic.c
mpu401/mpu401.c
mpu401/midi.c
# Enable MPU-401 IRQ support only in this firmware
MPU_IRQ=1
# Larger buffer for sysex delay
MPU_ONLY=1
)
target_sources(${TARGET_NAME} PRIVATE mpuplay.cpp)
# Use USB stdio because UART is used by MIDI, but only if USB joysick is disabled
pico_enable_stdio_uart(${TARGET_NAME} 0)
if(USB_JOYSTICK)
pico_enable_stdio_usb(${TARGET_NAME} 0)
else()
pico_enable_stdio_usb(${TARGET_NAME} 1)
endif()
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
@@ -259,13 +273,9 @@ function(build_tandy TARGET_NAME MULTIFW)
# SQUARE_FLOAT_OUTPUT=1
)
target_sources(${TARGET_NAME} PRIVATE
pico_pic.c
square/square.cpp
)
target_sources(${TARGET_NAME} PRIVATE tandyplay.cpp)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
@@ -279,13 +289,9 @@ function(build_cms TARGET_NAME MULTIFW)
SOUND_CMS=1
)
target_sources(${TARGET_NAME} PRIVATE
pico_pic.c
square/square.cpp
)
target_sources(${TARGET_NAME} PRIVATE cmsplay.cpp)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()
################################################################################
@@ -293,18 +299,13 @@ endfunction()
function(build_usb TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
set(USB_MOUSE TRUE)
set(SOUND_MPU TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-usb")
target_compile_definitions(${TARGET_NAME} PRIVATE
USB_ONLY=1
)
target_sources(${TARGET_NAME} PRIVATE
usbplay.cpp
pico_pic.c
)
pico_enable_stdio_uart(${TARGET_NAME} 1)
pico_enable_stdio_usb(${TARGET_NAME} 0)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
target_sources(${TARGET_NAME} PRIVATE usbplay.cpp)
endfunction()
+6 -6
View File
@@ -97,12 +97,12 @@ static int opl_opl3mode;
static int register_num = 0;
#if !EMU8950_NO_TIMER
/* #if !EMU8950_NO_TIMER */
// Timers; DBOPL does not do timer stuff itself.
static opl_timer_t timer1 = { 12500, 0, 0, 0 };
static opl_timer_t timer2 = { 3125, 0, 0, 0 };
#endif
/* #endif */
// SDL parameters.
@@ -347,7 +347,7 @@ unsigned int OPL_Pico_PortRead(opl_port_t port)
return 0xff;
}
#if !EMU8950_NO_TIMER
/* #if !EMU8950_NO_TIMER */
__dsb();
// Use time_us_64 as current_time gets updated coarsely as the mix callback is called
uint64_t pico_time = time_us_64();
@@ -362,7 +362,7 @@ unsigned int OPL_Pico_PortRead(opl_port_t port)
result |= 0x80; // Either have expired
result |= 0x20; // Timer 2 has expired
}
#endif
/* #endif */
return result;
}
@@ -387,7 +387,7 @@ static void WriteRegister(unsigned int reg_num, unsigned int value)
{
switch (reg_num)
{
#if !EMU8950_NO_TIMER
/* #if !EMU8950_NO_TIMER */
case OPL_REG_TIMER1:
timer1.value = value;
OPLTimer_CalculateEndTime(&timer1);
@@ -421,7 +421,7 @@ static void WriteRegister(unsigned int reg_num, unsigned int value)
}
break;
#endif
/* #endif */
case OPL_REG_NEW:
#if !USE_WOODY_OPL && !USE_EMU8950_OPL
opl_opl3mode = value & 0x01;