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 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/jIIgsasm.ROOT
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsc.root
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/jIIgsasm.A
iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsasm.ROOT
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

View file

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

View file

@ -31,6 +31,7 @@
#include <Orca.h>
#define JOEY_MAIN
#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;
// Are we loading into a new image?
if (*img == NULL) {
t = (jlImgT *)jlMalloc(sizeof(jlImgT));
t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file);
if (t == NULL) {
return jfalse;
}
@ -265,7 +266,7 @@ void jlSoundModStop(void) {
}
int main(void) {
void main(void) {
handle tempHandle;
ptr ZeroPagePtr;
@ -344,6 +345,7 @@ int main(void) {
jlDisplayPresent();
// Run the main loop.
if (!setjmp(_jlJumpBuffer)) {
joeyMain();
// Clear the display.
@ -372,3 +374,4 @@ int main(void) {
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 result;
int joysticks;
int x;
(void)argc;
(void)argv;
// Start low-level tools
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
jlUtilDie(SDL_GetError());
@ -460,6 +457,7 @@ int main(int argc, char *argv[]) {
jPixBufStart();
// Run the main loop.
if (!setjmp(_jlJumpBuffer)) {
joeyMain();
jPixBufStop();
@ -480,5 +478,7 @@ int main(int argc, char *argv[]) {
SDL_DestroyRenderer(_jlRenderer);
SDL_DestroyWindow(_jlWindow);
SDL_Quit();
jlUtilDie("Clean Exit.");
}
}

View file

@ -23,10 +23,8 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#define JOEY_MAIN
#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.
jlMemoryBlockT _jlMemoryBlocks[JOEY_MEM_BLOCKS];
long _jlTotalAllocated = 0;
long _jlTotalAllocations = 0;
long _jlTotalFrees = 0;
long _jlHighWaterMark = 0;
long _jlBlocksNeeded = 0;
jbool _jlMemoryStarted = jfalse;
static jlMemoryBlockT _jlMemoryBlocks[JOEY_MEM_BLOCKS];
static long _jlTotalAllocated = 0;
static long _jlTotalAllocations = 0;
static long _jlTotalFrees = 0;
static long _jlHighWaterMark = 0;
static long _jlBlocksNeeded = 0;
static jbool _jlMemoryStarted = jfalse;
void _jlFree(void **pointer) {
jint16 i;
@ -124,6 +122,16 @@ void _jlFree(void **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) {
@ -153,6 +161,16 @@ void *_jlMalloc(size_t size, jint16 line, char *file) {
_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;
}
@ -180,6 +198,16 @@ void *_jlRealloc(void *pointer, size_t size) {
_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;
}
@ -1142,8 +1170,10 @@ void jlUtilSay(char *format, ...) {
#ifdef JOEY_DEBUG
FILE *f = NULL;
va_list va;
va_list va2;
static jbool firstWrite = jtrue;
#if defined(va_copy)
va_list va2;
#endif
// Start over every run.
if (firstWrite) {
@ -1152,17 +1182,24 @@ void jlUtilSay(char *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) {
vfprintf(f, format, va);
fprintf(f, "\n");
fclose(f);
}
printf(format, va);
#if defined(va_copy)
vprintf(format, va2);
printf("\n");
va_end(va2);
#endif
va_end(va);
#else
(void)format;

View file

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

View file

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

View file

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