jint16 types, data directory, filename extensions, other issues fixed.

This commit is contained in:
Scott Duensing 2018-10-25 19:42:41 -05:00
parent 5ba7a73f3a
commit 750c0733b0
10 changed files with 314 additions and 227 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ src/SDL2/
src/music src/music
src/music.w src/music.w
src/*.dis src/*.dis
src/*.map

View file

@ -1,9 +1,11 @@
#!/bin/bash -e #!/bin/bash -e
if [ -d ${JOEY}/sdks/iix/IIgs/out/joey ]; then OUT=${JOEY}/sdks/iix/IIgs/out/joey
rm -rf ${JOEY}/sdks/iix/IIgs/out/joey
if [ -d ${OUT} ]; then
rm -rf ${OUT}
fi fi
mkdir -p ${JOEY}/sdks/iix/IIgs/out/joey mkdir -p ${OUT}
pushd ${JOEY}/joeylib/src pushd ${JOEY}/joeylib/src
iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm
@ -23,28 +25,36 @@ iix dumpobj +D 31:/out/joey/test &> test.dis || true
php ${JOEY}/sdks/iix/ntconverter.php *.mod php ${JOEY}/sdks/iix/ntconverter.php *.mod
popd popd
rm JLSTATS || true
rm /tmp/import.po || true
AC=${JOEY}/sdks/iix/ac/
CADIUS=${JOEY}/sdks/iix/cadius/cadius.sh
IMPORT=/tmp/import.po
${AC}/import.sh ${JOEY}/sdks/iix/IIgs/out/joey/test S16
${AC}/import.sh ${JOEY}/joeylib/src/kanga.sta
${AC}/import.sh ${JOEY}/joeylib/src/font.sta
${AC}/import.sh ${JOEY}/joeylib/src/music MUS
${AC}/import.sh ${JOEY}/joeylib/src/music.w BIN
cp -f ${JOEY}/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/. cp -f ${JOEY}/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/.
cp -f ${JOEY}/joeylib/src/joey.h ${JOEY}/dist/. cp -f ${JOEY}/joeylib/src/joey.h ${JOEY}/dist/.
cp -f ${JOEY}/sdks/iix/IIgs/out/joey/joeylib ${JOEY}/dist/IIgs/joeylib#b20000 cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000
if [ ! -z $1 ]; then if [ ! -z $1 ]; then
CADIUS=${JOEY}/sdks/iix/cadius-git/bin/release/cadius
IMPORT=/tmp/import.po
VOL=Import
rm ${OUT}/JLSTATS 2> /dev/null || true
rm ${IMPORT} 2> /dev/null || true
cp ${OUT}/test ${OUT}/Test#B30000
cp ${JOEY}/joeylib/src/kanga.sta ${OUT}/kanga.sta#060000
cp ${JOEY}/joeylib/src/font.sta ${OUT}/font.sta#060000
cp ${JOEY}/joeylib/src/music ${OUT}/music#D50000
cp ${JOEY}/joeylib/src/music.w ${OUT}/music.w#060000
${CADIUS} createvolume ${IMPORT} ${VOL} 32MB > /dev/null
${CADIUS} createfolder ${IMPORT} ${VOL}/data > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL} ${OUT}/Test#b30000 > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/kanga.sta#060000 > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/font.sta#060000 > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/music#D50000 > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/music.w#060000 > /dev/null
pushd ${JOEY}/sdks/iix/gsplus pushd ${JOEY}/sdks/iix/gsplus
./gsplus -config IIgsTest.cfg || true ./gsplus -config IIgsTest.cfg || true
popd popd
echo "" echo ""
${AC}/export.sh JLSTATS ${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS ${OUT} > /dev/null
cat JLSTATS cat ${OUT}/JLSTATS#040000 2> /dev/null
fi fi

View file

@ -43,5 +43,3 @@ SDL_MIXER_LIBS = \
LIBS += \ LIBS += \
$$SDL_LIBS \ $$SDL_LIBS \
$$SDL_MIXER_LIBS $$SDL_MIXER_LIBS
DISTFILES +=

View file

@ -25,9 +25,9 @@
SHRShad gequ $012000 SHRShad gequ $012000
savedDBR data ; Storage for Data Bank Register ;savedDBR data ; Storage for Data Bank Register
ds 2 ; 16 bits ; ds 2 ; 16 bits
end ; Used by jIIgs.macro ; end ; Used by jIIgs.macro
ScanTable data ScanTable data
ds 400 ; 400 bytes for scanline offsets ds 400 ; 400 bytes for scanline offsets

View file

@ -45,13 +45,13 @@ typedef struct {
} _jlPascalStringT; } _jlPascalStringT;
extern void asmBorder(int c); extern void asmBorder(jint16 c);
extern void asmGrOff(void); extern void asmGrOff(void);
extern void asmGrOn(void); extern void asmGrOn(void);
//extern int asmJoy(int which); //extern int asmJoy(int which);
extern int asmJoy(void); extern int asmJoy(void);
extern void asmSlam(void); extern void asmSlam(void);
extern void asmStart(int myID, int hertzBy10); extern void asmStart(jint16 myID, jint16 hertzBy10);
extern void asmStop(void); extern void asmStop(void);
@ -78,11 +78,11 @@ static byte *BORDER = (byte *)0xE0C034;
static byte _jlBorderSaved; static byte _jlBorderSaved;
static int _jlMyID; static jint16 _jlMyID;
static int _jlMemID; static jint16 _jlMemID;
static int _jlMusicMemID; static jint16 _jlMusicMemID;
static Handle _jlSHRShadowHandle; static Handle _jlSHRShadowHandle;
static int _jlHertz; static jint16 _jlHertz;
#ifdef JOEY_DEBUG #ifdef JOEY_DEBUG
@ -117,8 +117,8 @@ void jlDrawClear(void) {
int jlGameGetAxis(byte which) { int jlGameGetAxis(byte which) {
static bool xRead = true; static bool xRead = true;
static bool yRead = true; static bool yRead = true;
static int paddles = 0; static jint16 paddles = 0;
int r; jint16 r;
if (which == 0) { if (which == 0) {
if (xRead) { if (xRead) {
@ -227,9 +227,10 @@ void jlSoundMusicPause(void) {
void jlSoundMusicPlay(char *name) { void jlSoundMusicPlay(char *name) {
char *temp = jlUtilMakePathname(name, NULL);
_jlPascalStringT file; _jlPascalStringT file;
strcpy(file.text, name); strcpy(file.text, temp);
file.length = strlen(name); file.length = strlen(temp);
NTStartUp(_jlMusicMemID); NTStartUp(_jlMusicMemID);
JOEY_CHECK_TOOL_ERROR("NTStartup") JOEY_CHECK_TOOL_ERROR("NTStartup")
NTLoadOneMusic((Pointer)&file); NTLoadOneMusic((Pointer)&file);
@ -308,9 +309,9 @@ void jlUtilShutdown(void) {
} }
void jlUtilStartup(char *appName) { void jlUtilStartup(char *appTitle) {
(void)appName; (void)appTitle; // Unused on IIgs
// Start up neded tools // Start up neded tools
TLStartUp(); TLStartUp();

View file

@ -1,3 +1,24 @@
;----------------------------------------
; JoeyLib
; Copyright (C) 2018 Scott Duensing <scott@kangaroopunch.com>
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source distribution.
;----------------------------------------
; ;
; Based on M16.cc from ORCA/C ; Based on M16.cc from ORCA/C
; ;
@ -47,8 +68,8 @@
; === START OF OUR MODIFICATION === ; === START OF OUR MODIFICATION ===
phb ; Push Data Bank Register phb ; Push Data Bank Register
phb ; Push Data Bank Register phb ; Push Data Bank Register
pla ; Pull Accumulator ; pla ; Pull Accumulator
sta >savedDBR ; Store Accumulator in savedDBR (Data Bank Register) ; sta >savedDBR ; Store Accumulator in savedDBR (Data Bank Register)
phk ; Push K (Program Bank Register) phk ; Push K (Program Bank Register)
plb ; Pull Data Bank Register plb ; Pull Data Bank Register
; === END OF OUR MODIFICATION === ; === END OF OUR MODIFICATION ===
@ -61,9 +82,9 @@
&lab anop &lab anop
; === START OF OUR MODIFICATION === ; === START OF OUR MODIFICATION ===
using savedDBR ; using savedDBR
lda >savedDBR ; Load our saved Data Bank Register ; lda >savedDBR ; Load our saved Data Bank Register
pha ; Push the C Accumulator ; pha ; Push the C Accumulator
plb ; Pull Data Bank Register plb ; Pull Data Bank Register
plb ; Pull Data Bank Register plb ; Pull Data Bank Register
; === END OF OUR MODIFICATION === ; === END OF OUR MODIFICATION ===

View file

@ -36,12 +36,12 @@ static jlStaT *_jlBackingStore = NULL; // 4 bit representatio
static SDL_Texture *_jlTexture = NULL; // Video card representation in ARGB static SDL_Texture *_jlTexture = NULL; // Video card representation in ARGB
static SDL_PixelFormat *_jlPixelFormat = NULL; // Pixel format of _jlTexture static SDL_PixelFormat *_jlPixelFormat = NULL; // Pixel format of _jlTexture
static bool _jlIsRunning = true; static bool _jlIsRunning = true;
static int _jlNumKeysDown = 0; static jint16 _jlNumKeysDown = 0;
static char _jlLastKey = 0; static char _jlLastKey = 0;
static Mix_Music *_jlMusicHandle = NULL; static Mix_Music *_jlMusicHandle = NULL;
static SDL_GameController **_jlControllers = NULL; static SDL_GameController **_jlControllers = NULL;
static int _jlControllerCount = 0; static jint16 _jlControllerCount = 0;
static unsigned int _jlTimerValue = 0; static juint16 _jlTimerValue = 0;
static SDL_TimerID _jlTimerId = 0; static SDL_TimerID _jlTimerId = 0;
@ -155,7 +155,7 @@ void jlDisplayPresent(void) {
} }
void jlDrawBlit8x8(jlStaT *sta, int cx1, int cy1, int cx2, int cy2) { void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2) {
int o1; int o1;
int o2; int o2;
int x; int x;
@ -179,13 +179,13 @@ void jlDrawClear(void) {
} }
byte jlDrawGetPixel(int x, int y) { byte jlDrawGetPixel(jint16 x, jint16 y) {
int p = x / 2 + y * 160; int p = x / 2 + y * 160;
return (jlUtilIsOdd(x) ? _jlBackingStore->pixels[p].l : _jlBackingStore->pixels[p].r); return (jlUtilIsOdd(x) ? _jlBackingStore->pixels[p].l : _jlBackingStore->pixels[p].r);
} }
void jlDrawPoint(int x, int y) { void jlDrawPoint(jint16 x, jint16 y) {
jlPixelPairT *pixelPair = _jlBackingStore->pixels + (y * 160) + (x / 2); jlPixelPairT *pixelPair = _jlBackingStore->pixels + (y * 160) + (x / 2);
if (jlUtilIsOdd(x)) { if (jlUtilIsOdd(x)) {
pixelPair->l = _jlDrawColor; pixelPair->l = _jlDrawColor;
@ -195,7 +195,7 @@ void jlDrawPoint(int x, int y) {
} }
int jlGameGetAxis(byte which) { jint16 jlGameGetAxis(byte which) {
SDL_GameControllerAxis axis; SDL_GameControllerAxis axis;
short int unscaled; short int unscaled;
short int max = SHRT_MIN; short int max = SHRT_MIN;
@ -288,7 +288,7 @@ bool jlSoundIsPlaying(jlSoundT *sound) {
bool _jlSoundLoad(jlSoundT **sound, char *filename) { bool _jlSoundLoad(jlSoundT **sound, char *filename) {
bool result = false; bool result = false;
Mix_Chunk *sample; Mix_Chunk *sample;
sample = Mix_LoadWAV(filename); sample = Mix_LoadWAV(jlUtilMakePathname(filename, "ogg"));
if (sample) { if (sample) {
if (*sound != NULL) { if (*sound != NULL) {
jlSoundFree(*sound); jlSoundFree(*sound);
@ -321,16 +321,14 @@ void jlSoundMusicPause(void) {
void jlSoundMusicPlay(char *name) { void jlSoundMusicPlay(char *name) {
char temp[256];
if (_jlMusicHandle != NULL) { if (_jlMusicHandle != NULL) {
jlSoundMusicStop(); jlSoundMusicStop();
} }
snprintf(temp, 256, "%s.mod", name); _jlMusicHandle = Mix_LoadMUS(jlUtilMakePathname(name, "mod"));
_jlMusicHandle = Mix_LoadMUS(temp);
if (_jlMusicHandle != NULL) { if (_jlMusicHandle != NULL) {
Mix_PlayMusic(_jlMusicHandle, 1); Mix_PlayMusic(_jlMusicHandle, 1);
} else { } else {
printf("Unable to load %s\n", temp); printf("Unable to load %s\n", jlUtilMakePathname(name, "mod"));
} }
} }
@ -347,7 +345,7 @@ void jlSoundMusicStop(void) {
void jlSoundPlay(jlSoundT *sound) { void jlSoundPlay(jlSoundT *sound) {
sound->channel = Mix_PlayChannel(-1, (Mix_Chunk *)sound->data, 0); sound->channel = (jint16)Mix_PlayChannel(-1, (Mix_Chunk *)sound->data, 0);
} }
@ -484,7 +482,7 @@ void jlUtilShutdown(void) {
} }
void jlUtilStartup(char *appName) { void jlUtilStartup(char *appTitle) {
int flags; int flags;
int result; int result;
@ -516,7 +514,7 @@ void jlUtilStartup(char *appName) {
} }
// Create a window and renderer using SDL // Create a window and renderer using SDL
_jlWindow = SDL_CreateWindow(appName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); _jlWindow = SDL_CreateWindow(appTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
_jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE); _jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE);
_jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200); _jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
_jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow)); _jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));
@ -541,6 +539,6 @@ Uint32 _jlUtilTimer(Uint32 interval, void *param) {
} }
unsigned int jlUtilTimer(void) { juint16 jlUtilTimer(void) {
return _jlTimerValue; return _jlTimerValue;
} }

View file

@ -50,9 +50,9 @@
typedef struct { typedef struct {
int StartX; jint16 StartX;
int EndX; jint16 EndX;
int Y; jint16 Y;
signed char Dir; // 'signed' needs to be specified for ORCA/C signed char Dir; // 'signed' needs to be specified for ORCA/C
bool ScanLeft; bool ScanLeft;
bool ScanRight; bool ScanRight;
@ -63,6 +63,8 @@ typedef struct {
byte _jlDrawColor = 15; // Color in lower nibble only byte _jlDrawColor = 15; // Color in lower nibble only
byte _jlDrawColorNibbles = (15 << 4) + 15; // Color in both nibbles byte _jlDrawColorNibbles = (15 << 4) + 15; // Color in both nibbles
byte _jlBorderColor = 0; byte _jlBorderColor = 0;
char *_jlAppName = NULL;
char _jlTempString[1024];
static jlColorT _jlDefaultPalette[16]; static jlColorT _jlDefaultPalette[16];
@ -70,10 +72,10 @@ static jlStackT *_jlFillStackTop = NULL;
static byte _jlDrawFillColor = 0; static byte _jlDrawFillColor = 0;
void _jlDrawCircleClipped(int x0, int y0, int radius); void _jlDrawCircleClipped(jint16 x0, jint16 y0, jint16 radius);
void _jlDrawFill(int x, int y, bool how); void _jlDrawFill(jint16 x, jint16 y, bool how);
void _jlDrawFillAddLine(int startX, int endX, int y, int ignoreStart, int ignoreEnd, char dir, bool isNextInDir, bool how); void _jlDrawFillAddLine(jint16 startX, jint16 endX, jint16 y, jint16 ignoreStart, jint16 ignoreEnd, char dir, bool isNextInDir, bool how);
_jlScanDataT *_jlDrawFillNewSegment(int startX, int endX, int y, signed char dir, bool scanLeft, bool scanRight); _jlScanDataT *_jlDrawFillNewSegment(jint16 startX, jint16 endX, jint16 y, signed char dir, bool scanLeft, bool scanRight);
#ifdef JOEY_DEBUG #ifdef JOEY_DEBUG
@ -87,7 +89,7 @@ static long _jlBlocksNeeded = 0;
static bool _jlMemoryStarted = false; static bool _jlMemoryStarted = false;
void _jlFree(void **pointer) { void _jlFree(void **pointer) {
int i; jint16 i;
_jlTotalFrees++; _jlTotalFrees++;
if (*pointer != NULL) { if (*pointer != NULL) {
@ -106,8 +108,8 @@ void _jlFree(void **pointer) {
} }
} }
void *_jlMalloc(size_t size, int line, char *file) { void *_jlMalloc(size_t size, jint16 line, char *file) {
int i; jint16 i;
if (!_jlMemoryStarted) { if (!_jlMemoryStarted) {
memset(_jlMemoryBlocks, 0, sizeof(_jlMemoryBlocks)); memset(_jlMemoryBlocks, 0, sizeof(_jlMemoryBlocks));
@ -137,7 +139,7 @@ void *_jlMalloc(size_t size, int line, char *file) {
} }
void *_jlRealloc(void *pointer, size_t size) { void *_jlRealloc(void *pointer, size_t size) {
int i = 0; jint16 i = 0;
size_t diff = 0; size_t diff = 0;
if (pointer != NULL) { if (pointer != NULL) {
@ -169,7 +171,7 @@ void jlDisplayBorder(jlBorderColorsE color) {
} }
void jlDrawBox(int x1, int y1, int x2, int y2) { void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
jlDrawLine(x1, y1, x2, y1); jlDrawLine(x1, y1, x2, y1);
jlDrawLine(x2, y1, x2, y2); jlDrawLine(x2, y1, x2, y2);
jlDrawLine(x2, y2, x1, y2); jlDrawLine(x2, y2, x1, y2);
@ -177,20 +179,20 @@ void jlDrawBox(int x1, int y1, int x2, int y2) {
} }
void jlDrawBoxFilled(int x1, int y1, int x2, int y2) { void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
int y; jint16 y;
for (y=y1; y<=y2; y++) { for (y=y1; y<=y2; y++) {
jlDrawLine(x1, y, x2, y); jlDrawLine(x1, y, x2, y);
} }
} }
void _jlDrawCircleClipped(int x0, int y0, int radius) { void _jlDrawCircleClipped(jint16 x0, jint16 y0, jint16 radius) {
int x = radius-1; jint16 x = radius-1;
int y = 0; jint16 y = 0;
int dx = 1; jint16 dx = 1;
int dy = 1; jint16 dy = 1;
int err = dx - (radius << 1); jint16 err = dx - (jint16)(radius << 1);
while (x >= y) { while (x >= y) {
if ((x0 + x < 320) && (y0 + y < 200)) jlDrawPoint(x0 + x, y0 + y); if ((x0 + x < 320) && (y0 + y < 200)) jlDrawPoint(x0 + x, y0 + y);
@ -217,12 +219,12 @@ void _jlDrawCircleClipped(int x0, int y0, int radius) {
} }
void jlDrawCircle(int x0, int y0, int radius) { void jlDrawCircle(jint16 x0, jint16 y0, jint16 radius) {
int x = radius-1; jint16 x = radius-1;
int y = 0; jint16 y = 0;
int dx = 1; jint16 dx = 1;
int dy = 1; jint16 dy = 1;
int err = dx - (radius << 1); jint16 err = dx - (jint16)(radius << 1);
// Is any of this going to be off the screen? // Is any of this going to be off the screen?
//***TODO*** All our drawing primitives should do this. //***TODO*** All our drawing primitives should do this.
@ -263,8 +265,8 @@ void jlDrawColor(byte index) {
// http://members.chello.at/~easyfilter/bresenham.html // http://members.chello.at/~easyfilter/bresenham.html
void jlDrawEllipse(int x0, int y0, int x1, int y1) { void jlDrawEllipse(jint16 x0, jint16 y0, jint16 x1, jint16 y1) {
int a = abs(x1-x0), b = abs(y1-y0), b1 = b&1; /* values of diameter */ jint16 a = (jint16)abs(x1-x0), b = (jint16)abs(y1-y0), b1 = b&1; /* values of diameter */
long dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a; /* error increment */ long dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a; /* error increment */
long err = dx+dy+b1*a*a, e2; /* error of 1.step */ long err = dx+dy+b1*a*a, e2; /* error of 1.step */
@ -292,7 +294,7 @@ void jlDrawEllipse(int x0, int y0, int x1, int y1) {
} }
_jlScanDataT *_jlDrawFillNewSegment(int startX, int endX, int y, signed char dir, bool scanLeft, bool scanRight) { _jlScanDataT *_jlDrawFillNewSegment(jint16 startX, jint16 endX, jint16 y, signed char dir, bool scanLeft, bool scanRight) {
_jlScanDataT *s = (_jlScanDataT *)jlMalloc(sizeof(_jlScanDataT)); _jlScanDataT *s = (_jlScanDataT *)jlMalloc(sizeof(_jlScanDataT));
s->StartX = startX; s->StartX = startX;
s->EndX = endX; s->EndX = endX;
@ -304,9 +306,9 @@ _jlScanDataT *_jlDrawFillNewSegment(int startX, int endX, int y, signed char dir
} }
void _jlDrawFillAddLine(int startX, int endX, int y, int ignoreStart, int ignoreEnd, char dir, bool isNextInDir, bool how) { void _jlDrawFillAddLine(jint16 startX, jint16 endX, jint16 y, jint16 ignoreStart, jint16 ignoreEnd, char dir, bool isNextInDir, bool how) {
int regionStart = -1; jint16 regionStart = -1;
int x; jint16 x;
for (x=startX; x<endX; x++) { for (x=startX; x<endX; x++) {
if (how) { if (how) {
@ -337,12 +339,12 @@ void _jlDrawFillAddLine(int startX, int endX, int y, int ignoreStart, int ignore
// Stole this from http://www.adammil.net/blog/v126_A_More_Efficient_Flood_Fill.html // Stole this from http://www.adammil.net/blog/v126_A_More_Efficient_Flood_Fill.html
void _jlDrawFill(int x, int y, bool how) { void _jlDrawFill(jint16 x, jint16 y, bool how) {
int height = 200; jint16 height = 200;
int width = 320; jint16 width = 320;
_jlScanDataT *r; _jlScanDataT *r;
int startX; jint16 startX;
int endX; jint16 endX;
// how == true; Fill on top of _jlDrawFillColor // how == true; Fill on top of _jlDrawFillColor
// how == false; Fill on top of any color until we encounter _jlDrawFillColor // how == false; Fill on top of any color until we encounter _jlDrawFillColor
@ -376,26 +378,31 @@ void _jlDrawFill(int x, int y, bool how) {
} }
void jlDrawFill(int x, int y) { void jlDrawFill(jint16 x, jint16 y) {
_jlDrawFillColor = jlDrawGetPixel(x, y); _jlDrawFillColor = jlDrawGetPixel(x, y);
_jlDrawFill(x, y, true); _jlDrawFill(x, y, true);
} }
void jlDrawFillTo(int x, int y, byte color) { void jlDrawFillTo(jint16 x, jint16 y, byte color) {
_jlDrawFillColor = color; _jlDrawFillColor = color;
_jlDrawFill(x, y, false); _jlDrawFill(x, y, false);
} }
void jlDrawLine(int x1, int y1, int x2, int y2) { byte jlDrawGetColor(void) {
int x; return _jlDrawColor;
int y; }
int dx;
int dy;
int incX; void jlDrawLine(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
int incY; jint16 x;
int balance; jint16 y;
jint16 dx;
jint16 dy;
jint16 incX;
jint16 incY;
jint16 balance;
if (x2 >= x1) { if (x2 >= x1) {
dx = x2 - x1; dx = x2 - x1;
@ -449,6 +456,7 @@ void jlDrawLine(int x1, int y1, int x2, int y2) {
void jlKeyWaitForAny(void) { void jlKeyWaitForAny(void) {
//***TODO*** I don't think this does what we think it does.
while (!jlKeyPressed() && !jlUtilMustExit()) ; while (!jlKeyPressed() && !jlUtilMustExit()) ;
jlKeyRead(); jlKeyRead();
while (jlKeyPressed() && !jlUtilMustExit()) ; while (jlKeyPressed() && !jlUtilMustExit()) ;
@ -518,7 +526,7 @@ bool _jlStaLoad(jlStaT **sta, char *filename) {
} }
s = (jlStaT *)*sta; s = (jlStaT *)*sta;
// Load into it. // Load into it.
f = fopen(filename, "rb"); f = fopen(jlUtilMakePathname(filename, "sta"), "rb");
if (f != NULL) { if (f != NULL) {
if (fread(s, sizeof(jlStaT), 1, f) > 0) { if (fread(s, sizeof(jlStaT), 1, f) > 0) {
// Is this a valid image file? // Is this a valid image file?
@ -536,7 +544,7 @@ bool jlStaSave(jlStaT *sta, char *filename) {
bool result = false; bool result = false;
FILE *f; FILE *f;
f = fopen(filename, "wb"); f = fopen(jlUtilMakePathname(filename, "sta"), "wb");
if (f != NULL) { if (f != NULL) {
if (fwrite(sta, sizeof(jlStaT), 1, f) > 0) { if (fwrite(sta, sizeof(jlStaT), 1, f) > 0) {
result = true; result = true;
@ -549,7 +557,7 @@ bool jlStaSave(jlStaT *sta, char *filename) {
__attribute__((__format__ (__printf__, 1, 0))) __attribute__((__format__ (__printf__, 1, 0)))
void jlUtilDie(const char *why, ...) { void jlUtilDie(const char *why, ...) {
#ifdef JOEY_DEBUG #ifdef JOEY_DEBUG
int i; jint16 i;
FILE *f = NULL; FILE *f = NULL;
char msg[80]; // Very short messages (screen width). Be careful! char msg[80]; // Very short messages (screen width). Be careful!
va_list va; va_list va;
@ -558,7 +566,7 @@ void jlUtilDie(const char *why, ...) {
vsprintf(msg, why, va); vsprintf(msg, why, va);
va_end(va); va_end(va);
f = fopen("JLSTATS", "wt"); f = fopen("JLSTATS", "wt"); // This doesn't use jlUtilMakePathname
if (f != NULL) { if (f != NULL) {
fprintf(f, "JoeyLib Statistics\n\n"); fprintf(f, "JoeyLib Statistics\n\n");
fprintf(f, " Allocations: %ld\n", _jlTotalAllocations); fprintf(f, " Allocations: %ld\n", _jlTotalAllocations);
@ -583,6 +591,25 @@ void jlUtilDie(const char *why, ...) {
} }
char *jlUtilMakePathname(char *filename, char *extension) {
char temp[2];
temp[0] = JOEY_PATH_SEPARATOR;
temp[1] = 0;
_jlTempString[0] = 0;
strcat(_jlTempString, "data");
strcat(_jlTempString, temp);
strcat(_jlTempString, filename);
if (extension != NULL) {
strcat(_jlTempString, ".");
strcat(_jlTempString, extension);
}
return _jlTempString;
}
void *_jlUtilStackPop(jlStackT **stack) { void *_jlUtilStackPop(jlStackT **stack) {
void *d = NULL; void *d = NULL;
jlStackT *s; jlStackT *s;
@ -605,14 +632,14 @@ void _jlUtilStackPush(jlStackT **stack, void *data) {
} }
void jlVecDisplay(jlVecT *vec, int ox, int oy) { void jlVecDisplay(jlVecT *vec, jint16 ox, jint16 oy) {
int command; jint16 command;
int count; jint16 count;
int i; jint16 i;
int x1; jint16 x1;
int y1; jint16 y1;
int x2; jint16 x2;
int y2; jint16 y2;
long p = 0; long p = 0;
while (p < vec->length) { while (p < vec->length) {
@ -631,7 +658,7 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_PLOT: case COMMAND_PLOT:
count = vec->data[p++]; count = vec->data[p++];
for (i=0; i<count; i += 2) { for (i=0; i<count; i += 2) {
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
jlDrawPoint(x1, y1); jlDrawPoint(x1, y1);
} }
@ -639,10 +666,10 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_LINE: case COMMAND_LINE:
count = vec->data[p++]; count = vec->data[p++];
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
for (i=2; i<count; i += 2) { for (i=2; i<count; i += 2) {
x2 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x2 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y2 = oy + vec->data[p++]; y2 = oy + vec->data[p++];
jlDrawLine(x1, y1, x2, y2); jlDrawLine(x1, y1, x2, y2);
x1 = x2; x1 = x2;
@ -653,7 +680,7 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_FILL: case COMMAND_FILL:
count = vec->data[p++]; count = vec->data[p++];
for (i=0; i<count; i += 2) { for (i=0; i<count; i += 2) {
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
jlDrawFill(x1, y1); jlDrawFill(x1, y1);
} }
@ -677,9 +704,9 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_HBOX: case COMMAND_HBOX:
count = vec->data[p++]; count = vec->data[p++];
for (i=0; i<count; i += 4) { for (i=0; i<count; i += 4) {
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
x2 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x2 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y2 = oy + vec->data[p++]; y2 = oy + vec->data[p++];
jlDrawBox(x1, y1, x2, y2); jlDrawBox(x1, y1, x2, y2);
} }
@ -688,9 +715,9 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_FBOX: case COMMAND_FBOX:
count = vec->data[p++]; count = vec->data[p++];
for (i=0; i<count; i += 4) { for (i=0; i<count; i += 4) {
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
x2 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x2 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y2 = oy + vec->data[p++]; y2 = oy + vec->data[p++];
jlDrawBoxFilled(x1, y1, x2, y2); jlDrawBoxFilled(x1, y1, x2, y2);
} }
@ -699,7 +726,7 @@ void jlVecDisplay(jlVecT *vec, int ox, int oy) {
case COMMAND_FILLTO: case COMMAND_FILLTO:
count = vec->data[p++]; count = vec->data[p++];
for (i=0; i<count; i += 2) { for (i=0; i<count; i += 2) {
x1 = ox + (int)(vec->data[p++] * VEC_SCALE_UP); x1 = ox + (jint16)(vec->data[p++] * VEC_SCALE_UP);
y1 = oy + vec->data[p++]; y1 = oy + vec->data[p++];
x2 =vec->data[p++]; x2 =vec->data[p++];
jlDrawFillTo(x1, y1, (byte)x2); jlDrawFillTo(x1, y1, (byte)x2);
@ -737,12 +764,12 @@ bool _jlVecLoad(jlVecT **vec, char *filename) {
*vec = v; *vec = v;
v = (jlVecT *)*vec; v = (jlVecT *)*vec;
// Load into it. // Load into it.
f = fopen(filename, "rb"); f = fopen(jlUtilMakePathname(filename, "vec"), "rb");
if (f != NULL) { if (f != NULL) {
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
size = ftell(f); size = ftell(f);
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
v->length = (unsigned int)((unsigned long)size - (sizeof(char) * 3) + (sizeof(byte))); v->length = (juint16)((unsigned long)size - (sizeof(char) * 3) + (sizeof(byte)));
// Load header. // Load header.
v->id[0] = (char)fgetc(f); v->id[0] = (char)fgetc(f);
v->id[1] = (char)fgetc(f); v->id[1] = (char)fgetc(f);

View file

@ -28,6 +28,77 @@
#include <stdlib.h> #include <stdlib.h>
// Determine platform and settings
#ifdef __linux__
#define JOEY_LINUX
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define JOEY_PATH_SEPARATOR '/'
#define segment(x)
typedef short jint16;
typedef unsigned short juint16;
#elif _WIN32
#define JOEY_WINDOWS
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define JOEY_PATH_SEPARATOR '\\'
#define segment(x)
typedef short jint16;
typedef unsigned short juint16;
#elif __APPLE__
#define JOEY_MACOS
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define JOEY_PATH_SEPARATOR '/'
#define segment(x)
typedef short jint16;
typedef unsigned short juint16;
#elif __ORCAC__
#define JOEY_IIGS
#define JOEY_LITLE_ENDIAN
#define JOEY_PATH_SEPARATOR '/'
#define __attribute__(x)
typedef int jint16;
typedef unsigned int juint16;
#ifdef JOEY_LIBRARY
#pragma noroot
segment "joeylib";
#endif
#pragma memorymodel 1
#pragma optimize -1
#pragma lint -1
#pragma debug 0
#elif AMIGA
#define JOEY_AMIGA
#define JOEY_BIG_ENDIAN
#define JOEY_PATH_SEPARATOR '/'
#define __attribute__(x)
#define segment(x)
typedef int jint16;
typedef unsigned int juint16;
#else
#define JOEY_ST
#define JOEY_BIG_ENDIAN
#define JOEY_PATH_SEPARATOR '/'
#define __attribute__(x)
#define segment(x)
typedef int jint16;
typedef unsigned int juint16;
#endif
#ifndef bool #ifndef bool
#define bool unsigned char #define bool unsigned char
#define true 1 #define true 1
@ -40,6 +111,7 @@
extern byte _jlDrawColor; extern byte _jlDrawColor;
extern byte _jlDrawColorNibbles; extern byte _jlDrawColorNibbles;
extern byte _jlBorderColor; extern byte _jlBorderColor;
extern char _jlTempString[1024];
enum _jlBorderColorsE { enum _jlBorderColorsE {
@ -77,7 +149,7 @@ typedef struct {
typedef struct { typedef struct {
void *data; void *data;
int channel; jint16 channel;
} jlSoundT; } jlSoundT;
typedef struct { typedef struct {
@ -95,7 +167,7 @@ typedef struct _jlStackS {
typedef struct { typedef struct {
char id[3]; char id[3];
byte version; byte version;
unsigned int length; juint16 length;
byte *data; byte *data;
} jlVecT; } jlVecT;
@ -109,14 +181,14 @@ typedef struct {
void *addr; void *addr;
char *file; char *file;
size_t size; size_t size;
int line; jint16 line;
} jlMemoryBlockT; } jlMemoryBlockT;
#define jlFree(p) _jlFree((void **)&(p)) #define jlFree(p) _jlFree((void **)&(p))
void _jlFree(void **pointer); void _jlFree(void **pointer);
#define jlMalloc(s) _jlMalloc(s, __LINE__, __FILE__) #define jlMalloc(s) _jlMalloc(s, __LINE__, __FILE__)
void *_jlMalloc(size_t size, int line, char *file); void *_jlMalloc(size_t size, jint16 line, char *file);
#define jlRealloc(p, s) _jlRealloc(p, s) #define jlRealloc(p, s) _jlRealloc(p, s)
void *_jlRealloc(void *pointer, size_t size); void *_jlRealloc(void *pointer, size_t size);
@ -129,90 +201,45 @@ void *_jlRealloc(void *pointer, size_t size);
#endif #endif
// Determine platform and settings
#ifdef __linux__
#define JOEY_LINUX
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define segment(x)
#elif _WIN32
#define JOEY_WINDOWS
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define segment(x)
#elif __APPLE__
#define JOEY_MACOS
#define JOEY_PC
#define JOEY_LITLE_ENDIAN
#define segment(x)
#elif __ORCAC__
#define JOEY_IIGS
#define JOEY_LITLE_ENDIAN
#define __attribute__(x)
#ifdef JOEY_LIBRARY
#pragma noroot
segment "joeylib";
#endif
#pragma memorymodel 1
#pragma optimize -1
#pragma lint -1
#pragma debug 0
#elif AMIGA
#define JOEY_AMIGA
#define JOEY_BIG_ENDIAN
#define __attribute__(x)
#define segment(x)
#else
#define JOEY_ST
#define JOEY_BIG_ENDIAN
#define __attribute__(x)
#define segment(x)
#endif
void jlDisplayBorder(jlBorderColorsE color); void jlDisplayBorder(jlBorderColorsE color);
void jlDisplayPresent(void); void jlDisplayPresent(void);
void jlDrawBlit8x8(jlStaT *sta, int cx1, int cy1, int cx2, int cy2);
void jlDrawBox(int x1, int y1, int x2, int y2); void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
void jlDrawBoxFilled(int x1, int y1, int x2, int y2); void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawCircle(int x, int y, int radius); void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawCircle(jint16 x, jint16 y, jint16 radius);
void jlDrawClear(void); void jlDrawClear(void);
void jlDrawColor(byte index); void jlDrawColor(byte index);
void jlDrawEllipse(int x1, int y1, int x2, int y2); void jlDrawEllipse(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawFill(int x, int y); void jlDrawFill(jint16 x, jint16 y);
void jlDrawFillTo(int x, int y, byte color); void jlDrawFillTo(jint16 x, jint16 y, byte color);
byte jlDrawGetPixel(int x, int y); byte jlDrawGetColor(void);
void jlDrawLine(int x1, int y1, int x2, int y2); byte jlDrawGetPixel(jint16 x, jint16 y);
void jlDrawPoint(int x, int y); void jlDrawLine(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
int jlGameGetAxis(byte which); void jlDrawPoint(jint16 x, jint16 y);
jint16 jlGameGetAxis(byte which);
bool jlGameGetButton(byte which); bool jlGameGetButton(byte which);
bool jlKeyPressed(void); bool jlKeyPressed(void);
char jlKeyRead(void); char jlKeyRead(void);
void jlKeyWaitForAny(void); void jlKeyWaitForAny(void);
void jlPaletteDefault(void); void jlPaletteDefault(void);
void jlPaletteSet(byte index, byte r, byte g, byte b); void jlPaletteSet(byte index, byte r, byte g, byte b);
void jlSoundFree(jlSoundT *sound); void jlSoundFree(jlSoundT *sound);
bool jlSoundIsPlaying(jlSoundT *sound); bool jlSoundIsPlaying(jlSoundT *sound);
#define jlSoundLoad(sound, filename) _jlSoundLoad((jlSoundT **)&(sound), filename) // Syntatic Sugar #define jlSoundLoad(sound, filename) _jlSoundLoad((jlSoundT **)&(sound), filename) // Syntatic Sugar
bool _jlSoundLoad(jlSoundT **sound, char *filename); bool _jlSoundLoad(jlSoundT **sound, char *filename);
void jlSoundMusicContinue(void); void jlSoundMusicContinue(void);
bool jlSoundMusicIsPlaying(void); bool jlSoundMusicIsPlaying(void);
void jlSoundMusicPause(void); void jlSoundMusicPause(void);
void jlSoundMusicPlay(char *name); void jlSoundMusicPlay(char *name);
void jlSoundMusicStop(void); void jlSoundMusicStop(void);
void jlSoundPlay(jlSoundT *sound); void jlSoundPlay(jlSoundT *sound);
#define jlStaCopy(source, target) _jlStaCopy(source, (jlStaT **)&(target)) // Syntatic Sugar #define jlStaCopy(source, target) _jlStaCopy(source, (jlStaT **)&(target)) // Syntatic Sugar
bool _jlStaCopy(jlStaT *source, jlStaT **target); bool _jlStaCopy(jlStaT *source, jlStaT **target);
#define jlStaCreate(sta) _jlStaCreate((jlStaT **)&(sta)) // Syntatic Sugar #define jlStaCreate(sta) _jlStaCreate((jlStaT **)&(sta)) // Syntatic Sugar
@ -222,18 +249,22 @@ void jlStaFree(jlStaT *sta);
#define jlStaLoad(sta, filename) _jlStaLoad((jlStaT **)&(sta), filename) // Syntatic Sugar #define jlStaLoad(sta, filename) _jlStaLoad((jlStaT **)&(sta), filename) // Syntatic Sugar
bool _jlStaLoad(jlStaT **sta, char *filename); bool _jlStaLoad(jlStaT **sta, char *filename);
bool jlStaSave(jlStaT *sta, char *filename); bool jlStaSave(jlStaT *sta, char *filename);
void jlUtilDie(const char *why, ...) __attribute__((noreturn)); void jlUtilDie(const char *why, ...) __attribute__((noreturn));
void jlUtilIdle(void); void jlUtilIdle(void);
#define jlUtilIsOdd(x) (((x & 1) == 1) ? true:false) #define jlUtilIsOdd(x) (((x & 1) == 1) ? true : false)
char *jlUtilMakePathname(char *filename, char *extension);
bool jlUtilMustExit(void); bool jlUtilMustExit(void);
void jlUtilShutdown(void) __attribute__((noreturn)); void jlUtilShutdown(void) __attribute__((noreturn));
#define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar #define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar
void *_jlUtilStackPop(jlStackT **stack); void *_jlUtilStackPop(jlStackT **stack);
#define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar #define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar
void _jlUtilStackPush(jlStackT **stack, void *data); void _jlUtilStackPush(jlStackT **stack, void *data);
void jlUtilStartup(char *appName); void jlUtilStartup(char *appTitle);
unsigned int jlUtilTimer(void); juint16 jlUtilTimer(void);
void jlVecDisplay(jlVecT *vec, int x, int y); #define jlUtilTimeSpan(past, current) (past < current ? current - past : 65536 - past - current)
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
void jlVecFree(jlVecT *vec); void jlVecFree(jlVecT *vec);
#define jlVecLoad(vec, filename) _jlVecLoad((jlVecT **)&(vec), filename) // Syntatic Sugar #define jlVecLoad(vec, filename) _jlVecLoad((jlVecT **)&(vec), filename) // Syntatic Sugar
bool _jlVecLoad(jlVecT **vec, char *filename); bool _jlVecLoad(jlVecT **vec, char *filename);
@ -241,10 +272,10 @@ bool _jlVecLoad(jlVecT **vec, char *filename);
#ifdef JOEY_IIGS #ifdef JOEY_IIGS
// Inlined functions - asm code // Inlined functions - asm code
extern void asmB88(byte *p, int cx1, int cy1, int cx2, int cy2); extern void asmB88(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
extern void asmPoint(int color, int x, int y); extern void asmPoint(jint16 color, jint16 x, jint16 y);
extern int asmGetPoint(int x, int y); extern jint16 asmGetPoint(jint16 x, jint16 y);
extern unsigned int asmGetVbl(void); extern juint16 asmGetVbl(void);
// Inlined functions // Inlined functions
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2); #define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2);

View file

@ -35,10 +35,10 @@ segment "testapp";
// Font hacking! // Font hacking!
__attribute__((__format__ (__printf__, 4, 0))) __attribute__((__format__ (__printf__, 4, 0)))
void printAt(jlStaT *font, int cx, int cy, const char *what, ...) { void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
int x; jint16 x;
int y; jint16 y;
int counter; jint16 counter;
char msg[40]; // Very short messages (screen width). Be careful! char msg[40]; // Very short messages (screen width). Be careful!
va_list va; va_list va;
@ -47,8 +47,8 @@ void printAt(jlStaT *font, int cx, int cy, const char *what, ...) {
va_end(va); va_end(va);
for (counter=0; counter<(int)strlen(msg); counter++) { for (counter=0; counter<(int)strlen(msg); counter++) {
y = (msg[counter] - ' ') / 40;
x = (msg[counter] - ' ') % 40; x = (msg[counter] - ' ') % 40;
y = (msg[counter] - ' ') / 40;
jlDrawBlit8x8(font, x, y, counter + cx, cy); jlDrawBlit8x8(font, x, y, counter + cx, cy);
} }
} }
@ -58,12 +58,12 @@ int main(void) {
jlStaT *kanga = NULL; jlStaT *kanga = NULL;
jlStaT *font = NULL; jlStaT *font = NULL;
int y; jint16 y;
jlUtilStartup("JoeyLib Test"); jlUtilStartup("JoeyLib Test");
jlStaLoad(kanga, "kanga.sta"); jlStaLoad(kanga, "kanga");
jlStaLoad(font, "font.sta"); jlStaLoad(font, "font");
jlStaDisplay(kanga); jlStaDisplay(kanga);
jlDrawColor(1); jlDrawColor(1);