Hi,

dosbox-x-2024.03.01 uses esfmu-v1.2 (https://github.com/Kagamiin/ESFMu)
library and it could not build on i386.

Current version of esfmu (v1.2.6) has fixed and I added necessary diff
to build dosbox-x-2024.03.01 port.

(simply picked https://github.com/Kagamiin/ESFMu/compare/0311b0d..0994f3e)

ok?

-- 
SASANO Takayoshi (JG1UAA) <u...@mx5.nisiq.net>

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/dosbox-x/Makefile,v
diff -u -p -r1.4 Makefile
--- Makefile    20 Apr 2024 19:21:56 -0000      1.4
+++ Makefile    28 Apr 2024 00:22:34 -0000
@@ -3,7 +3,7 @@ COMMENT=        x86 with DOS emulator targeted 
 VERSION=       2024.03.01
 DISTNAME=      dosbox-x-v${VERSION}
 PKGNAME=       dosbox-x-${VERSION}
-REVISION=      0
+REVISION=      1
 CATEGORIES=    games x11 emulators
 
 GH_ACCOUNT=    joncampbell123
Index: patches/patch-src_hardware_esfmu_esfm_c
===================================================================
RCS file: patches/patch-src_hardware_esfmu_esfm_c
diff -N patches/patch-src_hardware_esfmu_esfm_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_hardware_esfmu_esfm_c     28 Apr 2024 00:22:34 -0000
@@ -0,0 +1,53 @@
+--- src/hardware/esfmu/esfm.c.orig     Sat Mar  2 07:57:03 2024
++++ src/hardware/esfmu/esfm.c  Sun Apr 28 09:17:57 2024
+@@ -1779,7 +1779,7 @@ ESFM_process_feedback(esfm_chip *chip)
+                       eg_output = slot->in.eg_output;
+ 
+                       // ASM optimizaions!
+-#if defined(__GNUC__) && defined(__x86_64__)
++#if defined(__GNUC__) && defined(__x86_64__) && 
!defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
+                       asm (
+                               "movzbq  %[wave], %%r8               \n\t"
+                               "shll    $11, %%r8d                  \n\t"
+@@ -1844,11 +1844,14 @@ ESFM_process_feedback(esfm_chip *chip)
+                                 [exprom] "m"   (exprom)
+                               : "cc", "ax", "bx", "cx", "dx", "r8", "r9", 
"r10", "r11"
+                       );
+-#elif defined(__GNUC__) && defined(__i386__)
++#elif defined(__GNUC__) && defined(__i386__) && 
!defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
++                      size_t logsinrom_addr = (size_t)logsinrom;
++                      size_t exprom_addr = (size_t)exprom;
++
+                       asm (
+                               "movzbl  %b[wave], %%eax             \n\t"
+                               "shll    $11, %%eax                  \n\t"
+-                              "leal    %[sinrom], %%edi            \n\t"
++                              "movl    %[sinrom], %%edi            \n\t"
+                               "addl    %%eax, %%edi                \n\t"
+                               "shlw    $3, %[eg_out]               \n\t"
+                               "xorl    %[out], %[out]              \n\t"
+@@ -1883,7 +1886,7 @@ ESFM_process_feedback(esfm_chip *chip)
+                               // wave_out = exprom[level & 0xff] >> (level >> 
8);
+                               "movb    %%ah, %%cl                  \n\t"
+                               "movzbl  %%al, %%eax                 \n\t"
+-                              "leal    %[exprom], %[out]           \n\t"
++                              "movl    %[exprom], %[out]           \n\t"
+                               "movzwl  (%[out], %%eax, 2), %[out]  \n\t"
+                               "shrl    %%cl, %[out]                \n\t"
+                               // if (lookup & 0x8000) wave_out = -wave_out;
+@@ -1905,12 +1908,12 @@ ESFM_process_feedback(esfm_chip *chip)
+                               : [p_off]  "m"   (phase_offset),
+                                 [mod_in] "m"   (mod_in_shift),
+                                 [wave]   "m"   (waveform),
+-                                [sinrom] "m"   (logsinrom),
+-                                [exprom] "m"   (exprom),
++                                [sinrom] "m"   (logsinrom_addr),
++                                [exprom] "m"   (exprom_addr),
+                                 [i]      "m"   (iter_counter)
+                               : "cc", "ax", "bx", "cx", "di"
+                       );
+-#elif defined(__GNUC__) && defined(__arm__)
++#elif defined(__GNUC__) && defined(__arm__) && 
!defined(_ESFMU_DISABLE_ASM_OPTIMIZATIONS)
+                       asm (
+                               "movs    r3, #0                     \n\t"
+                               "movs    %[out], #0                 \n\t"

Reply via email to