IIgs MOD changes in place. Still need to do sound and test.

This commit is contained in:
Scott Duensing 2022-09-18 18:26:19 -05:00
parent 82571bca36
commit c60a5e5a55
4 changed files with 121 additions and 50 deletions

View file

@ -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/."

View file

@ -27,7 +27,6 @@
#include <memory.h>
#include <misctool.h>
#include <sound.h>
#include <MIDISynth.h>
#include <Orca.h>
@ -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<MUSIC_SLOTS; i++) {
if (_jlMusicList[i] < 0) break;
}
// We get one?
if (i < MUSIC_SLOTS) {
_jlSetPascalString(file, temp);
NTPAddToBatch((Pointer)&file, i + 1);
JOEY_CHECK_TOOL_ERROR("NTPAddToBatch")
_jlMusicList[i] = -_jlMusicList[i];
*mod = &_jlMusicList[i];
return jtrue;
}
return jfalse;
}
void jlModPause(void) {
NTPPauseMusic();
}
void jlModPlay(jlModT *mod) {
jint16 slot = (jint16)mod;
if (slot > 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<MUSIC_SLOTS; i++) _jlMusicList[i] = -(i + 1); // Negative values available slots, positive are used.
// Start assembly module
_jlHertz = (int)ReadBParam((Word)0x1D) == 0 ? 60 : 50; // Is this a PAL or NTSC (0) machine?
asmStart(userid(), _jlHertz == 60 ? 0 : 1);
@ -364,8 +430,6 @@ void main(void) {
// Shutdown tools
NTPShutDown(); // NinjaTracker
UnloadOneTool(222);
MSShutDown(); // MIDI Synth
UnloadOneTool(35);
SoundShutDown(); // Sound Tool Set
MTShutDown(); // Misc Tools
DisposeAll(userid());

View file

@ -235,13 +235,21 @@ typedef unsigned long juint32;
#define JL_HAS_IMGDISPLAY
#define JL_HAS_KEYPRESSED
#define JL_HAS_KEYREAD
#define JL_HAS_PALETTESET
#define JL_HAS_PALETTESETFROMIMG
#define JL_HAS_MODCONTINUE
#define JL_HAS_MODFREE
#define JL_HAS_MODISPLAYING
#define JL_HAS_MODLOAD
#define JL_HAS_MODPAUSE
#define JL_HAS_MODPLAY
#define JL_HAS_MODSTOP
#define JL_HAS_MODVOLUME
#define JL_HAS_PALETTESET
#define JL_HAS_PALETTESETFROMIMG
#define JL_HAS_SOUNDFREE
#define JL_HAS_SOUNDISPLAYING
#define JL_HAS_SOUNDLOAD
#define JL_HAS_SOUNDPLAY
#define JL_HAS_SOUNDSTOP
#define JL_HAS_UTILNIBBLESWAP
#define JL_HAS_UTILTIMER

View file

@ -885,7 +885,7 @@ function installIIgs() {
purple "Installing NinjaTrackerPlus Tool222"
download http://www.ninjaforce.com/downloads/ninjatrackerplus_tool222_v1.4.2mg
"${IIGS}/cadius/cadius" extractfile ninjatrackerplus_tool222_v1.4.2mg NTP.TOOL222V1.4/SYSTEM/TOOLS/TOOL222 .
cp -f Tool222#BA0000 "${IIGS}/Tool222#ba0000"
cp -f TOOL222#BA0000 "${IIGS}/Tool222#ba0000"
fi
mkdir -p "${JOEY}/dist/IIgs"