From c60a5e5a552e33a15b0725b15f89af4270344468 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Sun, 18 Sep 2022 18:26:19 -0500 Subject: [PATCH] IIgs MOD changes in place. Still need to do sound and test. --- joeylib/build.sh | 1 - joeylib/src/jIIgs.c | 156 ++++++++++++++++++++++++++++++------------- joeylib/src/joey.h | 12 +++- scripts/installer.sh | 2 +- 4 files changed, 121 insertions(+), 50 deletions(-) diff --git a/joeylib/build.sh b/joeylib/build.sh index 1983e02..add42ad 100755 --- a/joeylib/build.sh +++ b/joeylib/build.sh @@ -109,7 +109,6 @@ function doIIgsBuild() { cp -f "${OUT}/jIIgsasm.root" "${DIST}/jIIgsasm.root#b10000" cp -f "${OUT}/jIIgsasm.a" "${DIST}/jIIgsasm.a#b10000" cp -f "${OUT}/joey.a" "${DIST}/joey.a#b10000" - cp -f "${JOEY}/sdks/IIgs/Tool035#ba0000" "${JOEY}/dist/IIgs/." cp -f "${JOEY}/sdks/IIgs/Tool222#ba0000" "${JOEY}/dist/IIgs/." cp -f "${JOEY}/joeylib/scripts/build-IIgs.helper.sh" "${JOEY}/dist/." diff --git a/joeylib/src/jIIgs.c b/joeylib/src/jIIgs.c index eeae4e7..df2d33b 100644 --- a/joeylib/src/jIIgs.c +++ b/joeylib/src/jIIgs.c @@ -27,7 +27,6 @@ #include #include #include -#include #include @@ -40,6 +39,9 @@ #endif +#define MUSIC_SLOTS 25 + + #define DPForSound 0x0000 // Needs one direct page #define DPTotal 0x0100 // Total size of all tool DP usage @@ -62,14 +64,27 @@ extern void asmStart(jint16 myID, jint16 isPal); extern void asmStop(void); -extern pascal void NTPBootInit(void) inline(0x01DE, dispatcher); -extern pascal void NTPStartUp(Word) inline(0x02DE, dispatcher); -extern pascal void NTPShutDown(void) inline(0x03DE, dispatcher); -extern pascal void NTPLoadOneMusic(Pointer) inline(0x09DE, dispatcher); -extern pascal void NTPPlayMusic(Word) inline(0x0ADE, dispatcher); -extern pascal Word NTPGetPlayingMusic(void) inline(0x10DE, dispatcher); -extern pascal void NTPPauseMusic(void) inline(0x13DE, dispatcher); -extern pascal void NTPContinueMusic(void) inline(0x14DE, dispatcher); +extern pascal void NTPBootInit(void) inline(0x01DE, dispatcher); +extern pascal void NTPStartUp(Word) inline(0x02DE, dispatcher); +extern pascal void NTPShutDown(void) inline(0x03DE, dispatcher); +extern pascal Word NTPGetVersion(void) inline(0x04DE, dispatcher); +extern pascal void NTPReset(void) inline(0x05DE, dispatcher); +extern pascal Word NTPStatus(void) inline(0x06DE, dispatcher); +extern pascal void NTPStopMusic(void) inline(0x08DE, dispatcher); +extern pascal void NTPLoadOneMusic(Pointer) inline(0x09DE, dispatcher); +extern pascal void NTPPlayMusic(Word) inline(0x0ADE, dispatcher); +extern pascal Word NTPGetEndOfMusic(void) inline(0x0CDE, dispatcher); +extern pascal void NTPAddToBatch(Pointer, Word) inline(0x0DDE, dispatcher); +extern pascal void NTPSelectBatch(Word) inline(0x0EDE, dispatcher); +extern pascal void NTPKillBatch(Word) inline(0x0FDE, dispatcher); +extern pascal Word NTPGetPlayingMusic(void) inline(0x10DE, dispatcher); +extern pascal void NTPPlayBatch(Pointer) inline(0x11DE, dispatcher); +extern pascal Pointer NTPGetTrackVu(void) inline(0x12DE, dispatcher); +extern pascal void NTPPauseMusic(void) inline(0x13DE, dispatcher); +extern pascal void NTPContinueMusic(void) inline(0x14DE, dispatcher); + + +extern jbool _jlSwapChannels; char _jlKeyCheck(char key); @@ -87,6 +102,7 @@ static jbyte *BORDER = (jbyte *)0xE0C034L; static jbyte _jlBorderSaved; static jint16 _jlHertz; +static jint16 _jlMusicList[MUSIC_SLOTS]; #ifdef JOEY_DEBUG @@ -219,6 +235,78 @@ char jlKeyRead(void) { } +void jlModContinue(void) { + NTPContinueMusic(); +} + + +void jlModFree(jlModT *mod) { + jint16 slot = (jint16)mod; + + if (slot > 0) { + NTPKillBatch(slot); + JOEY_CHECK_TOOL_ERROR("NTPKillBatch") + _jlMusicList[slot - 1] = -_jlMusicList[slot - 1]; + } +} + + +jbool jlModIsPlaying(void) { + return (NTPGetPlayingMusic() != 0xFFFF) ? jtrue : jfalse; +} + + +jbool _jlModLoad(jlModT **mod, char *filename) { + jint16 i; + char *temp = jlUtilMakePathname(filename, "ntp"); + _jlPascalStringT file; + + // Find open slot. + for (i=0; i 0) { + NTPSelectBatch(slot); + JOEY_CHECK_TOOL_ERROR("NTPSelectBatch") + NTPPlayMusic(jfalse); + JOEY_CHECK_TOOL_ERROR("NTPPlayMusic") + } +} + + +void jlModStop(void) { + NTPStopMusic(); +} + + +void jlModVolume(jbyte volume) { + +} + + void jlPaletteSet(jbyte index, jbyte r, jbyte g, jbyte b) { SHRCOLORS[index].r = r; SHRCOLORS[index].g = g; @@ -231,38 +319,28 @@ void jlPaletteSetFromImg(jlImgT *img) { } -void jlSoundModContinue(void) { - NTPContinueMusic(); +void jlSoundFree(jlSoundT *sound) { + } -jbool jlSoundModIsPlaying(void) { - return (NTPGetPlayingMusic() != 0xFFFF) ? jtrue : jfalse; +jbool jlSoundIsPlaying(jlSoundT *sound) { + return jfalse; } -void jlSoundModPause(void) { - NTPPauseMusic(); +jbool _jlSoundLoad(jlSoundT **sound, char *filename) { + return jfalse; } -void jlSoundModPlay(char *name) { - char *temp = jlUtilMakePathname(name, "ntp"); - _jlPascalStringT file; +void jlSoundPlay(jlSoundT *sound, jlSoundChannelE channel, jbyte volume) { - _jlSetPascalString(file, temp); - NTPStartUp(userid()); - JOEY_CHECK_TOOL_ERROR("NTPStartup") - NTPLoadOneMusic((Pointer)&file); - JOEY_CHECK_TOOL_ERROR("NTPLoadOneMusic") - NTPPlayMusic(jfalse); - JOEY_CHECK_TOOL_ERROR("NTPPlayMusic") } -void jlSoundModStop(void) { - NTPShutDown(); - JOEY_CHECK_TOOL_ERROR("NTPShutDown") +void jlSoundStop(jlSoundT *sound) { + } @@ -273,6 +351,7 @@ void main(void) { InitialLoadOutputRec initialLoad; char *temp; _jlPascalStringT toolFile; + jint16 i; TLStartUp(); // Tool Locator JOEY_CHECK_TOOL_ERROR("TLStartUp") @@ -291,22 +370,6 @@ void main(void) { ZeroPagePtr = *tempHandle; SoundStartUp((word)ZeroPagePtr + DPForSound); - // Try to load MidiSynth from SYSTEM:TOOLS - LoadOneTool(35, 0); - if (_toolErr) { - // Not there. Try to manually load it from our disk. - temp = jlUtilMakePathname("Tool035", NULL); - _jlSetPascalString(toolFile, temp); - initialLoad = InitialLoad(userid(), (Pointer)&toolFile, 0); - JOEY_CHECK_TOOL_ERROR("Tool035") - SetTSPtr(0, 35, initialLoad.startAddr); - MSBootInit(); - // Do not JOEY_CHECK_TOOL_ERROR("MSBootInit") - it will fail when in fact it's just garbage in the A register. - // If we REALLY want to know, check carry clear. - } - MSStartUp(); // MIDI Synth - JOEY_CHECK_TOOL_ERROR("MSStartUp") - // Try to load NinjaTrackerPlus from SYSTEM:TOOLS LoadOneTool(222, 0); if (_toolErr) { @@ -320,6 +383,9 @@ void main(void) { JOEY_CHECK_TOOL_ERROR("NTPBootInit") } + // Clear out the 25 music slots provided by NTP so we can keep track of them. + for (i=0; i