From: John Tsiombikas Date: Sat, 10 Nov 2018 14:38:50 +0000 (+0200) Subject: works in dosbox X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dos_sbtest;a=commitdiff_plain;h=d08178b30de9363c1fda1de3499f541faf520924 works in dosbox --- diff --git a/src/au_sb.c b/src/au_sb.c index 8ff4ea1..2046f91 100644 --- a/src/au_sb.c +++ b/src/au_sb.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "audio.h" #include "au_sb.h" #include "dma.h" @@ -175,14 +176,19 @@ void sb_start(int rate, int nchan) _go32_dpmi_seginfo intr; if(!buffer) { + __djgpp_nearptr_enable(); + /* allocate a 64k-aligned 64k buffer in low memory */ if((seg = __dpmi_allocate_dos_memory(65536 * 2 / 16, &pmsel)) <= 0) { fprintf(stderr, "sb_start: failed to allocate DMA buffer\n"); return; } + printf("allocated seg: %d, addr: %lx\n", seg, (unsigned long)seg << 4); + addr = ((uint32_t)(seg << 4) + 0xffff) & 0xffff0000; - buffer = (void*)addr; + printf("aligned: %lx\n", (unsigned long)addr); + buffer = (void*)(addr - __djgpp_base_address); } else { addr = (uint32_t)buffer; } diff --git a/src/audio.c b/src/audio.c index 49b8a8d..d783559 100644 --- a/src/audio.c +++ b/src/audio.c @@ -1,20 +1,3 @@ -/* -pcboot - bootable PC demo/game kernel -Copyright (C) 2018 John Tsiombikas - -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 3 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, see . -*/ #include #include "audio.h" #include "au_sb.h" diff --git a/src/main.c b/src/main.c index fd87b7a..1e32b61 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include #include +#include #include "audio.h" static int au_callback(void *buffer, int size, void *cls); @@ -21,23 +22,6 @@ int main(int argc, char **argv) /* snd_click_size is < 65536 so we can just throw it all at once in there */ static int au_callback(void *buffer, int size, void *cls) { - int i; - signed char *ptr = buffer; - signed char *src = snd_click; - /* - for(i=0; i