From: sparky4 Date: Sat, 12 Sep 2015 17:47:41 +0000 (-0500) Subject: VICTORY IS MINE!!!! WWWW X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=01e6a54bfa71fd6b159146f30c405ca045e5fbdd;p=16.git VICTORY IS MINE!!!! WWWW modified: exmmtest.map modified: scroll.map modified: src/lib/vgmsnd/common.h modified: src/lib/vgmsnd/vgmSnd.c modified: src/lib/vgmsnd/vgmSnd.h modified: vgmtest.exe --- diff --git a/exmmtest.map b/exmmtest.map index 4378b0f2..436b9573 100755 --- a/exmmtest.map +++ b/exmmtest.map @@ -1,6 +1,6 @@ Open Watcom Linker Version 1.9 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Created on: 15/09/12 03:14:20 +Created on: 15/09/12 12:47:11 Executable Image: exmmtest.exe creating a DOS executable @@ -495,4 +495,4 @@ Module: /usr/watcom/lib286/dos/clibc.lib(clearenv.c) Stack size: 8000 (32768.) Memory size: 00011e70 (73328.) Entry point address: 0000:47f4 -Link time: 00:00.02 +Link time: 00:00.01 diff --git a/scroll.map b/scroll.map index 4158d71c..22f0e800 100755 --- a/scroll.map +++ b/scroll.map @@ -1,6 +1,6 @@ Open Watcom Linker Version 1.9 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Created on: 15/09/12 03:14:21 +Created on: 15/09/12 12:47:11 Executable Image: scroll.exe creating a DOS executable @@ -600,4 +600,4 @@ Module: /usr/watcom/lib286/dos/clibc.lib(hugeval.c) Stack size: 8000 (32768.) Memory size: 000164b0 (91312.) Entry point address: 0000:5fe4 -Link time: 00:00.03 +Link time: 00:00.02 diff --git a/src/lib/vgmsnd/common.h b/src/lib/vgmsnd/common.h index a25a046d..db4a26db 100755 --- a/src/lib/vgmsnd/common.h +++ b/src/lib/vgmsnd/common.h @@ -1,7 +1,7 @@ #ifndef __COMMON_H__ #define __COMMON_H__ -#include "src/lib/vgmsnd/stdtype.h" +//#include "src/lib/vgmsnd/stdtype.h" //#include "src/lib/16_head.h" //#include "src/lib/vgmsnd/stdbool.h" diff --git a/src/lib/vgmsnd/vgmSnd.c b/src/lib/vgmsnd/vgmSnd.c index d501edd0..d5e1cb2f 100755 --- a/src/lib/vgmsnd/vgmSnd.c +++ b/src/lib/vgmsnd/vgmSnd.c @@ -22,54 +22,54 @@ typedef struct _vgm_file_header_base { sdword fccVGM; // 00 - UINT32 lngEOFOffset; // 04 - UINT32 lngVersion; // 08 - UINT32 lngSkip1[2]; // 0C - UINT32 lngGD3Offset; // 14 - UINT32 lngTotalSamples; // 18 - UINT32 lngLoopOffset; // 1C - UINT32 lngLoopSamples; // 20 - UINT32 lngRate; // 24 - UINT32 lngSkip2[3]; // 28 - UINT32 lngDataOffset; // 34 - UINT32 lngSkip3[2]; // 38 + sdword lngEOFOffset; // 04 + sdword lngVersion; // 08 + sdword lngSkip1[2]; // 0C + sdword lngGD3Offset; // 14 + sdword lngTotalSamples; // 18 + sdword lngLoopOffset; // 1C + sdword lngLoopSamples; // 20 + sdword lngRate; // 24 + sdword lngSkip2[3]; // 28 + sdword lngDataOffset; // 34 + sdword lngSkip3[2]; // 38 } VGM_BASE_HDR; #define PBMODE_MUSIC 0x00 #define PBMODE_SFX 0x01 typedef struct _vgm_playback { - UINT8 pbMode; - UINT8 vgmEnd; // 00 - running, 01 - finished, FF - not loaded - UINT16 curLoopCnt; - UINT32 vgmPos; - UINT32 vgmSmplPos; - UINT32 pbSmplPos; + byte pbMode; + byte vgmEnd; // 00 - running, 01 - finished, FF - not loaded + sword/**/ curLoopCnt; + sdword vgmPos; + sdword vgmSmplPos; + sdword pbSmplPos; VGM_FILE* file; // oplChnMask: // Music: mask of channels used/overridden by SFX // SFX: ID of channel used by SFX (all commands are forces to it) - UINT16 oplChnMask; - UINT8* oplRegCache; - UINT8 workRAM[0x04]; + sword/**/ oplChnMask; + byte* oplRegCache; + byte workRAM[0x04]; } VGM_PBK; -INLINE UINT16 ReadLE16(const UINT8* buffer) +INLINE sword/**/ ReadLE16(const byte* buffer) { #ifdef QUICK_READ - return *(UINT16*)buffer; + return *(sword/**/*)buffer; #else return (buffer[0x00] << 0) | (buffer[0x01] << 8); #endif } -INLINE UINT32 ReadLE32(const UINT8* buffer) +INLINE sdword ReadLE32(const byte* buffer) { #ifdef QUICK_READ - return *(UINT32*)buffer; + return *(sword*)buffer; #else return (buffer[0x00] << 0) | (buffer[0x01] << 8) | (buffer[0x02] << 16) | (buffer[0x03] << 24); @@ -78,35 +78,35 @@ INLINE UINT32 ReadLE32(const UINT8* buffer) // Function Prototypes -//UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); +//byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); //void FreeVGMFile(VGM_FILE* vgmFile); static boolean DoVgmLoop(VGM_PBK* vgmPlay); -static void UpdateVGM(VGM_PBK* vgmPlay, UINT16 Samples); +static void UpdateVGM(VGM_PBK* vgmPlay, sword/**/ Samples); //void InitEngine(void); //void DeinitEngine(void); -//UINT8 PlayMusic(VGM_FILE* vgmFile); -//UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID); -//UINT8 StopMusic(void); -//UINT8 StopSFX(UINT8 sfxChnID); // Note: sfxChnID == 0xFF -> stop all SFX -//UINT8 PauseMusic(void); -//UINT8 ResumeMusic(void); +//byte PlayMusic(VGM_FILE* vgmFile); +//byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID); +//byte StopMusic(void); +//byte StopSFX(byte sfxChnID); // Note: sfxChnID == 0xFF -> stop all SFX +//byte PauseMusic(void); +//byte ResumeMusic(void); static void StartPlayback(VGM_PBK* vgmPb); static void StopPlayback(VGM_PBK* vgmPb); -static void ym2413_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); -static void ym3812_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); -static void ym3512_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); -static void ymf262_write(VGM_PBK* vgmPb, UINT8 port, UINT8 reg, UINT8 data); +static void ym2413_write(VGM_PBK* vgmPb, byte reg, byte data); +static void ym3812_write(VGM_PBK* vgmPb, byte reg, byte data); +static void ym3512_write(VGM_PBK* vgmPb, byte reg, byte data); +static void ymf262_write(VGM_PBK* vgmPb, byte port, byte reg, byte data); //void UpdateSoundEngine(void); // Functions that must be supplied by external library -extern void OPL2_Write(UINT8 reg, UINT8 data); -extern UINT8 OPL2_ReadStatus(void); +extern void OPL2_Write(byte reg, byte data); +extern byte OPL2_ReadStatus(void); @@ -119,32 +119,32 @@ extern UINT8 OPL2_ReadStatus(void); static VGM_PBK vgmPbMusic; static VGM_PBK vgmPbSFX[SFX_CHN_COUNT]; -static UINT8 oplRegs_Music[0x100]; -static UINT8 oplRegs_SFX[SFX_CHN_COUNT][0x0D]; // 20 23 40 43 60 63 80 83 E0 E3 C0 A0 B0 +static byte oplRegs_Music[0x100]; +static byte oplRegs_SFX[SFX_CHN_COUNT][0x0D]; // 20 23 40 43 60 63 80 83 E0 E3 C0 A0 B0 -static const UINT8 SFX_REGS[0x0D] = +static const byte SFX_REGS[0x0D] = { 0x20, 0x23, 0x40, 0x43, 0x60, 0x63, 0x80, 0x83, 0xE0, 0xE3, 0xC0, 0xA0, 0xB0}; -static const UINT8 SFX_REGS_REV[0x10] = // 20/30 -> 0, 40/50 -> 2, ... +static const byte SFX_REGS_REV[0x10] = // 20/30 -> 0, 40/50 -> 2, ... { 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x06, 0x06, 0x0B, 0x0C, 0x0A, 0xFF, 0x08, 0x08}; -static const UINT8 CHN_OPMASK[0x09] = +static const byte CHN_OPMASK[0x09] = { 0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12}; -static const UINT8 CHN_OPMASK_REV[0x20] = +static const byte CHN_OPMASK_REV[0x20] = { 0x00, 0x01, 0x02, 0x80, 0x81, 0x82, 0xFF, 0xFF, 0x03, 0x04, 0x05, 0x83, 0x84, 0x85, 0xFF, 0xFF, 0x06, 0x07, 0x08, 0x86, 0x87, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) +byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) { size_t hdrSize; size_t readEl; // 'elements' read from file size_t bytesToRead; VGM_BASE_HDR vgmBaseHdr; FILE* hFile; - UINT32 CurPos; + sdword CurPos; memset(vgmFile, 0x00, sizeof(VGM_FILE)); @@ -171,7 +171,7 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) } vgmFile->dataLen = vgmBaseHdr.lngEOFOffset + 0x04; - vgmFile->data = (UINT8*)malloc(vgmFile->dataLen); + vgmFile->data = (byte*)malloc(vgmFile->dataLen); if (vgmFile->data == NULL) { fclose(hFile); @@ -206,7 +206,7 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) CurPos = 0x40; hdrSize = sizeof(VGM_HEADER); if (hdrSize > CurPos) - memset((UINT8*)&vgmFile->header + CurPos, 0x00, hdrSize - CurPos); + memset((byte*)&vgmFile->header + CurPos, 0x00, hdrSize - CurPos); fclose(hFile); return 0x00; @@ -237,16 +237,16 @@ static boolean DoVgmLoop(VGM_PBK* vgmPlay) return true; } -static void UpdateVGM(VGM_PBK* vgmPlay, UINT16 Samples) +static void UpdateVGM(VGM_PBK* vgmPlay, sword/**/ Samples) { - const UINT32 vgmLen = vgmPlay->file->dataLen; - const UINT8* vgmData = vgmPlay->file->data; - const UINT8* VGMPnt; - UINT32 VGMPos; - UINT32 VGMSmplPos; - UINT8 Command; - UINT8 blockType; - UINT32 blockLen; + const sdword vgmLen = vgmPlay->file->dataLen; + const byte* vgmData = vgmPlay->file->data; + const byte* VGMPnt; + sdword VGMPos; + sdword VGMSmplPos; + byte Command; + byte blockType; + sdword blockLen; vgmPlay->pbSmplPos += Samples; VGMPos = vgmPlay->vgmPos; @@ -390,8 +390,8 @@ static void UpdateVGM(VGM_PBK* vgmPlay, UINT16 Samples) void InitEngine(void) { - UINT8 curSFX; - UINT8 curReg; + byte curSFX; + byte curReg; memset(oplRegs_Music, 0x00, 0x100); memset(&vgmPbMusic, 0x00, sizeof(VGM_PBK)); @@ -429,7 +429,7 @@ void InitEngine(void) void DeinitEngine(void) { - UINT8 curSFX; + byte curSFX; StopPlayback(&vgmPbMusic); for (curSFX = 0; curSFX < SFX_CHN_COUNT; curSFX ++) @@ -441,7 +441,7 @@ void DeinitEngine(void) } -UINT8 PlayMusic(VGM_FILE* vgmFile) +byte PlayMusic(VGM_FILE* vgmFile) { VGM_PBK* vgmPb = &vgmPbMusic; @@ -455,7 +455,7 @@ UINT8 PlayMusic(VGM_FILE* vgmFile) return 0x00; } -UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID) +byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID) { VGM_PBK* vgmPb; @@ -474,13 +474,13 @@ UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID) return 0x00; } -UINT8 StopMusic(void) +byte StopMusic(void) { StopPlayback(&vgmPbMusic); return 0x00; } -UINT8 StopSFX(UINT8 sfxChnID) +byte StopSFX(byte sfxChnID) { if (sfxChnID == 0xFF) { @@ -496,7 +496,7 @@ UINT8 StopSFX(UINT8 sfxChnID) return 0x00; } -UINT8 PauseMusic(void) +byte PauseMusic(void) { if (vgmPbMusic.vgmEnd == 0xFF) return 0xFF; // not playing @@ -511,7 +511,7 @@ UINT8 PauseMusic(void) return 0x00; } -UINT8 ResumeMusic(void) +byte ResumeMusic(void) { if (vgmPbMusic.vgmEnd == 0xFF) return 0xFF; // not playing @@ -544,7 +544,7 @@ static void StartPlayback(VGM_PBK* vgmPb) if (vgmPb->pbMode == PBMODE_SFX) { - UINT8 curReg; + byte curReg; curReg = 0xB0 | vgmPb->oplChnMask; if (oplRegs_Music[curReg] & 0x20) @@ -563,8 +563,8 @@ static void StopPlayback(VGM_PBK* vgmPb) if (vgmPb->pbMode == PBMODE_MUSIC) { - UINT8 curReg; - UINT16 chnMask; + byte curReg; + sword/**/ chnMask; chnMask = 0x0001; for (curReg = 0xB0; curReg < 0xB9; curReg ++, chnMask <<= 1) @@ -588,9 +588,9 @@ static void StopPlayback(VGM_PBK* vgmPb) } else //if (vgmPb->pbMode == PBMODE_SFX) { - UINT8 regID; - UINT8 curReg; - UINT8 opMask; + byte regID; + byte curReg; + byte opMask; curReg = 0xB0 | vgmPb->oplChnMask; if (vgmPb->oplRegCache[0x0C] & 0x20) @@ -624,10 +624,10 @@ static void StopPlayback(VGM_PBK* vgmPb) -static void OPL_CachedWrite(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) +static void OPL_CachedWrite(VGM_PBK* vgmPb, byte reg, byte data) { - UINT8 regChn; - UINT8 ramOfs; + byte regChn; + byte ramOfs; if (vgmPb->pbMode == PBMODE_MUSIC) { @@ -689,12 +689,12 @@ static void OPL_CachedWrite(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) } -static void ym2413_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) +static void ym2413_write(VGM_PBK* vgmPb, byte reg, byte data) { return; // unsupported for now } -static void ym3812_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) +static void ym3812_write(VGM_PBK* vgmPb, byte reg, byte data) { if (reg == 0x01) { @@ -710,7 +710,7 @@ static void ym3812_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) return; } -static void ym3512_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) +static void ym3512_write(VGM_PBK* vgmPb, byte reg, byte data) { if ((reg & 0xE0) == 0xE0) { @@ -728,7 +728,7 @@ static void ym3512_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) return; } -static void ymf262_write(VGM_PBK* vgmPb, UINT8 port, UINT8 reg, UINT8 data) +static void ymf262_write(VGM_PBK* vgmPb, byte port, byte reg, byte data) { return; // unsupported for now } @@ -737,8 +737,8 @@ static void ymf262_write(VGM_PBK* vgmPb, UINT8 port, UINT8 reg, UINT8 data) void UpdateSoundEngine(void) { - UINT8 tmrMask; - UINT8 curSFX; + byte tmrMask; + byte curSFX; tmrMask = OPL2_ReadStatus(); if (! (tmrMask & 0x40)) diff --git a/src/lib/vgmsnd/vgmSnd.h b/src/lib/vgmsnd/vgmSnd.h index 0a886bc8..f48e2371 100755 --- a/src/lib/vgmsnd/vgmSnd.h +++ b/src/lib/vgmsnd/vgmSnd.h @@ -6,75 +6,75 @@ extern "C" { #endif -#include "src/lib/vgmsnd/stdtype.h" +//#include "src/lib/vgmsnd/stdtype.h" #include "src/lib/16_head.h" typedef struct _vgm_file_header { sdword fccVGM; - UINT32 lngEOFOffset; - UINT32 lngVersion; - UINT32 lngHzPSG; - UINT32 lngHzYM2413; - UINT32 lngGD3Offset; - UINT32 lngTotalSamples; - UINT32 lngLoopOffset; - UINT32 lngLoopSamples; - UINT32 lngRate; - UINT8 bytPSGCfg[4]; - UINT32 lngHzYM2612; - UINT32 lngHzYM2151; - UINT32 lngDataOffset; - UINT32 lngHzSPCM; - UINT32 lngSPCMIntf; - UINT32 lngHzRF5C68; - UINT32 lngHzYM2203; - UINT32 lngHzYM2608; - UINT32 lngHzYM2610; - UINT32 lngHzYM3812; - UINT32 lngHzYM3526; - UINT32 lngHzY8950; - UINT32 lngHzYMF262; - UINT32 lngHzYMF278B; - UINT32 lngHzYMF271; - UINT32 lngHzYMZ280B; - UINT32 lngHzRF5C164; - UINT32 lngHzPWM; - UINT32 lngHzAY8910; - UINT8 bytAYCfg[4]; - UINT8 bytVolumeModifier; - UINT8 bytReserved2; - INT8 bytLoopBase; - UINT8 bytLoopModifier; + sdword lngEOFOffset; + sdword lngVersion; + sdword lngHzPSG; + sdword lngHzYM2413; + sdword lngGD3Offset; + sdword lngTotalSamples; + sdword lngLoopOffset; + sdword lngLoopSamples; + sdword lngRate; + byte bytPSGCfg[4]; + sdword lngHzYM2612; + sdword lngHzYM2151; + sdword lngDataOffset; + sdword lngHzSPCM; + sdword lngSPCMIntf; + sdword lngHzRF5C68; + sdword lngHzYM2203; + sdword lngHzYM2608; + sdword lngHzYM2610; + sdword lngHzYM3812; + sdword lngHzYM3526; + sdword lngHzY8950; + sdword lngHzYMF262; + sdword lngHzYMF278B; + sdword lngHzYMF271; + sdword lngHzYMZ280B; + sdword lngHzRF5C164; + sdword lngHzPWM; + sdword lngHzAY8910; + byte bytAYCfg[4]; + byte bytVolumeModifier; + byte bytReserved2; + char bytLoopBase; + byte bytLoopModifier; } VGM_HEADER; typedef struct _vgm_file { - UINT32 dataLen; - UINT8* data; + sdword dataLen; + byte* data; VGM_HEADER header; } VGM_FILE; -UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); +byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); void FreeVGMFile(VGM_FILE* vgmFile); void InitEngine(void); void DeinitEngine(void); -UINT8 PlayMusic(VGM_FILE* vgmFile); -UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID); -UINT8 StopMusic(void); -UINT8 StopSFX(UINT8 sfxChnID); -UINT8 PauseMusic(void); -UINT8 ResumeMusic(void); +byte PlayMusic(VGM_FILE* vgmFile); +byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID); +byte StopMusic(void); +byte StopSFX(byte sfxChnID); +byte PauseMusic(void); +byte ResumeMusic(void); void UpdateSoundEngine(void); // Functions that must be supplied by external library: -extern void OPL2_Write(UINT8 reg, UINT8 data); -extern UINT8 OPL2_ReadStatus(void); +extern void OPL2_Write(byte reg, byte data); +extern byte OPL2_ReadStatus(void); #ifdef __cplusplus diff --git a/vgmtest.exe b/vgmtest.exe index 0bd222da..cec5f8c7 100755 Binary files a/vgmtest.exe and b/vgmtest.exe differ