Commit 750c0733 authored by Scott Duensing's avatar Scott Duensing

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

parent 5ba7a73f
......@@ -5,3 +5,4 @@ src/SDL2/
src/music
src/music.w
src/*.dis
src/*.map
#!/bin/bash -e
if [ -d ${JOEY}/sdks/iix/IIgs/out/joey ]; then
rm -rf ${JOEY}/sdks/iix/IIgs/out/joey
OUT=${JOEY}/sdks/iix/IIgs/out/joey
if [ -d ${OUT} ]; then
rm -rf ${OUT}
fi
mkdir -p ${JOEY}/sdks/iix/IIgs/out/joey
mkdir -p ${OUT}
pushd ${JOEY}/joeylib/src
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
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/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
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
./gsplus -config IIgsTest.cfg || true
popd
echo ""
${AC}/export.sh JLSTATS
cat JLSTATS
${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS ${OUT} > /dev/null
cat ${OUT}/JLSTATS#040000 2> /dev/null
fi
......@@ -43,5 +43,3 @@ SDL_MIXER_LIBS = \
LIBS += \
$$SDL_LIBS \
$$SDL_MIXER_LIBS
DISTFILES +=
......@@ -25,9 +25,9 @@
SHRShad gequ $012000
savedDBR data ; Storage for Data Bank Register
ds 2 ; 16 bits
end ; Used by jIIgs.macro
;savedDBR data ; Storage for Data Bank Register
; ds 2 ; 16 bits
; end ; Used by jIIgs.macro
ScanTable data
ds 400 ; 400 bytes for scanline offsets
......
......@@ -45,13 +45,13 @@ typedef struct {
} _jlPascalStringT;
extern void asmBorder(int c);
extern void asmBorder(jint16 c);
extern void asmGrOff(void);
extern void asmGrOn(void);
//extern int asmJoy(int which);
extern int asmJoy(void);
extern void asmSlam(void);
extern void asmStart(int myID, int hertzBy10);
extern void asmStart(jint16 myID, jint16 hertzBy10);
extern void asmStop(void);
......@@ -78,11 +78,11 @@ static byte *BORDER = (byte *)0xE0C034;
static byte _jlBorderSaved;
static int _jlMyID;
static int _jlMemID;
static int _jlMusicMemID;
static jint16 _jlMyID;
static jint16 _jlMemID;
static jint16 _jlMusicMemID;
static Handle _jlSHRShadowHandle;
static int _jlHertz;
static jint16 _jlHertz;
#ifdef JOEY_DEBUG
......@@ -115,10 +115,10 @@ void jlDrawClear(void) {
int jlGameGetAxis(byte which) {
static bool xRead = true;
static bool yRead = true;
static int paddles = 0;
int r;
static bool xRead = true;
static bool yRead = true;
static jint16 paddles = 0;
jint16 r;
if (which == 0) {
if (xRead) {
......@@ -227,9 +227,10 @@ void jlSoundMusicPause(void) {
void jlSoundMusicPlay(char *name) {
char *temp = jlUtilMakePathname(name, NULL);
_jlPascalStringT file;
strcpy(file.text, name);
file.length = strlen(name);
strcpy(file.text, temp);
file.length = strlen(temp);
NTStartUp(_jlMusicMemID);
JOEY_CHECK_TOOL_ERROR("NTStartup")
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
TLStartUp();
......
;----------------------------------------
; 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
;
......@@ -47,8 +68,8 @@
; === START OF OUR MODIFICATION ===
phb ; Push Data Bank Register
phb ; Push Data Bank Register
pla ; Pull Accumulator
sta >savedDBR ; Store Accumulator in savedDBR (Data Bank Register)
; pla ; Pull Accumulator
; sta >savedDBR ; Store Accumulator in savedDBR (Data Bank Register)
phk ; Push K (Program Bank Register)
plb ; Pull Data Bank Register
; === END OF OUR MODIFICATION ===
......@@ -61,9 +82,9 @@
&lab anop
; === START OF OUR MODIFICATION ===
using savedDBR
lda >savedDBR ; Load our saved Data Bank Register
pha ; Push the C Accumulator
; using savedDBR
; lda >savedDBR ; Load our saved Data Bank Register
; pha ; Push the C Accumulator
plb ; Pull Data Bank Register
plb ; Pull Data Bank Register
; === END OF OUR MODIFICATION ===
......
......@@ -36,12 +36,12 @@ static jlStaT *_jlBackingStore = NULL; // 4 bit representatio
static SDL_Texture *_jlTexture = NULL; // Video card representation in ARGB
static SDL_PixelFormat *_jlPixelFormat = NULL; // Pixel format of _jlTexture
static bool _jlIsRunning = true;
static int _jlNumKeysDown = 0;
static jint16 _jlNumKeysDown = 0;
static char _jlLastKey = 0;
static Mix_Music *_jlMusicHandle = NULL;
static SDL_GameController **_jlControllers = NULL;
static int _jlControllerCount = 0;
static unsigned int _jlTimerValue = 0;
static jint16 _jlControllerCount = 0;
static juint16 _jlTimerValue = 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 o2;
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;
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);
if (jlUtilIsOdd(x)) {
pixelPair->l = _jlDrawColor;
......@@ -195,7 +195,7 @@ void jlDrawPoint(int x, int y) {
}
int jlGameGetAxis(byte which) {
jint16 jlGameGetAxis(byte which) {
SDL_GameControllerAxis axis;
short int unscaled;
short int max = SHRT_MIN;
......@@ -288,7 +288,7 @@ bool jlSoundIsPlaying(jlSoundT *sound) {
bool _jlSoundLoad(jlSoundT **sound, char *filename) {
bool result = false;
Mix_Chunk *sample;
sample = Mix_LoadWAV(filename);
sample = Mix_LoadWAV(jlUtilMakePathname(filename, "ogg"));
if (sample) {
if (*sound != NULL) {
jlSoundFree(*sound);
......@@ -321,16 +321,14 @@ void jlSoundMusicPause(void) {
void jlSoundMusicPlay(char *name) {
char temp[256];
if (_jlMusicHandle != NULL) {
jlSoundMusicStop();
}
snprintf(temp, 256, "%s.mod", name);
_jlMusicHandle = Mix_LoadMUS(temp);
_jlMusicHandle = Mix_LoadMUS(jlUtilMakePathname(name, "mod"));
if (_jlMusicHandle != NULL) {
Mix_PlayMusic(_jlMusicHandle, 1);
} 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) {
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 result;
......@@ -516,7 +514,7 @@ void jlUtilStartup(char *appName) {
}
// 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);
_jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
_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;
}
This diff is collapsed.
......@@ -28,6 +28,77 @@
#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
#define bool unsigned char
#define true 1
......@@ -37,9 +108,10 @@
#define byte unsigned char
extern byte _jlDrawColor;
extern byte _jlDrawColorNibbles;
extern byte _jlBorderColor;
extern byte _jlDrawColor;
extern byte _jlDrawColorNibbles;
extern byte _jlBorderColor;
extern char _jlTempString[1024];
enum _jlBorderColorsE {
......@@ -76,8 +148,8 @@ typedef struct {
} jlPixelPairT;
typedef struct {
void *data;
int channel;
void *data;
jint16 channel;
} jlSoundT;
typedef struct {
......@@ -93,10 +165,10 @@ typedef struct _jlStackS {
} jlStackT;
typedef struct {
char id[3];
byte version;
unsigned int length;
byte *data;
char id[3];
byte version;
juint16 length;
byte *data;
} jlVecT;
......@@ -109,14 +181,14 @@ typedef struct {
void *addr;
char *file;
size_t size;
int line;
jint16 line;
} jlMemoryBlockT;
#define jlFree(p) _jlFree((void **)&(p))
void _jlFree(void **pointer);
#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)
void *_jlRealloc(void *pointer, size_t size);
......@@ -129,90 +201,45 @@ void *_jlRealloc(void *pointer, size_t size);
#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 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 jlDrawBoxFilled(int x1, int y1, int x2, int y2);
void jlDrawCircle(int x, int y, int radius);
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawCircle(jint16 x, jint16 y, jint16 radius);
void jlDrawClear(void);
void jlDrawColor(byte index);
void jlDrawEllipse(int x1, int y1, int x2, int y2);
void jlDrawFill(int x, int y);
void jlDrawFillTo(int x, int y, byte color);
byte jlDrawGetPixel(int x, int y);
void jlDrawLine(int x1, int y1, int x2, int y2);
void jlDrawPoint(int x, int y);
int jlGameGetAxis(byte which);
void jlDrawEllipse(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawFill(jint16 x, jint16 y);
void jlDrawFillTo(jint16 x, jint16 y, byte color);
byte jlDrawGetColor(void);
byte jlDrawGetPixel(jint16 x, jint16 y);
void jlDrawLine(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawPoint(jint16 x, jint16 y);
jint16 jlGameGetAxis(byte which);
bool jlGameGetButton(byte which);
bool jlKeyPressed(void);
char jlKeyRead(void);
void jlKeyWaitForAny(void);
void jlPaletteDefault(void);
void jlPaletteSet(byte index, byte r, byte g, byte b);
void jlSoundFree(jlSoundT *sound);
bool jlSoundIsPlaying(jlSoundT *sound);
#define jlSoundLoad(sound, filename) _jlSoundLoad((jlSoundT **)&(sound), filename) // Syntatic Sugar
bool _jlSoundLoad(jlSoundT **sound, char *filename);
void jlSoundMusicContinue(void);
bool jlSoundMusicIsPlaying(void);
void jlSoundMusicPause(void);
void jlSoundMusicPlay(char *name);
void jlSoundMusicStop(void);
void jlSoundPlay(jlSoundT *sound);
#define jlStaCopy(source, target) _jlStaCopy(source, (jlStaT **)&(target)) // Syntatic Sugar
bool _jlStaCopy(jlStaT *source, jlStaT **target);
#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
bool _jlStaLoad(jlStaT **sta, char *filename);
bool jlStaSave(jlStaT *sta, char *filename);
void jlUtilDie(const char *why, ...) __attribute__((noreturn));
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);
void jlUtilShutdown(void) __attribute__((noreturn));
#define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar
void *_jlUtilStackPop(jlStackT **stack);
#define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar
void _jlUtilStackPush(jlStackT **stack, void *data);
void jlUtilStartup(char *appName);
unsigned int jlUtilTimer(void);
void jlVecDisplay(jlVecT *vec, int x, int y);
void jlUtilStartup(char *appTitle);
juint16 jlUtilTimer(void);
#define jlUtilTimeSpan(past, current) (past < current ? current - past : 65536 - past - current)
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
void jlVecFree(jlVecT *vec);
#define jlVecLoad(vec, filename) _jlVecLoad((jlVecT **)&(vec), filename) // Syntatic Sugar
bool _jlVecLoad(jlVecT **vec, char *filename);
......@@ -241,10 +272,10 @@ bool _jlVecLoad(jlVecT **vec, char *filename);
#ifdef JOEY_IIGS
// Inlined functions - asm code
extern void asmB88(byte *p, int cx1, int cy1, int cx2, int cy2);
extern void asmPoint(int color, int x, int y);
extern int asmGetPoint(int x, int y);
extern unsigned int asmGetVbl(void);
extern void asmB88(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
extern void asmPoint(jint16 color, jint16 x, jint16 y);
extern jint16 asmGetPoint(jint16 x, jint16 y);
extern juint16 asmGetVbl(void);
// Inlined functions
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2);
......
......@@ -35,11 +35,11 @@ segment "testapp";
// Font hacking!
__attribute__((__format__ (__printf__, 4, 0)))
void printAt(jlStaT *font, int cx, int cy, const char *what, ...) {
int x;
int y;
int counter;
char msg[40]; // Very short messages (screen width). Be careful!
void printAt(jlStaT *font, jint16 cx, jint16 cy, const char *what, ...) {
jint16 x;
jint16 y;
jint16 counter;
char msg[40]; // Very short messages (screen width). Be careful!
va_list va;
va_start(va, what);
......@@ -47,8 +47,8 @@ void printAt(jlStaT *font, int cx, int cy, const char *what, ...) {
va_end(va);
for (counter=0; counter<(int)strlen(msg); counter++) {
y = (msg[counter] - ' ') / 40;
x = (msg[counter] - ' ') % 40;
y = (msg[counter] - ' ') / 40;
jlDrawBlit8x8(font, x, y, counter + cx, cy);
}
}
......@@ -58,12 +58,12 @@ int main(void) {
jlStaT *kanga = NULL;
jlStaT *font = NULL;
int y;
jint16 y;
jlUtilStartup("JoeyLib Test");
jlStaLoad(kanga, "kanga.sta");
jlStaLoad(font, "font.sta");
jlStaLoad(kanga, "kanga");
jlStaLoad(font, "font");
jlStaDisplay(kanga);
jlDrawColor(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment