Updated to be happy with the JoeyDev changes.

This commit is contained in:
Scott Duensing 2021-06-09 17:07:26 -05:00
parent fd5875e651
commit 2bcb7025c3
8 changed files with 125 additions and 76 deletions

View file

@ -76,13 +76,15 @@ function doIIgsBuild() {
iix compile jIIgs.c keep=31:/out/joey/jIIgsc iix compile jIIgs.c keep=31:/out/joey/jIIgsc
iix compile joey.c keep=31:/out/joey/joey iix compile joey.c keep=31:/out/joey/joey
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsasm.A iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsc.root
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsasm.ROOT
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsc.a iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsc.a
iix makelib 31:/out/joey/joeylib +31:/out/joey/joey.a iix makelib 31:/out/joey/joeylib +31:/out/joey/joey.a
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsasm.A
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsasm.ROOT
iix compile test.c keep=31:/out/joey/test iix compile test.c keep=31:/out/joey/test
iix -DKeepType=S16 link +L 31:/out/joey/test 31:/out/joey/joeylib keep=31:/out/joey/test > test.map # iix -DKeepType=S16 link +L 31:/out/joey/joeylib 31:/out/joey/test keep=31:/out/joey/test > test.map
iix -DKeepType=S16 link +L 31:/out/joey/jIIgsc 31:/out/joey/joey 31:/out/joey/jIIgsasm 31:/out/joey/test keep=31:/out/joey/test > test.map
iix dumpobj +D 31:/out/joey/test &> test.dis || true iix dumpobj +D 31:/out/joey/test &> test.dis || true

View file

@ -67,6 +67,8 @@ OTHER_FILES += \
src/jIIgs.c \ src/jIIgs.c \
src/jIIgs.asm \ src/jIIgs.asm \
src/jIIgs.macro \ src/jIIgs.macro \
src/jDev.h \
src/jDev.c \
joey.pri joey.pri
dmalloc { dmalloc {

View file

@ -31,6 +31,7 @@
#include <Orca.h> #include <Orca.h>
#define JOEY_MAIN
#include "joey.h" #include "joey.h"
@ -146,12 +147,12 @@ jbool jlGameGetButton(jbyte which) {
} }
jbool _jlImgCreate(jlImgT **img) { jbool _jlImgCreate(jlImgT **img, jint16 line, char *file) {
jlImgT *t = NULL; jlImgT *t = NULL;
// Are we loading into a new image? // Are we loading into a new image?
if (*img == NULL) { if (*img == NULL) {
t = (jlImgT *)jlMalloc(sizeof(jlImgT)); t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file);
if (t == NULL) { if (t == NULL) {
return jfalse; return jfalse;
} }
@ -265,7 +266,7 @@ void jlSoundModStop(void) {
} }
int main(void) { void main(void) {
handle tempHandle; handle tempHandle;
ptr ZeroPagePtr; ptr ZeroPagePtr;
@ -344,31 +345,33 @@ int main(void) {
jlDisplayPresent(); jlDisplayPresent();
// Run the main loop. // Run the main loop.
joeyMain(); if (!setjmp(_jlJumpBuffer)) {
joeyMain();
// Clear the display. // Clear the display.
jlDrawColorSet(0); jlDrawColorSet(0);
jlDrawClear(); jlDrawClear();
// Restore Border // Restore Border
jlDisplayBorder((jlBorderColorsE)_jlBorderSaved); jlDisplayBorder((jlBorderColorsE)_jlBorderSaved);
jlDisplayPresent(); jlDisplayPresent();
// SHR Off // SHR Off
asmGrOff(); asmGrOff();
asmStop(); asmStop();
// Shutdown tools // Shutdown tools
NTPShutDown(); // NinjaTracker NTPShutDown(); // NinjaTracker
UnloadOneTool(222); UnloadOneTool(222);
MSShutDown(); // MIDI Synth MSShutDown(); // MIDI Synth
UnloadOneTool(35); UnloadOneTool(35);
SoundShutDown(); // Sound Tool Set SoundShutDown(); // Sound Tool Set
MTShutDown(); // Misc Tools MTShutDown(); // Misc Tools
DisposeAll(userid()); DisposeAll(userid());
MMShutDown(userid()); // Memory Manager MMShutDown(userid()); // Memory Manager
TLShutDown(); // Tool Locator TLShutDown(); // Tool Locator
jlUtilDie("Clean Exit."); jlUtilDie("Clean Exit.");
}
} }

View file

@ -414,16 +414,13 @@ void jlUtilTitleSet(char *title) {
} }
int main(int argc, char *argv[]) { int main(void) {
int flags; int flags;
int result; int result;
int joysticks; int joysticks;
int x; int x;
(void)argc;
(void)argv;
// Start low-level tools // Start low-level tools
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
jlUtilDie(SDL_GetError()); jlUtilDie(SDL_GetError());
@ -460,25 +457,28 @@ int main(int argc, char *argv[]) {
jPixBufStart(); jPixBufStart();
// Run the main loop. // Run the main loop.
joeyMain(); if (!setjmp(_jlJumpBuffer)) {
joeyMain();
jPixBufStop(); jPixBufStop();
SDL_RemoveTimer(_jlTimerId); SDL_RemoveTimer(_jlTimerId);
for (x=0; x<_jlControllerCount; x++) { for (x=0; x<_jlControllerCount; x++) {
SDL_GameControllerClose(_jlControllers[x]); SDL_GameControllerClose(_jlControllers[x]);
}
_jlControllerCount = 0;
jlFree(_jlControllers);
//***TODO*** Sound effects stop?
jlSoundModStop();
jlSoundMidiStop();
Mix_CloseAudio();
Mix_Quit();
SDL_FreeFormat(_jlPixelFormat);
SDL_DestroyTexture(_jlTexture);
SDL_DestroyRenderer(_jlRenderer);
SDL_DestroyWindow(_jlWindow);
SDL_Quit();
jlUtilDie("Clean Exit.");
} }
_jlControllerCount = 0;
jlFree(_jlControllers);
//***TODO*** Sound effects stop?
jlSoundModStop();
jlSoundMidiStop();
Mix_CloseAudio();
Mix_Quit();
SDL_FreeFormat(_jlPixelFormat);
SDL_DestroyTexture(_jlTexture);
SDL_DestroyRenderer(_jlRenderer);
SDL_DestroyWindow(_jlWindow);
SDL_Quit();
jlUtilDie("Clean Exit.");
} }

View file

@ -23,10 +23,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h>
#define JOEY_MAIN
#include "joey.h" #include "joey.h"
@ -99,13 +97,13 @@ _jlScanDataT *_jlDrawFillNewSegment(jint16 startX, jint16 endX, jint16 y, signed
//***TODO*** These are really terrible examples of memory management routines. //***TODO*** These are really terrible examples of memory management routines.
jlMemoryBlockT _jlMemoryBlocks[JOEY_MEM_BLOCKS]; static jlMemoryBlockT _jlMemoryBlocks[JOEY_MEM_BLOCKS];
long _jlTotalAllocated = 0; static long _jlTotalAllocated = 0;
long _jlTotalAllocations = 0; static long _jlTotalAllocations = 0;
long _jlTotalFrees = 0; static long _jlTotalFrees = 0;
long _jlHighWaterMark = 0; static long _jlHighWaterMark = 0;
long _jlBlocksNeeded = 0; static long _jlBlocksNeeded = 0;
jbool _jlMemoryStarted = jfalse; static jbool _jlMemoryStarted = jfalse;
void _jlFree(void **pointer) { void _jlFree(void **pointer) {
jint16 i; jint16 i;
@ -124,6 +122,16 @@ void _jlFree(void **pointer) {
free(*pointer); free(*pointer);
} }
/*
jlUtilSay("Free:");
jlUtilSay("_jlTotalAllocated = %ld", _jlTotalAllocated);
jlUtilSay("_jlTotalAllocations = %ld", _jlTotalAllocations);
jlUtilSay("_jlTotalFrees = %ld", _jlTotalFrees);
jlUtilSay("_jlHighWaterMark = %ld", _jlHighWaterMark);
jlUtilSay("_jlBlocksNeeded = %ld", _jlBlocksNeeded);
jlUtilSay("-----------------------------------------------");
*/
} }
void *_jlMalloc(size_t size, jint16 line, char *file) { void *_jlMalloc(size_t size, jint16 line, char *file) {
@ -153,6 +161,16 @@ void *_jlMalloc(size_t size, jint16 line, char *file) {
_jlHighWaterMark = _jlTotalAllocated; _jlHighWaterMark = _jlTotalAllocated;
} }
/*
jlUtilSay("Malloc:");
jlUtilSay("_jlTotalAllocated = %ld", _jlTotalAllocated);
jlUtilSay("_jlTotalAllocations = %ld", _jlTotalAllocations);
jlUtilSay("_jlTotalFrees = %ld", _jlTotalFrees);
jlUtilSay("_jlHighWaterMark = %ld", _jlHighWaterMark);
jlUtilSay("_jlBlocksNeeded = %ld", _jlBlocksNeeded);
jlUtilSay("-----------------------------------------------");
*/
return _jlMemoryBlocks[i].addr; return _jlMemoryBlocks[i].addr;
} }
@ -180,6 +198,16 @@ void *_jlRealloc(void *pointer, size_t size) {
_jlHighWaterMark = _jlTotalAllocated; _jlHighWaterMark = _jlTotalAllocated;
} }
/*
jlUtilSay("Realloc:");
jlUtilSay("_jlTotalAllocated = %ld", _jlTotalAllocated);
jlUtilSay("_jlTotalAllocations = %ld", _jlTotalAllocations);
jlUtilSay("_jlTotalFrees = %ld", _jlTotalFrees);
jlUtilSay("_jlHighWaterMark = %ld", _jlHighWaterMark);
jlUtilSay("_jlBlocksNeeded = %ld", _jlBlocksNeeded);
jlUtilSay("-----------------------------------------------");
*/
return _jlMemoryBlocks[i].addr; return _jlMemoryBlocks[i].addr;
} }
@ -1142,8 +1170,10 @@ void jlUtilSay(char *format, ...) {
#ifdef JOEY_DEBUG #ifdef JOEY_DEBUG
FILE *f = NULL; FILE *f = NULL;
va_list va; va_list va;
va_list va2;
static jbool firstWrite = jtrue; static jbool firstWrite = jtrue;
#if defined(va_copy)
va_list va2;
#endif
// Start over every run. // Start over every run.
if (firstWrite) { if (firstWrite) {
@ -1152,17 +1182,24 @@ void jlUtilSay(char *format, ...) {
} }
va_start(va, format); va_start(va, format);
va_copy(va2, va);
f = fopen("JLSTATS", "wt+"); // This doesn't use jlUtilMakePathname #if defined(va_copy)
va_copy(va2, va);
#endif
f = fopen("JLSTATS", "a+"); // This doesn't use jlUtilMakePathname
if (f != NULL) { if (f != NULL) {
vfprintf(f, format, va); vfprintf(f, format, va);
fprintf(f, "\n");
fclose(f); fclose(f);
} }
printf(format, va); #if defined(va_copy)
vprintf(format, va2);
printf("\n");
va_end(va2); va_end(va2);
#endif
va_end(va); va_end(va);
#else #else
(void)format; (void)format;

View file

@ -429,11 +429,7 @@ void jlStnFree(jlStnT *stn);
jbool _jlStnLoad(jlStnT **stn, char *filename, jint16 line, char *file); jbool _jlStnLoad(jlStnT **stn, char *filename, jint16 line, char *file);
#define jlUtilByteSwap(twoBytes) ((juint16)((twoBytes) & 0xff) >> 8) | (juint16)((twoBytes) << 8) #define jlUtilByteSwap(twoBytes) ((juint16)((twoBytes) & 0xff) >> 8) | (juint16)((twoBytes) << 8)
#ifdef JOEY_TOOLS
void jlUtilDie(const char *why, ...); void jlUtilDie(const char *why, ...);
#else
void jlUtilDie(const char *why, ...) __attribute__((noreturn));
#endif
void jlUtilIdle(void); void jlUtilIdle(void);
jbool jlUtilInputRead(jbyte *key); jbool jlUtilInputRead(jbyte *key);
#define jlUtilIsOdd(x) (((x & 1) == 1) ? jtrue : jfalse) #define jlUtilIsOdd(x) (((x & 1) == 1) ? jtrue : jfalse)

View file

@ -179,14 +179,13 @@ void grid(void) {
for (i=0; i<320; i+=8) { for (i=0; i<320; i+=8) {
jlDrawLine(i, 0, i, 199); jlDrawLine(i, 0, i, 199);
} }
for (i=0; i<200; i+=8) { for (i=0; i<200; i+=8) {
jlDrawLine(0, i, 319, i); jlDrawLine(0, i, 319, i);
} }
while (!jlKeyPressed()) { jlDisplayPresent();
jlDisplayPresent(); jlKeyWaitForAny();
}
jlKeyRead();
} }

View file

@ -64,6 +64,9 @@ function buildMacOSXSDK() {
if [[ ! -z ${G_AUTOMATED} ]]; then if [[ ! -z ${G_AUTOMATED} ]]; then
XCODE=${G_XCODE_FILE} XCODE=${G_XCODE_FILE}
if [[ ! -e "${XCODE}" ]]; then
return 0
fi
else else
if [[ ! -e "${OSX}/SDK" ]]; then if [[ ! -e "${OSX}/SDK" ]]; then
tFileBrowser XCODE "Please locate your XCode XIP" .xip .. tFileBrowser XCODE "Please locate your XCode XIP" .xip ..
@ -477,6 +480,9 @@ function installIIgs() {
if [[ ! -e "${IIGS}/ORCA/Languages/cc" ]]; then if [[ ! -e "${IIGS}/ORCA/Languages/cc" ]]; then
if [[ ! -z ${G_AUTOMATED} ]]; then if [[ ! -z ${G_AUTOMATED} ]]; then
ORCA=${G_ORCA_FILE} ORCA=${G_ORCA_FILE}
if [[ ! -e "${ORCA}" ]]; then
return 0
fi
else else
tFileBrowser ORCA "Please locate your 'OPUS ][ The Software' ISO" .iso .. tFileBrowser ORCA "Please locate your 'OPUS ][ The Software' ISO" .iso ..
if [[ -z ${ORCA} || "${ORCA}" == "" ]]; then if [[ -z ${ORCA} || "${ORCA}" == "" ]]; then
@ -488,6 +494,9 @@ function installIIgs() {
if [[ ! -d GoldenGate ]]; then if [[ ! -d GoldenGate ]]; then
if [[ ! -z ${G_AUTOMATED} ]]; then if [[ ! -z ${G_AUTOMATED} ]]; then
GGATE=${G_GOLDEN_GATE_FILE} GGATE=${G_GOLDEN_GATE_FILE}
if [[ ! -e "${GGATE}" ]]; then
return 0
fi
else else
tFileBrowser GGATE "Please locate your 'Golden Gate' MSI" .msi .. tFileBrowser GGATE "Please locate your 'Golden Gate' MSI" .msi ..
if [[ -z ${GGATE} || "${GGATE}" == "" ]]; then if [[ -z ${GGATE} || "${GGATE}" == "" ]]; then
@ -530,7 +539,7 @@ function installIIgs() {
purple "Upgrading ORCA/C" purple "Upgrading ORCA/C"
fetchGitHubRelease RESULT byteworksinc ORCA-C 2mg fetchGitHubRelease RESULT byteworksinc ORCA-C 2mg
#***TODO*** This fails with a mmap error sometimes - no idea why #***TODO*** This fails with a mmap error sometimes - no idea why
#"${IIGS}/opus-extractor" -v -s / ${RESULT} "${IIGS}/ORCA" "${IIGS}/opus-extractor" -v -s / ${RESULT} "${IIGS}/ORCA"
pushd ${GOLDEN_GATE} &> /dev/null pushd ${GOLDEN_GATE} &> /dev/null
#find . -type d -exec chmod 755 {} \; #find . -type d -exec chmod 755 {} \;
@ -990,12 +999,13 @@ function start() {
uuid-dev \ uuid-dev \
wget \ wget \
xz-utils xz-utils
if [[ ! -z ${G_AUTOMATED} ]]; then
DOINSTALL=1
fi
if [[ "${MISSING}" != "" ]]; then if [[ "${MISSING}" != "" ]]; then
if (whiptail --title "${G_TITLE}" --yesno "Some required packages are missing.\n\nInstall them now?" 9 40); then if [[ ! -z ${G_AUTOMATED} ]]; then
DOINSTALL=1 DOINSTALL=1
else
if (whiptail --title "${G_TITLE}" --yesno "Some required packages are missing.\n\nInstall them now?" 9 40); then
DOINSTALL=1
fi
fi fi
if [[ "${DOINSTALL}" == "1" ]]; then if [[ "${DOINSTALL}" == "1" ]]; then
TEMP=" ${MISSING//[^ ]}" TEMP=" ${MISSING//[^ ]}"