From 96cfa49038b522c12f53bc49bde7b66f00096f77 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 19 Apr 2017 09:36:14 -0500 Subject: [PATCH] p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I should remember what needs to be done soon][OpenVGMFile needs to be ported to 16_snd.c]going to port rest of code to borland c some time so we can use the core components of id engine here [going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] sd extended --- src/imfplay.c | 6 +- src/lib/16_ca.c | 147 ++++++++++++++++++++++----------------- src/lib/16_head.h | 2 +- src/lib/16_sd.c | 10 +-- src/lib/16_sd.h | 4 +- src/lib/doslib | 2 +- src/util/shbat/wbuild.sh | 11 +-- wbuild.sh | 11 +-- 8 files changed, 112 insertions(+), 81 deletions(-) diff --git a/src/imfplay.c b/src/imfplay.c index 415bcfb8..169ff8b5 100755 --- a/src/imfplay.c +++ b/src/imfplay.c @@ -31,9 +31,9 @@ // #include // #include // #include -struct glob_game_vars *ggvv; -static void (interrupt *old_irq0)(); +extern struct glob_game_vars *ggvv; + /*static void (interrupt *old_irq0)(); static volatile unsigned long irq0_ticks=0; static volatile unsigned int irq0_cnt=0,irq0_add=0,irq0_max=0; @@ -111,6 +111,7 @@ int imf_load_music(const char *path, global_game_variables_t *gvar) { return 1; } */ +#ifndef LIBIRQ0 // WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models void interrupt irq0() { @@ -123,6 +124,7 @@ void interrupt irq0() p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); } } +#endif /* void imf_tick() { if (imf_delay_countdown == 0) { diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 31339b41..fad1a012 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1435,7 +1435,8 @@ cachein: //=========================================================================== -//++++#if GRMODE == EGAGR +//????#if GRMODE == EGAGR +#if 0 /* ====================== @@ -1446,7 +1447,7 @@ cachein: = ====================== */ -/*++++ + unsigned static sheight,swidth; boolean static dothemask; @@ -1458,92 +1459,114 @@ void CAL_ShiftSprite (unsigned segment,unsigned source,unsigned dest, swidth = width; dothemask = domask; -asm mov ax,[segment] -asm mov ds,ax // source and dest are in same segment, and all local + __asm { + mov ax,[segment] + mov ds,ax // source and dest are in same segment, and all local -asm mov bx,[source] -asm mov di,[dest] + mov bx,[source] + mov di,[dest] -asm mov bp,[pixshift] -asm shl bp,1 -asm mov bp,WORD PTR [shifttabletable+bp] // bp holds pointer to shift table + mov bp,[pixshift] + shl bp,1 + mov bp,WORD PTR [shifttabletable+bp] // bp holds pointer to shift table -asm cmp [ss:dothemask],0 -asm je skipmask + cmp [ss:dothemask],0 + je skipmask // // table shift the mask // -asm mov dx,[ss:sheight] - + mov dx,[ss:sheight] +#ifdef __BORLANDC__ + } +#endif domaskrow: - -asm mov BYTE PTR [di],255 // 0xff first byte -asm mov cx,ss:[swidth] - +#ifdef __BORLANDC__ + __asm { +#endif + mov BYTE PTR [di],255 // 0xff first byte + mov cx,ss:[swidth] +#ifdef __BORLANDC__ + } +#endif domaskbyte: - -asm mov al,[bx] // source -asm not al -asm inc bx // next source byte -asm xor ah,ah -asm shl ax,1 -asm mov si,ax -asm mov ax,[bp+si] // table shift into two bytes -asm not ax -asm and [di],al // and with first byte -asm inc di -asm mov [di],ah // replace next byte - -asm loop domaskbyte - -asm inc di // the last shifted byte has 1s in it -asm dec dx -asm jnz domaskrow - +#ifdef __BORLANDC__ + __asm { +#endif + mov al,[bx] // source + not al + inc bx // next source byte + xor ah,ah + shl ax,1 + mov si,ax + mov ax,[bp+si] // table shift into two bytes + not ax + and [di],al // and with first byte + inc di + mov [di],ah // replace next byte + + loop domaskbyte + + inc di // the last shifted byte has 1s in it + dec dx + jnz domaskrow +#ifdef __BORLANDC__ + } +#endif skipmask: - +#ifdef __BORLANDC__ + __asm { +#endif // // table shift the data // -asm mov dx,ss:[sheight] -asm shl dx,1 -asm shl dx,1 // four planes of data - + mov dx,ss:[sheight] + shl dx,1 + shl dx,1 // four planes of data +#ifdef __BORLANDC__ + } +#endif dodatarow: - -asm mov BYTE PTR [di],0 // 0 first byte -asm mov cx,ss:[swidth] - +#ifdef __BORLANDC__ + __asm { +#endif + mov BYTE PTR [di],0 // 0 first byte + mov cx,ss:[swidth] +#ifdef __BORLANDC__ + } +#endif dodatabyte: +#ifdef __BORLANDC__ + __asm { +#endif + mov al,[bx] // source + inc bx // next source byte + xor ah,ah + shl ax,1 + mov si,ax + mov ax,[bp+si] // table shift into two bytes + or [di],al // or with first byte + inc di + mov [di],ah // replace next byte -asm mov al,[bx] // source -asm inc bx // next source byte -asm xor ah,ah -asm shl ax,1 -asm mov si,ax -asm mov ax,[bp+si] // table shift into two bytes -asm or [di],al // or with first byte -asm inc di -asm mov [di],ah // replace next byte - -asm loop dodatabyte + loop dodatabyte -asm inc di // the last shifted byte has 0s in it -asm dec dx -asm jnz dodatarow + inc di // the last shifted byte has 0s in it + dec dx + jnz dodatarow // // done // -asm mov ax,ss // restore data segment -asm mov ds,ax + mov ax,ss // restore data segment + mov ds,ax + } } #endif -*/ + //=========================================================================== /* diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 6f6f7885..adea8fff 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -33,7 +33,7 @@ #include #include #include -#include // just for wait +#include // this is where Open Watcom hides the outp() etc. functions // just for wait #include // just for wait #include #include diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index a058a320..7e16839a 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -23,7 +23,7 @@ #include "src/lib/16_sd.h" //static void (interrupt *old_irq0)(); -extern struct glob_game_vars *ggvv; +void interrupt (*old_irq0)(void); void opl2out(word reg, word data) { @@ -196,7 +196,6 @@ void FMSetVoice(int voiceNum, FMInstrument *ins){ opl2out(opCellNum, ins->Feedback); } /* End of FMSetVoice */ - void SD_Initimf(global_game_variables_t *gvar) { if (!init_adlib()) { @@ -271,8 +270,10 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar) return 1; } +#ifdef LIBIRQ0 +struct glob_game_vars *ggvv; // WARNING: subroutine call in interrupt handler. make sure you compile with -zu flag for large/compact memory models -/*void interrupt irq0() +void interrupt irq0() { ggvv->ca.sd.irq0_ticks++; if ((ggvv->ca.sd.irq0_cnt += ggvv->ca.sd.irq0_add) >= ggvv->ca.sd.irq0_max) { @@ -282,7 +283,8 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar) else { p8259_OCW2(0,P8259_OCW2_NON_SPECIFIC_EOI); } -}*/ +} +#endif void SD_imf_tick(global_game_variables_t *gvar) { diff --git a/src/lib/16_sd.h b/src/lib/16_sd.h index 611982f5..3690fe36 100755 --- a/src/lib/16_sd.h +++ b/src/lib/16_sd.h @@ -34,6 +34,7 @@ #define MAX_REGISTER 0xF5 #define ADLIB_FM_ADDRESS 0x388 /* adlib address/status register */ #define ADLIB_FM_DATA 0x389 /* adlib data register */ +#define LIBIRQ0 /* * FM Instrument definition for .SBI files - SoundBlaster instrument @@ -51,6 +52,7 @@ typedef struct{ byte Feedback; /* feedback algorithm and strength */ } FMInstrument; +extern void interrupt (*old_irq0)(void); void opl2out(word reg, word data); void opl3out(word reg, word data); @@ -64,7 +66,7 @@ void FMSetVoice(int voiceNum, FMInstrument *ins); void SD_Initimf(global_game_variables_t *gvar); void SD_imf_free_music(global_game_variables_t *gvar); int SD_imf_load_music(const char *path, global_game_variables_t *gvar); -//void interrupt irq0(global_game_variables_t *gvar); +void interrupt irq0(void); void SD_imf_tick(global_game_variables_t *gvar); void SD_adlib_shut_up(); diff --git a/src/lib/doslib b/src/lib/doslib index 2388e6cd..45e96424 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 2388e6cde6d3bda5bb253198a853506e4f27d0bd +Subproject commit 45e9642437301420932de3c8ebdd4a920ead57ce diff --git a/src/util/shbat/wbuild.sh b/src/util/shbat/wbuild.sh index cd0d1f3e..00e3ed4e 100755 --- a/src/util/shbat/wbuild.sh +++ b/src/util/shbat/wbuild.sh @@ -1,15 +1,16 @@ #! /bin/bash -wmake -s -h clean -wmake -s -h -wmake -s -h comp +pee="-h" +wmake -s "$pee" clean +wmake -s "$pee" +wmake -s "$pee" comp #if [[ -f *.err ]] #then # echo dumping *.err #cat *.err - wmake -s -h vomitchan + wmake -s "$pee" vomitchan #fi #if [ -f 16_head.o ] #then # rm *.o #fi -####wmake -s -h inntest.exe +####wmake $pee inntest.exe diff --git a/wbuild.sh b/wbuild.sh index cd0d1f3e..00e3ed4e 100755 --- a/wbuild.sh +++ b/wbuild.sh @@ -1,15 +1,16 @@ #! /bin/bash -wmake -s -h clean -wmake -s -h -wmake -s -h comp +pee="-h" +wmake -s "$pee" clean +wmake -s "$pee" +wmake -s "$pee" comp #if [[ -f *.err ]] #then # echo dumping *.err #cat *.err - wmake -s -h vomitchan + wmake -s "$pee" vomitchan #fi #if [ -f 16_head.o ] #then # rm *.o #fi -####wmake -s -h inntest.exe +####wmake $pee inntest.exe -- 2.39.2