From 95e87a58929e29e1606c888298d6d02d2a52d500 Mon Sep 17 00:00:00 2001 From: "LGB (Gabor Lenart)" Date: Mon, 4 Mar 2024 20:18:58 +0100 Subject: [PATCH 1/4] MEGA65: DMA audio stop + 16 bit samples #398 DMA audio stop (or loop) conidition is checked against the limit after incrementing the address. However in case of 16 bit samples it can happen that it skips the limit, if the limit is odd and start address is even or vice versa. Reported by @dansanderson --- targets/mega65/audio65.c | 10 ++++++++-- targets/mega65/audio65.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/targets/mega65/audio65.c b/targets/mega65/audio65.c index 7c536f80..9448a92d 100644 --- a/targets/mega65/audio65.c +++ b/targets/mega65/audio65.c @@ -1,6 +1,6 @@ /* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu - Copyright (C)2016-2021 LGB (Gábor Lénárt) + Copyright (C)2016-2024 LGB (Gábor Lénárt) 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 @@ -191,7 +191,13 @@ static inline void render_dma_audio ( int channel, Sint16 *buffer, int len ) // the final sample value, correcting with the sound setting (FIXME: I am really not sure, if volume is supposed to be linear ...) sample[channel] = ((int)signed_sample * chio[9]) / 0xFF; // volume control (max volume is $FF) } - if (XEMU_UNLIKELY((addr & 0xFFFF) == limit)) { + if (XEMU_UNLIKELY( + ((addr & 0xFFFFU) == limit) // limit reached + || ( // OR ... + (chio[0] & 3) == 3 && // ... 16 bit sample + ((addr - 1) & 0xFFFFU) == limit // ... and the limit was the previous byte (as with 16 bit samples we would miss the limit if not aligned!) + ) + )) { // if top address is reached: either stop, or loop (on looped samples only!) if ((chio[0] & 0x40)) { addr = chio[1] + (chio[2] << 8) + (chio[3] << 16); // looping, set address to the begin address diff --git a/targets/mega65/audio65.h b/targets/mega65/audio65.h index d4764f97..6d9fc751 100644 --- a/targets/mega65/audio65.h +++ b/targets/mega65/audio65.h @@ -1,6 +1,6 @@ /* A work-in-progess MEGA65 (Commodore-65 clone origins) emulator Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu - Copyright (C)2016-2021 LGB (Gábor Lénárt) + Copyright (C)2016-2024 LGB (Gábor Lénárt) 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 From 775c87f5e5410d3e9b4ecd2a4ea1ca5e146158ed Mon Sep 17 00:00:00 2001 From: "LGB (Gabor Lenart)" Date: Sun, 24 Mar 2024 23:22:43 +0100 Subject: [PATCH 2/4] MEGA65: fix RRB rowmask reset RRB rowmask was implemented in #363 by me. However it seems, there is one important fact I missed: to clear RRB when it's not asked in case of a "GotoX token". Reported/suggested by RetroCogs. --- targets/mega65/vic4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/targets/mega65/vic4.c b/targets/mega65/vic4.c index 5be62e72..5ed8152f 100644 --- a/targets/mega65/vic4.c +++ b/targets/mega65/vic4.c @@ -1,6 +1,6 @@ /* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu - Copyright (C)2016-2023 LGB (Gábor Lénárt) + Copyright (C)2016-2024 LGB (Gábor Lénárt) Copyright (C)2020-2022 Hernán Di Pietro This program is free software; you can redistribute it and/or modify @@ -1443,6 +1443,8 @@ static XEMU_INLINE void vic4_render_char_raster ( void ) used_palette = palette; // we do this as well, since there can be "double GOTOX" so we want back to "original" palette ... if (SXA_4BIT_PER_PIXEL(color_data)) // this signals for rowmask [the rowmask itself is color_data & 0xFF] draw_mask = (color_data & (1 << char_row)) ? 0xFF : 0x00; // draw_mask is $FF (not masked) _or_ $00 (masked) ~ for the current char_row! + else + draw_mask = 0xFF; continue; } } From d96aaeb131299f274f277e81c613dd99a9004894 Mon Sep 17 00:00:00 2001 From: "LGB (Gabor Lenart)" Date: Sun, 24 Mar 2024 23:25:40 +0100 Subject: [PATCH 3/4] BUILD: use newer ubuntu LTS on Travis CI Travis has problems in the past with Ubuntu 20.04. I've issued a bug report, and for a while no successfull builds could be done, so I used Ubuntu 18.04 for a long time. Now it seems my bug report was addressed by Travis, and it works now. It means that a newer mingw compiler is used to produce Windows builds, which hopefully means a bit better emulation performance on Windows. Or not ... ;) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 41307f44..d6ca3717 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: focal +dist: jammy sudo: required language: c From 089ad07bda055c027ce5a2bbe3280ddd99a25442 Mon Sep 17 00:00:00 2001 From: "LGB (Gabor Lenart)" Date: Sat, 11 May 2024 22:12:52 +0200 Subject: [PATCH 4/4] BUILD: do not test grep -o on non-Linux #396 configure tests for working `grep` utility for building, however it seems some systems (it seems NetBSD in particular) have problems with the `-o` switch combined with others. As the `-o` is only used for real at Linux hosts, let's not test `-o` if the build system is not Linux. Reported by @Rhialto --- build/configure/Makefile | 1 + build/configure/configure | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/build/configure/Makefile b/build/configure/Makefile index fb9e9e15..0c7ff1fd 100644 --- a/build/configure/Makefile +++ b/build/configure/Makefile @@ -1,2 +1,3 @@ all: + @if [ "$(ARCH)" = "" ]; then echo "You must invoke make with ARCH set." ; exit 1 ; fi bash ./configure --arch=$(ARCH) diff --git a/build/configure/configure b/build/configure/configure index cc5ab6f6..0d084ff4 100755 --- a/build/configure/configure +++ b/build/configure/configure @@ -2,7 +2,7 @@ ## This file is part of the Xemu project: https://github.com/lgblgblgb/xemu ## Collection of various emulators of some 8 bits machines using SDL2 library. ## -## Copyright (C)2016-2023 LGB (Gábor Lénárt) +## Copyright (C)2016-2024 LGB (Gábor Lénárt) # # 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 @@ -30,12 +30,27 @@ export LANG LC_TIME echo -n "Testing needed UNIX tools for the build: " -echo -n "grep " -if [ "`echo 'alma,korte,banan' | grep -oEia ',K[^,]+,'`" != ",korte," ]; then +echo -n "uname " +if [ "`uname -a`" = "" ]; then echo - echo "FATAL: UNIX utility 'grep' does not seem to work or cannot be found" >&2 + echo "FATAL: UNIX utility 'uname' does not seem to work or cannot be found" >&2 exit 1 fi +if [ "`uname`" != "Linux" ]; then + echo -n "grep[-Eia] " + if [ "`echo 'alma,korte,banan' | grep -Eia ',K[^,]+,'`" != "alma,korte,banan" ]; then + echo + echo "FATAL: UNIX utility 'grep' does not seem to work (grep -Eia) or cannot be found" >&2 + exit 1 + fi +else + echo -n "grep[-oEia] " + if [ "`echo 'alma,korte,banan' | grep -oEia ',K[^,]+,'`" != ",korte," ]; then + echo + echo "FATAL: UNIX utility 'grep' does not seem to work (grep -oEia) or cannot be found" >&2 + exit 1 + fi +fi echo -n "sed " if [ "`echo "testSTRSTRing" | sed -nE 's/(STR)/_\1/gp'`" != "test_STR_STRing" ]; then echo @@ -71,12 +86,6 @@ if [ "`pwd`" = "" ]; then echo "FATAL: UNIX utility 'pwd' does not seem to work or cannot be found" >&2 exit 1 fi -echo -n "uname " -if [ "`uname -a`" = "" ]; then - echo - echo "FATAL: UNIX utility 'uname' does not seem to work or cannot be found" >&2 - exit 1 -fi echo -n "date " if [ "`date`" = "" ]; then echo