From d9fad446dd122a219bf47f1ec3e9d72453505c9d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 15 Jul 2015 13:11:22 -0500 Subject: [PATCH] started the porting of the adlib tracker playback system modified: makefile modified: src/lib/16_snd.c modified: src/lib/16_snd.h --- makefile | 5 +++- src/lib/16_snd.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/16_snd.h | 8 +++++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 4ba3f024..90b48240 100644 --- a/makefile +++ b/makefile @@ -22,7 +22,7 @@ JSMNLIB=$(SRCLIB)jsmn$(DIRSEP) EXMMLIB=$(SRCLIB)exmm$(DIRSEP) WCPULIB=$(SRCLIB)wcpu$(DIRSEP) -16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) scroll16.$(OBJ) 16_ca.$(OBJ) +16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) scroll16.$(OBJ) 16_ca.$(OBJ) 16_snd.$(OBJ) GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) all: 16.exe test.exe pcxtest.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe inputest.exe exmmtest.exe fonttes0.exe fontgfx.exe @@ -172,6 +172,9 @@ mapread.$(OBJ): $(SRCLIB)mapread.h $(SRCLIB)mapread.c 16.lib 16_ca.$(OBJ): $(SRCLIB)16_ca.h $(SRCLIB)16_ca.c wcl $(FLAGS) -c $(SRCLIB)16_ca.c +16_snd.$(OBJ): $(SRCLIB)16_snd.h $(SRCLIB)16_snd.c + wcl $(FLAGS) -c $(SRCLIB)16_snd.c + 16_head.$(OBJ): $(SRCLIB)16_head.h $(SRCLIB)16_head.c wcl $(FLAGS) -c $(SRCLIB)16_head.c diff --git a/src/lib/16_snd.c b/src/lib/16_snd.c index 7e6b6444..5ade6445 100644 --- a/src/lib/16_snd.c +++ b/src/lib/16_snd.c @@ -12,6 +12,7 @@ * 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. + * 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 , or @@ -19,3 +20,68 @@ * Fifth Floor, Boston, MA 02110-1301 USA. * */ + +#include "src/lib/16_snd.h" + +void opl2out(word data, word reg) +{ + __asm + { + mov ax,reg + mov dx,word ptr [OPLPORT] + or ah,ah + jz @@1 + add dx,2 +@@1: out dx,al + mov cx,6 +@@2: in al,dx + loop @@2 + inc dl + mov ax,data + out dx,al + dec dl + mov cx,36 +@@3: in al,dx + loop @@3 + } +} + +void opl3out(word data, word reg) +{ + __asm + { + mov ax,reg + mov dx,word ptr [OPLPORT] + or ah,ah + jz @@1 + add dx,2 +@@1: out dx,al + inc dl + mov ax,data + out dx,al + dec dl + mov cx,26 +@@2: in al,dx + loop @@2 + } +} + +void opl3exp(word data) +{ + __asm + { + mov ax,data + mov dx,word ptr [OPLPORT] + add dx,2 + out dx,al + mov cx,6 +@@1: in al,dx + loop @@1 + inc dl + mov al,ah + out dx,al + mov cx,36 +@@2: in al,dx + loop @@2 + } +} \ No newline at end of file diff --git a/src/lib/16_snd.h b/src/lib/16_snd.h index 6abbe5d3..3f752949 100644 --- a/src/lib/16_snd.h +++ b/src/lib/16_snd.h @@ -25,4 +25,10 @@ #include "src/lib/16_head.h" -#endif /*__16_SND_H_*/ \ No newline at end of file +#define OPLPORT 388 + +void opl2out(word data, word reg); +void opl3out(word data, word reg); +void opl3exp(word data); + +#endif /*__16_SND_H_*/ -- 2.39.5