From 3bb3937738ad2deaeeee95b1dce2d8631df95fcf Mon Sep 17 00:00:00 2001 From: Ian Scott Date: Thu, 28 Nov 2024 13:40:46 -0700 Subject: [PATCH] License housekeeping --- README.md | 2 +- pgusinit/pgusinit.c | 17 +++++ sw/clamp.h | 18 +++++ sw/cmsplay.cpp | 18 ++++- sw/dosbox-x-compat.h | 19 +++++ sw/dosboxcompat.h | 177 ------------------------------------------- sw/flash_settings.c | 18 +++++ sw/flash_settings.h | 17 +++++ sw/gus-x.cpp | 1 + sw/gusplay.cpp | 18 ++++- sw/isa_dma.c | 18 +++++ sw/isa_dma.h | 18 +++++ sw/isa_dma.pio | 18 +++++ sw/isa_io.pio | 18 +++++ sw/mpu401/export.h | 1 + sw/mpu401/midi.c | 1 + sw/mpu401/mpu401.c | 1 + sw/mpuplay.cpp | 18 +++++ sw/ne2000play.cpp | 19 ++++- sw/pico_pic.c | 24 ++++-- sw/pico_pic.h | 24 ++++-- sw/pico_reflash.c | 18 +++++ sw/pico_reflash.h | 18 +++++ sw/picogus.cpp | 18 +++++ sw/sbdsp.cpp | 22 ++++++ sw/sbplay.cpp | 18 ++++- sw/sine_wave.cpp | 99 ------------------------ sw/tandyplay.cpp | 18 ++++- sw/usbplay.cpp | 18 +++++ 29 files changed, 390 insertions(+), 304 deletions(-) delete mode 100644 sw/dosboxcompat.h delete mode 100644 sw/sine_wave.cpp diff --git a/README.md b/README.md index ac55955..3913461 100644 --- a/README.md +++ b/README.md @@ -66,4 +66,4 @@ My videos: The hardware portions of this repository (hw/ directory) are licensed under the CERN OHL version 2, permissive. -The software portions of this repository (sw/, pgusinit/ directories) are licensed under the GNU GPL version 2. +The software portions of this repository (sw/, pgusinit/ directories) as a collection are licensed under the GNU GPL version 2. Some files are individually dual-licensed under BSD or MIT licenses – see the license in the file headers for details. diff --git a/pgusinit/pgusinit.c b/pgusinit/pgusinit.c index dab413a..aeacffd 100755 --- a/pgusinit/pgusinit.c +++ b/pgusinit/pgusinit.c @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ #include #include #include diff --git a/sw/clamp.h b/sw/clamp.h index 662f6e8..2a3ee53 100644 --- a/sw/clamp.h +++ b/sw/clamp.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifdef INTERP_CLAMP #include "hardware/interp.h" #endif diff --git a/sw/cmsplay.cpp b/sw/cmsplay.cpp index 659bcf8..e65e1b7 100644 --- a/sw/cmsplay.cpp +++ b/sw/cmsplay.cpp @@ -1,7 +1,19 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +/* + * Copyright (C) 2022-2024 Ian Scott * - * SPDX-License-Identifier: BSD-3-Clause + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/sw/dosbox-x-compat.h b/sw/dosbox-x-compat.h index 2d13b27..25f461e 100644 --- a/sw/dosbox-x-compat.h +++ b/sw/dosbox-x-compat.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2002-2021 The DOSBox Team + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #pragma once #include "pico/platform.h" diff --git a/sw/dosboxcompat.h b/sw/dosboxcompat.h deleted file mode 100644 index e3d3dc2..0000000 --- a/sw/dosboxcompat.h +++ /dev/null @@ -1,177 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -/* - * Bit types - */ -typedef uintptr_t Bitu; -typedef intptr_t Bits; -typedef uint32_t Bit32u; -typedef int32_t Bit32s; -typedef uint16_t Bit16u; -typedef int16_t Bit16s; -typedef uint8_t Bit8u; -typedef int8_t Bit8s; - -/* - * utility - */ -// Signed-only integer division with ceiling -template -inline constexpr T1 ceil_sdivide(const T1 x, const T2 y) noexcept { - static_assert(std::is_signed::value, "First parameter should be signed"); - static_assert(std::is_signed::value, "Second parameter should be signed."); - return x / y + (((x < 0) ^ (y > 0)) && (x % y)); - // https://stackoverflow.com/a/33790603 -} - -// Unsigned-only integer division with ceiling -template -inline constexpr T1 ceil_udivide(const T1 x, const T2 y) noexcept { - static_assert(std::is_unsigned::value, "First parameter should be unsigned"); - static_assert(std::is_unsigned::value, "Second parameter should be unsigned"); - return (x != 0) ? 1 + ((x - 1) / y) : 0; - // https://stackoverflow.com/a/2745086 -} - -// Clamp: given a value that can be compared with the given minimum and maximum -// values, this function will: -// * return the value if it's in-between or equal to either bounds, or -// * return either bound depending on which bound the value is beyond -template T clamp(const T& n, const T& lower, const T& upper) { - return std::max(lower, std::min(n, upper)); -} - -// Raspberry Pi is little endian, no need to swap -constexpr uint16_t le16_to_host(const uint16_t x) -{ - return x; -} - -// Read a uint16 from unaligned 8-bit byte-ordered memory. -static inline uint16_t read_unaligned_uint16(const uint8_t *arr) noexcept -{ - uint16_t val; - memcpy(&val, arr, sizeof(val)); - return val; -} - -// Read a 16-bit word from 8-bit DOS/little-endian byte-ordered memory. -static inline uint16_t host_readw(const uint8_t *arr) noexcept -{ - return le16_to_host(read_unaligned_uint16(arr)); -} - -/* - * logging - */ -#ifdef CIRCLE -#define LOG_MSG(...) m_Logger.Write("Gus", LogNotice, __VA_ARGS__); -#define DEBUG_LOG_MSG(...) m_Logger.Write("Gus", LogDebug, __VA_ARGS__); -#else -#define LOG_MSG(msg, ...) printf(msg "\n", ##__VA_ARGS__); -#define DEBUG_LOG_MSG(msg, ...) printf(msg "\n", ##__VA_ARGS__); -#endif - - -/* - * audio classes - */ -struct AudioFrame { - float left = 0; - float right = 0; -}; -#define MAX_AUDIO ((1<<(16-1))-1) -#define MIN_AUDIO -(1<<(16-1)) - - -/* - * io classes -- not using for now - */ -using io_port_t = uint16_t; // DOS only supports 16-bit port addresses -using io_val_t = uint32_t; // Handling exists up to a dword (or less) -enum class io_width_t : uint8_t { - byte = 1, // bytes - word = 2, // bytes - dword = 4, // bytes -}; -/* -using io_read_f = std::function; -using io_write_f = std::function; - -class IO_Base{ -protected: - bool installed = false; - io_port_t m_port = 0u; - io_width_t m_width = io_width_t::byte; - io_port_t m_range = 0u; -}; - -class IO_ReadHandleObject: private IO_Base{ -public: - void Install(io_port_t port, - io_read_f handler, - io_width_t max_width, - io_port_t range = 1); - - void Uninstall(); - ~IO_ReadHandleObject(); -}; -class IO_WriteHandleObject: private IO_Base{ -public: - void Install(io_port_t port, - io_write_f handler, - io_width_t max_width, - io_port_t range = 1); - - void Uninstall(); - ~IO_WriteHandleObject(); -}; -*/ - -/* - * silly math - */ -#ifdef CIRCLE -#define M_PI 3.14159265358979323846264338327950288 -#endif - -/* - * casting - */ - -// Select the next larger signed integer type -template -using next_int_t = typename std::conditional< - sizeof(T) == sizeof(int8_t), - int16_t, - typename std::conditional::type>::type; - -template -constexpr cast_t check_cast(const check_t in) -{ - // Ensure the two types are integers, can't handle floats/doubles - static_assert(std::numeric_limits::is_integer, - "The casting type must be an integer type"); - static_assert(std::numeric_limits::is_integer, - "The argument must be an integer type"); - - // ensure the inbound value is within the limits of the casting type - assert(static_cast>(in) >= - static_cast>(std::numeric_limits::min())); - assert(static_cast>(in) <= - static_cast>(std::numeric_limits::max())); - - return static_cast(in); -} - -/* - * assert - */ -// Include a message in assert, similar to static_assert: -#define assertm(exp, msg) assert(((void)msg, exp)) diff --git a/sw/flash_settings.c b/sw/flash_settings.c index cd6c687..05a1dd7 100644 --- a/sw/flash_settings.c +++ b/sw/flash_settings.c @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include diff --git a/sw/flash_settings.h b/sw/flash_settings.h index 585fd00..38dd557 100644 --- a/sw/flash_settings.h +++ b/sw/flash_settings.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ #pragma once #ifdef __cplusplus diff --git a/sw/gus-x.cpp b/sw/gus-x.cpp index ce82685..fe69254 100644 --- a/sw/gus-x.cpp +++ b/sw/gus-x.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2002-2021 The DOSBox Team + * Copyright (C) 2022-2024 Ian Scott * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/sw/gusplay.cpp b/sw/gusplay.cpp index 0e3fcee..470415f 100644 --- a/sw/gusplay.cpp +++ b/sw/gusplay.cpp @@ -1,7 +1,19 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +/* + * Copyright (C) 2022-2024 Ian Scott * - * SPDX-License-Identifier: BSD-3-Clause + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/sw/isa_dma.c b/sw/isa_dma.c index 36d58b3..e5dd650 100644 --- a/sw/isa_dma.c +++ b/sw/isa_dma.c @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "isa_dma.h" dma_inst_t DMA_init(PIO pio, uint sm, irq_handler_t dma_isr) { diff --git a/sw/isa_dma.h b/sw/isa_dma.h index fb56d20..b292e1c 100644 --- a/sw/isa_dma.h +++ b/sw/isa_dma.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #pragma once #include diff --git a/sw/isa_dma.pio b/sw/isa_dma.pio index 9611d66..9b3903e 100644 --- a/sw/isa_dma.pio +++ b/sw/isa_dma.pio @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + .define public AD0_PIN 6 .define public IRQ_PIN 21 .define public IOW_PIN 4 diff --git a/sw/isa_io.pio b/sw/isa_io.pio index a9c17dc..5151a5c 100644 --- a/sw/isa_io.pio +++ b/sw/isa_io.pio @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + .define public AD0_PIN 6 .define public IRQ_PIN 21 .define public IOW_PIN 4 diff --git a/sw/mpu401/export.h b/sw/mpu401/export.h index d411d47..a995770 100755 --- a/sw/mpu401/export.h +++ b/sw/mpu401/export.h @@ -2,6 +2,7 @@ * Copyright (C) 2002-2012 The DOSBox Team * Copyright (C) 2013-2014 bjt, elianda * Copyright (C) 2015 ab0tj + * Copyright (C) 2023-2024 Ian Scott * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/sw/mpu401/midi.c b/sw/mpu401/midi.c index 6ab4987..39a0993 100755 --- a/sw/mpu401/midi.c +++ b/sw/mpu401/midi.c @@ -2,6 +2,7 @@ * Copyright (C) 2002-2013 The DOSBox Team * Copyright (C) 2013-2014 bjt, elianda * Copyright (C) 2015 ab0tj + * Copyright (C) 2023-2024 Ian Scott * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/sw/mpu401/mpu401.c b/sw/mpu401/mpu401.c index 078d896..2453b90 100755 --- a/sw/mpu401/mpu401.c +++ b/sw/mpu401/mpu401.c @@ -2,6 +2,7 @@ * Copyright (C) 2002-2012 The DOSBox Team * Copyright (C) 2013-2014 bjt, elianda * Copyright (C) 2015 ab0tj + * Copyright (C) 2023-2024 Ian Scott * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/sw/mpuplay.cpp b/sw/mpuplay.cpp index ba1b180..d50130d 100644 --- a/sw/mpuplay.cpp +++ b/sw/mpuplay.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include "flash_settings.h" diff --git a/sw/ne2000play.cpp b/sw/ne2000play.cpp index c85ad40..061fa31 100644 --- a/sw/ne2000play.cpp +++ b/sw/ne2000play.cpp @@ -1,7 +1,20 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +/* + * Copyright (C) 2022-2024 Ian Scott + * Copyright (C) 2024 Kevin Moonlight * - * SPDX-License-Identifier: BSD-3-Clause + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/sw/pico_pic.c b/sw/pico_pic.c index 37396de..aa19894 100644 --- a/sw/pico_pic.c +++ b/sw/pico_pic.c @@ -1,15 +1,27 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "pico_pic.h" #include "pico/time.h" #include -// A fixed pool of multiple events. -// gus-x has 3 different timer events - two timers and one DMA -// 8250uart has 3 -// mpu401 has 3 -// SB has 1 - alarm_pool_t* alarm_pool; int64_t PIC_HandleEvent(alarm_id_t id, void *user_data) { diff --git a/sw/pico_pic.h b/sw/pico_pic.h index 556e54b..1bba38e 100644 --- a/sw/pico_pic.h +++ b/sw/pico_pic.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #pragma once #include @@ -5,11 +23,7 @@ #include "pico/time.h" #include "hardware/gpio.h" -#ifdef DOSBOX_STAGING -#include "dosboxcompat.h" -#else #include "dosbox-x-compat.h" -#endif #define IRQ_PIN 21 // TODO don't spread around pin definitions like this @@ -39,8 +53,6 @@ static __force_inline void PIC_DeActivateIRQ(void) { gpio_put(IRQ_PIN, 0); } -// void PIC_AddEvent(PIC_EventHandler handler, uint32_t delay, Bitu val=0); - static __force_inline void PIC_AddEvent(PIC_TimerEvent* event, uint32_t delay, Bitu val) { // event->handler = handler; event->value = val; diff --git a/sw/pico_reflash.c b/sw/pico_reflash.c index d87e896..dbb41f6 100644 --- a/sw/pico_reflash.c +++ b/sw/pico_reflash.c @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "pico_reflash.h" #include diff --git a/sw/pico_reflash.h b/sw/pico_reflash.h index 6fc6cff..58d3f3d 100644 --- a/sw/pico_reflash.h +++ b/sw/pico_reflash.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #pragma once #ifdef __cplusplus diff --git a/sw/picogus.cpp b/sw/picogus.cpp index 27e09e2..16b5f82 100644 --- a/sw/picogus.cpp +++ b/sw/picogus.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include #include "pico/stdlib.h" diff --git a/sw/sbdsp.cpp b/sw/sbdsp.cpp index 9c65b49..7fc6bf2 100644 --- a/sw/sbdsp.cpp +++ b/sw/sbdsp.cpp @@ -9,6 +9,28 @@ Title : SoundBlaster DSP Emulation Date : 2023-12-30 Author : Kevin Moonlight +Copyright (C) 2023 Kevin Moonlight +Copyright (C) 2024 Ian Scott + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +SPDX-License-Identifier: MIT */ extern uint LED_PIN; diff --git a/sw/sbplay.cpp b/sw/sbplay.cpp index f7cc167..5ad450d 100644 --- a/sw/sbplay.cpp +++ b/sw/sbplay.cpp @@ -1,7 +1,19 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * SPDX-License-Identifier: BSD-3-Clause + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/sw/sine_wave.cpp b/sw/sine_wave.cpp deleted file mode 100644 index 1426e63..0000000 --- a/sw/sine_wave.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -#if PICO_ON_DEVICE - -#include "hardware/clocks.h" -#include "hardware/structs/clocks.h" - -#endif - -#include "pico/stdlib.h" - -#include "pico/audio_i2s.h" - -#if PICO_ON_DEVICE -#include "pico/binary_info.h" -bi_decl(bi_3pins_with_names(PICO_AUDIO_I2S_DATA_PIN, "I2S DIN", PICO_AUDIO_I2S_CLOCK_PIN_BASE, "I2S BCK", PICO_AUDIO_I2S_CLOCK_PIN_BASE+1, "I2S LRCK")); -#endif - -#define SINE_WAVE_TABLE_LEN 2048 -#define SAMPLES_PER_BUFFER 256 - -static int16_t sine_wave_table[SINE_WAVE_TABLE_LEN]; - -struct audio_buffer_pool *init_audio() { - - static audio_format_t audio_format = { - .sample_freq = 44100, - //.sample_freq = 24000, - .format = AUDIO_BUFFER_FORMAT_PCM_S16, - .channel_count = 1, - }; - - static struct audio_buffer_format producer_format = { - .format = &audio_format, - .sample_stride = 2 - }; - - struct audio_buffer_pool *producer_pool = audio_new_producer_pool(&producer_format, 3, - SAMPLES_PER_BUFFER); // todo correct size - bool __unused ok; - const struct audio_format *output_format; - struct audio_i2s_config config = { - .data_pin = PICO_AUDIO_I2S_DATA_PIN, - .clock_pin_base = PICO_AUDIO_I2S_CLOCK_PIN_BASE, - .dma_channel = 0, - .pio_sm = 0, - }; - - output_format = audio_i2s_setup(&audio_format, &config); - if (!output_format) { - panic("PicoAudio: Unable to open audio device.\n"); - } - - ok = audio_i2s_connect(producer_pool); - assert(ok); - audio_i2s_set_enabled(true); - return producer_pool; -} - -void play_sine() { - puts("starting core 1"); - for (int i = 0; i < SINE_WAVE_TABLE_LEN; i++) { - sine_wave_table[i] = 32767 * cosf(i * 2 * (float) (M_PI / SINE_WAVE_TABLE_LEN)); - } - - struct audio_buffer_pool *ap = init_audio(); - uint32_t step = 0x200000; - uint32_t pos = 0; - uint32_t pos_max = 0x10000 * SINE_WAVE_TABLE_LEN; - uint vol = 128; - while (true) { - int c = getchar_timeout_us(0); - if (c >= 0) { - if (c == '-' && vol) vol -= 4; - if ((c == '=' || c == '+') && vol < 255) vol += 4; - if (c == '[' && step > 0x10000) step -= 0x10000; - if (c == ']' && step < (SINE_WAVE_TABLE_LEN / 16) * 0x20000) step += 0x10000; - if (c == 'q') break; - printf("vol = %d, step = %d \r", vol, step >> 16); - } - struct audio_buffer *buffer = take_audio_buffer(ap, true); - int16_t *samples = (int16_t *) buffer->buffer->bytes; - for (uint i = 0; i < buffer->max_sample_count; i++) { - samples[i] = (vol * sine_wave_table[pos >> 16u]) >> 8u; - pos += step; - if (pos >= pos_max) pos -= pos_max; - } - buffer->sample_count = buffer->max_sample_count; - give_audio_buffer(ap, buffer); - } - puts("\n"); -} diff --git a/sw/tandyplay.cpp b/sw/tandyplay.cpp index 40b1e51..7972f5b 100644 --- a/sw/tandyplay.cpp +++ b/sw/tandyplay.cpp @@ -1,7 +1,19 @@ -/** - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +/* + * Copyright (C) 2022-2024 Ian Scott * - * SPDX-License-Identifier: BSD-3-Clause + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include diff --git a/sw/usbplay.cpp b/sw/usbplay.cpp index 2060933..fb671ef 100644 --- a/sw/usbplay.cpp +++ b/sw/usbplay.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2022-2024 Ian Scott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include "pico/flash.h"