IIgs ASM code now supports drawing on any valid surface.

This commit is contained in:
Scott Duensing 2019-10-01 20:50:14 -05:00
parent 76c4636489
commit daea38b790
13 changed files with 1079 additions and 432 deletions

View file

@ -1,66 +0,0 @@
#!/bin/bash -e
OUT=${JOEY}/sdks/IIgs/ORCA/out/joey
if [ -d ${OUT} ]; then
rm -rf ${OUT}
fi
mkdir -p ${OUT}
pushd ${JOEY}/joeylib/joeylib/src
iix assemble +L jIIgs.asm keep=31:/out/joey/jIIgsasm > jIIgs.asm.dis
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.a
iix makelib 31:/out/joey/joeylib +31:/out/joey/joey.a
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 dumpobj +D 31:/out/joey/test &> test.dis || true
php ${JOEY}/sdks/IIgs/ntconverter/ntconverter.php *.mod
popd
mkdir -p ${JOEY}/dist/IIgs
cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000
cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/.
cp -f ${JOEY}/joeylib/scripts/build-IIgs.helper.sh ${JOEY}/dist/IIgs/.
if [ ! -z $1 ]; then
CADIUS=${JOEY}/sdks/IIgs/cadius/cadius
IMPORT=/tmp/IIgs/import.po
VOL=Import
mkdir -p `dirname ${IMPORT}`
rm /tmp/IIgs/JLSTATS#040000 2> /dev/null || true
rm ${IMPORT} 2> /dev/null || true
cp ${OUT}/test ${OUT}/Test#B30000
cp ${JOEY}/joeylib/joeylib/src/kanga.sta ${OUT}/kanga.sta#060000
cp ${JOEY}/joeylib/joeylib/src/font.sta ${OUT}/font.sta#060000
cp ${JOEY}/joeylib/joeylib/src/music ${OUT}/music#D50000
cp ${JOEY}/joeylib/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/IIgs/gsplus
./GSplus -resizeable -config IIgsTest.cfg || true
popd
echo ""
${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS /tmp/IIgs/. > /dev/null
if [ -e /tmp/IIgs/JLSTATS#040000 ]; then
echo ""
cat /tmp/IIgs/JLSTATS#040000 | tr "\r" "\n" 2> /dev/null
echo ""
fi
fi

View file

@ -1,101 +0,0 @@
#!/bin/bash -e
BUILD="${JOEY}/joeylib/joeylib/build"
SRC="${JOEY}/joeylib/joeylib/src"
function doBuild() {
G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -c"
echo "*** Starting ${DIST}"
if [ -d "${BUILD}" ]; then
rm -rf "${BUILD}"
fi
mkdir -p "${BUILD}"
if [ -d "${DIST}" ]; then
rm -rf "${DIST}"
fi
mkdir -p "${DIST}"
pushd "${BUILD}"
${CC} ${CFLAGS} ${G_CFLAGS} -o jPC.o ${SRC}/jPC.c
${CC} ${CFLAGS} ${G_CFLAGS} -o joey.o ${SRC}/joey.c
ar x ${INSTALLED}/libSDL2.a
ar x ${INSTALLED}/libSDL2_mixer.a
ar x ${INSTALLED}/libmodplug.a
ar rcs ${DIST}/libjoeylib.a *.o
popd
if [ -d "${BUILD}" ]; then
rm -rf "${BUILD}"
fi
}
ARCH=$1
if [ "${ARCH}x" == "x" ]; then
echo "$0 [arch | \"all\"]"
echo '(Where "arch" is linux32, linux64, windows32, windows64, macos32, or macos64.)'
exit 0
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux64x" ]; then
CC="gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/linux/x64"
INSTALLED="${JOEY}/SDL2/installed/linux/x64/lib"
doBuild
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux32x" ]; then
CC="gcc"
CFLAGS="-m32"
LDFLAGS=""
DIST="${JOEY}/dist/linux/i386"
INSTALLED="${JOEY}/SDL2/installed/linux/i386/lib"
doBuild
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows64x" ]; then
CC="x86_64-w64-mingw32-gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/windows/x64"
INSTALLED="${JOEY}/SDL2/installed/windows/x64/lib"
doBuild
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows32x" ]; then
CC="i686-w64-mingw32-gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/windows/i386"
INSTALLED="${JOEY}/SDL2/installed/windows/i386/lib"
doBuild
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos32x" ]; then
CC="o32-clang"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/macos/i386"
INSTALLED="${JOEY}/SDL2/installed/macos/i386/lib"
doBuild
fi
if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos64x" ]; then
CC="o64-clang"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/macos/x64"
INSTALLED="${JOEY}/SDL2/installed/macos/x64/lib"
doBuild
fi
cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/.
cp -f ${JOEY}/joeylib/joeylib/joey.pri ${JOEY}/dist/.

264
joeylib/build.sh Executable file
View file

@ -0,0 +1,264 @@
#!/bin/bash -e
# m68k-amigaos-gcc -idirafter /home/scott/joey/sdks/amiga/m68k-amigaos/sys-include/machine -c ../src/joey.c
# m68k-amigaos-gcc -idirafter /home/scott/joey/sdks/amiga/m68k-amigaos/sys-include/machine -c ../src/jAmiga.c
# m68k-amigaos-ar rcs libjoeylib.a *.o
# wget http://tho-otto.de/download/mint/m68k-atari-mint-base-20190606-linux.tar.xz
# xz -d m68k-atari-mint-base-20190606-linux.tar.xz
# tar --strip-components=1 -xf ../../stuff/m68k-atari-mint-base-20190606-linux.tar
# m68k-atari-mint-gcc -c ../src/joey.c
# m68k-atari-mint-gcc -c ../src/jST.c
# m68k-atari-ar rcs libjoeylib.a *.o
SRC="${JOEY}/joeylib/joeylib/src"
BUILD="${JOEY}/joeylib/joeylib/build"
OUT="${JOEY}/sdks/IIgs/ORCA/out/joey"
DEPS="${JOEY}/installerWork/deps/installed"
# Hackery for Scott's development system
if [[ `uname -n` == 'joey' && `whoami` == 'scott' ]]; then
DEPS="${JOEY}/installer/installerWork/deps/installed"
fi
function doIIgsBuild() {
local CADIUS="${JOEY}/sdks/IIgs/cadius/cadius"
local IMPORT="/tmp/IIgs/import.po"
local VOL=Import
local RUNTEST=$1
echo "*** Starting ${DIST}"
if [[ -d "${OUT}" ]]; then
rm -rf "${OUT}"
fi
mkdir -p "${OUT}"
if [[ -d "${DIST}" ]]; then
rm -rf "${DIST}"
fi
mkdir -p "${DIST}"
pushd "${SRC}"
iix assemble +L jIIgs.asm keep=31:/out/joey/jIIgsasm > jIIgs.asm.dis
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.a
iix makelib 31:/out/joey/joeylib +31:/out/joey/joey.a
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 dumpobj +D 31:/out/joey/test &> test.dis || true
php "${JOEY}/sdks/IIgs/ntconverter/ntconverter.php" *.mod
popd
cp -f "${OUT}/joeylib" "${DIST}/joeylib#b20000"
cp -f "${JOEY}/sdks/IIgs/Tool221#ba0000" "${JOEY}/dist/IIgs/."
cp -f "${JOEY}/joeylib/scripts/build-IIgs.helper.sh" "${JOEY}/dist/."
if [[ ! -z ${RUNTEST} ]]; then
mkdir -p `dirname ${IMPORT}`
rm "/tmp/IIgs/JLSTATS#040000" 2> /dev/null || true
rm "${IMPORT}" 2> /dev/null || true
cp "${OUT}/test" "${OUT}/Test#B30000"
cp "${JOEY}/joeylib/joeylib/src/kanga.sta" "${OUT}/kanga.sta#060000"
cp "${JOEY}/joeylib/joeylib/src/font.sta" "${OUT}/font.sta#060000"
cp "${JOEY}/joeylib/joeylib/src/music" "${OUT}/music#D50000"
cp "${JOEY}/joeylib/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} "${JOEY}/dist/IIgs/Tool221#ba0000" > /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/IIgs/gsplus"
./GSplus -resizeable -config IIgsTest.cfg || true
popd
echo ""
"${CADIUS}" extractfile "${IMPORT}" ${VOL}/JLSTATS /tmp/IIgs/. > /dev/null
if [[ -e "/tmp/IIgs/JLSTATS#040000" ]]; then
echo ""
cat "/tmp/IIgs/JLSTATS#040000" | tr "\r" "\n" 2> /dev/null
echo ""
fi
fi
}
function doPCBuild() {
local G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -c"
echo "*** Starting ${DIST}"
if [[ -d "${BUILD}" ]]; then
rm -rf "${BUILD}"
fi
mkdir -p "${BUILD}"
if [[ -d "${DIST}" ]]; then
rm -rf "${DIST}"
fi
mkdir -p "${DIST}"
pushd "${BUILD}"
"${CC}" ${CFLAGS} ${G_CFLAGS} -o jPC.o "${SRC}/jPC.c"
"${CC}" ${CFLAGS} ${G_CFLAGS} -o joey.o "${SRC}/joey.c"
ar x "${INSTALLED}/libSDL2.a"
ar x "${INSTALLED}/libSDL2_mixer.a"
ar x "${INSTALLED}/libmodplug.a"
ar rcs "${DIST}/libjoeylib.a" *.o
popd
if [[ -d "${BUILD}" ]]; then
rm -rf "${BUILD}"
fi
#***TODO*** Add optional test app execution for Windows (WINE) and Linux here
cp -f "${JOEY}/joeylib/joeylib/joey.pri" "${JOEY}/dist/."
cp -f "${JOEY}/joeylib/scripts/build-PC.helper.sh" "${JOEY}/dist/."
}
function doVBCCBuild() {
local PLATFORM=
local CFILE=
local G_CFLAGS="-c99 -I${SRC} -speed -c"
if [[ "${ARCH}" == "st" ]]; then
PLATFORM=tos
CFILE="jST"
fi
if [[ "${ARCH}" == "amiga" ]]; then
PLATFORM=aos68k
CFILE="jAmiga"
fi
echo "*** Starting ${DIST}"
if [[ -d "${BUILD}" ]]; then
rm -rf "${BUILD}"
fi
mkdir -p "${BUILD}"
if [[ -d "${DIST}" ]]; then
rm -rf "${DIST}"
fi
mkdir -p "${DIST}"
pushd "${BUILD}"
vc +${PLATFORM} ${CFLAGS} ${G_CFLAGS} "${SRC}/joey.c" -o joey.o
vc +${PLATFORM} ${CFLAGS} ${G_CFLAGS} "${SRC}/${CFILE}.c" -o ${CFILE}.o
vlink ${LDFLAGS} joey.o ${CFILE}.o -o joeylib.lib
popd
#hatari -c "${JOEY}/sdks/st/hatari.cfg" -d out/
}
ARCH=$1
TEST=$2
if [[ "${ARCH}x" == "x" ]]; then
echo "$0 [arch | \"all\"]"
echo '(Where "arch" is iigs, st, linux32, linux64, windows32, windows64, macos32, or macos64.)'
exit 0
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "iigsx" ]]; then
DIST="${JOEY}/dist/IIgs"
doIIgsBuild ${TEST}
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "stx" ]]; then
SDK="${JOEY}/sdks/vbcc/targets/m68k-atari"
CFLAGS="-cpu=68000 -I${SDK}/includes"
#LDFLAGS="-bvobj-be -EB -L${JOEY}/sdks/vbcc/targets/m68k-atari/lib"
LDFLAGS="-baoutnull -EB -L${SDK}/lib -lvc"
DIST="${JOEY}/dist/ST"
doVBCCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "amigax" ]]; then
#SDK="${JOEY}/sdks/amiga"
#CFLAGS="-cpu=68000 -I${SDK}/NDK_3.9/Include/include_h -I${SDK}/PosixLib/include"
#LDFLAGS="-bamigahunk -EB -L${SDK}/NDK_3.9/Include/linker_libs -L${SDK}/PosixLib/AmigaOS3 -lposix -lamiga"
SDK="${JOEY}/sdks/vbcc/targets/m68k-amigaos"
SDK2="${JOEY}/sdks/amiga/PosixLib"
CFLAGS="-cpu=68000 -I${SDK}/includes -I${SDK2}/includes"
#LDFLAGS="-bamigahunk -Bshareable -Cvbcc -mrel ${SDK}/lib/startup.o -L${SDK}/lib -L${SDK2}/AmigaOS3 -lvc -lposix"
LDFLAGS="-bvobj-be -Bshareable -Cvbcc -mrel ${SDK}/lib/startup.o -L${SDK}/lib -L${SDK2}/AmigaOS3 -lvc -lposix"
DIST="${JOEY}/dist/Amiga"
doVBCCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "linux64x" ]]; then
CC="gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/linux/x64"
INSTALLED="${DEPS}/linux/x64/lib"
doPCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "linux32x" ]]; then
CC="gcc"
CFLAGS="-m32"
LDFLAGS=""
DIST="${JOEY}/dist/linux/i386"
INSTALLED="${DEPS}/linux/i386/lib"
doPCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "windows64x" ]]; then
CC="x86_64-w64-mingw32-gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/windows/x64"
INSTALLED="${DEPS}/windows/x64/lib"
doPCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "windows32x" ]]; then
CC="i686-w64-mingw32-gcc"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/windows/i386"
INSTALLED="${DEPS}/windows/i386/lib"
doPCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "macos32x" ]]; then
CC="o32-clang"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/macos/i386"
INSTALLED="${DEPS}/macos/i386/lib"
doPCBuild
fi
if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "macos64x" ]]; then
CC="o64-clang"
CFLAGS=""
LDFLAGS=""
DIST="${JOEY}/dist/macos/x64"
INSTALLED="${DEPS}/macos/x64/lib"
doPCBuild
fi
mkdir -p "${JOEY}/dist"
cp -f "${SRC}/joey.h" "${JOEY}/dist/."

View file

@ -20,6 +20,9 @@ SOURCES += \
src/test.c
OTHER_FILES += \
src/jBlank.c \
src/jST.c \
src/jAmiga.c \
src/jIIgs.c \
src/jIIgs.asm \
src/jIIgs.macro \

202
joeylib/src/jAmiga.c Normal file
View file

@ -0,0 +1,202 @@
/*
* JoeyLib
* Copyright (C) 2018-2019 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.
*/
#include "joey.h"
void jlDisplayPresent(void) {
}
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlStaT *sta) {
(void)startX;
(void)startY;
(void)width;
(void)height;
(void)mapData;
(void)stride;
(void)sta;
}
void jlDrawClear(void) {
}
byte jlDrawGetPixel(jint16 x, jint16 y) {
(void)x;
(void)y;
return 0;
}
void jlDrawPoint(jint16 x, jint16 y) {
(void)x;
(void)y;
}
jint16 jlGameGetAxis(byte which) {
(void)which;
return 0;
}
bool jlGameGetButton(byte which) {
(void)which;
return false;
}
bool jlKeyPressed(void) {
return false;
}
char jlKeyRead(void) {
return 0;
}
void jlPaletteSet(byte index, byte r, byte g, byte b) {
(void)index;
(void)r;
(void)g;
(void)b;
}
void jlPaletteSetFromSta(jlStaT *sta) {
(void)sta;
}
void jlSoundFree(jlSoundT *sound) {
(void)sound;
}
bool jlSoundIsPlaying(jlSoundT *sound) {
(void)sound;
return false;
}
bool _jlSoundLoad(jlSoundT **sound, char *filename) {
(void)sound;
(void)filename;
return false;
}
void jlSoundMusicContinue(void) {
}
bool jlSoundMusicIsPlaying(void) {
return false;
}
void jlSoundMusicPause(void) {
}
void jlSoundMusicPlay(char *name) {
(void)name;
}
void jlSoundMusicStop(void) {
}
void jlSoundPlay(jlSoundT *sound) {
(void)sound;
}
bool _jlStaCreate(jlStaT **sta) {
(void)sta;
return false;
}
void jlStaDisplay(jlStaT *sta) {
(void)sta;
}
void jlUtilIdle(void) {
}
bool jlUtilMustExit(void) {
return false;
}
void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new) {
(void)mem;
(void)count;
(void)old;
(void)new;
}
void jlUtilShutdown(void) {
jlUtilDie("Clean Exit.");
}
void jlUtilStartup(char *appTitle) {
(void)appTitle;
}
juint16 jlUtilTimer(void) {
return 0;
}

202
joeylib/src/jBlank.c Normal file
View file

@ -0,0 +1,202 @@
/*
* JoeyLib
* Copyright (C) 2018-2019 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.
*/
#include "joey.h"
void jlDisplayPresent(void) {
}
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlStaT *sta) {
(void)startX;
(void)startY;
(void)width;
(void)height;
(void)mapData;
(void)stride;
(void)sta;
}
void jlDrawClear(void) {
}
byte jlDrawGetPixel(jint16 x, jint16 y) {
(void)x;
(void)y;
return 0;
}
void jlDrawPoint(jint16 x, jint16 y) {
(void)x;
(void)y;
}
jint16 jlGameGetAxis(byte which) {
(void)which;
return 0;
}
bool jlGameGetButton(byte which) {
(void)which;
return false;
}
bool jlKeyPressed(void) {
return false;
}
char jlKeyRead(void) {
return 0;
}
void jlPaletteSet(byte index, byte r, byte g, byte b) {
(void)index;
(void)r;
(void)g;
(void)b;
}
void jlPaletteSetFromSta(jlStaT *sta) {
(void)sta;
}
void jlSoundFree(jlSoundT *sound) {
(void)sound;
}
bool jlSoundIsPlaying(jlSoundT *sound) {
(void)sound;
return false;
}
bool _jlSoundLoad(jlSoundT **sound, char *filename) {
(void)sound;
(void)filename;
return false;
}
void jlSoundMusicContinue(void) {
}
bool jlSoundMusicIsPlaying(void) {
return false;
}
void jlSoundMusicPause(void) {
}
void jlSoundMusicPlay(char *name) {
(void)name;
}
void jlSoundMusicStop(void) {
}
void jlSoundPlay(jlSoundT *sound) {
(void)sound;
}
bool _jlStaCreate(jlStaT **sta) {
(void)sta;
return false;
}
void jlStaDisplay(jlStaT *sta) {
(void)sta;
}
void jlUtilIdle(void) {
}
bool jlUtilMustExit(void) {
return false;
}
void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new) {
(void)mem;
(void)count;
(void)old;
(void)new;
}
void jlUtilShutdown(void) {
jlUtilDie("Clean Exit.");
}
void jlUtilStartup(char *appTitle) {
(void)appTitle;
}
juint16 jlUtilTimer(void) {
return 0;
}

View file

@ -19,37 +19,36 @@
; 3. This notice may not be removed or altered from any source distribution.
;----------------------------------------
mcopy 13:ORCAInclude:m16.ORCA
mcopy jIIgs.macro
case on
gen on
SHRShad gequ $012000
ScanTable data
GlobalData data
ScanTable entry
ds 400 ; 400 bytes for scanline offsets
end
VblRate data
ds 2 ; Either 5 or 6 depending on PAL or NTSC.
VblRate ds 2 ; Either 5 or 6 depending on PAL or NTSC.
VblTime ds 2 ; Integer Counter
end
;----------------------------------------
; Blit an 8x8 block from off-screen to back buffer.
; Blit an 8x8 block. ***TODO*** Unroll loops
;----------------------------------------
asmB88 start
t equ 1
so equ 1 ; Source Pixels Offset
to equ 3 ; Target Pixels Offset
t equ 5 ; Temp
xc equ 7 ; X Counter
yc equ 9 ; Y Counter
jsubroutine (4:p,2:cx1,2:cy1,2:cx2,2:cy2),2
using ScanTable
jsubroutine (4:surface,4:tiles,2:cx1,2:cy1,2:cx2,2:cy2),10
using GlobalData
phb ; Push our current data bank onto the stack
; ***TODO*** Mask off unused bits so they can be used for other things elsewhere
; Find offset into tile memory
clc
lda cx1 ; Multiply cx1 by 4 to get offset (two pixels per byte)
asl a
asl a
@ -59,197 +58,110 @@ t equ 1
asl a
asl a
asl a
asl a ; y1 is now in the accumulator
clc
asl a ; y screen location is now in the accumulator
tax
lda >ScanTable,x
adc t ; Add t to scanline offset
tay ; Offset to start of tile
; Find offset into shadow SHR memory
clc
lda cx2 ; Multiply cx1 by 4 to get offset (two pixels per byte)
lda >ScanTable,x ; Load byte offset of y position from table
adc t ; Add t to scanline offset
sta so ; Offset to start of source pixels
; Find offset into target surface memory
clc
lda cx2 ; Multiply cx2 by 4 to get offset (two pixels per byte)
asl a
asl a
sta t
clc
lda cy2 ; Multiply cy1 by 16 to get index into scanline table
lda cy2 ; Multiply cy2 by 16 to get index into scanline table
asl a
asl a
asl a
asl a ; y2 is now in the accumulator
asl a ; y screen location is now in the accumulator
clc
tax
lda >ScanTable,x
lda >ScanTable,x ; Load byte offset of y position from table
adc t ; Add t to scanline offset
tax ; Offset to start of screen memory
sta to ; Offset to start of target pixels
sei ; Disable interrupts while we change data banks
pea $0101 ; Push Effective Address (our new data bank) always 16 bits
plb ; Pull data bank from stack (data bank now $01)
plb ; Do it twice because it's only an 8 bit operation
lda #0 ; Load 0 into X and Y counters
sta xc
sta yc
; Row 1
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 2
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 2
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 3
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 3
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 4
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 4
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 5
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 5
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 6
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 6
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 7
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 7
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 8
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 8
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
blitTop ldy so ; Load Y register with source pixel offset
lda [tiles],y ; Load 4 tile pixels
ldy to ; Load Y register with target pixel offset
sta [surface],y ; Store 4 pixels into screen
plb ; Pull original data bank from stack
cli ; Restore interrupts
clc ; Increment to next pixel target quad
lda #2
adc to
sta to
clc ; Increment to next pixel source quad
lda #2
adc so
sta so
clc
lda xc ; Increment X counter
adc #1
sta xc
cmp #2 ; End of X pixels?
bcc blitTop ; Nope!
lda #0 ; Reset X counter
sta xc
clc ; Increment target offset
lda #156
adc to
sta to
clc ; Increment source offset
lda #156
adc so
sta so
clc
lda yc ; Increment Y counter
adc #1
sta yc
cmp #8 ; End of Y pixels?
bcc blitTop ; Nope!
jreturn
end
;----------------------------------------
; Blit an 8x8 block from off-screen to back buffer with alpha.
; Blit an 8x8 block with alpha.
;----------------------------------------
asmB88a start
mo equ 1 ; Mask Offset
so equ 3 ; Source Pixels Offset
to equ 5 ; Target Pixels Offset
so equ 1 ; Source Pixels Offset
to equ 3 ; Target Pixels Offset
mo equ 5 ; Mask Offset
t equ 7 ; Temp
xc equ 9 ; X Counter
yc equ 11 ; Y Counter
jsubroutine (4:p,2:cx1,2:cy1,2:cx2,2:cy2,2:offset),12
using ScanTable
jsubroutine (4:surface,4:tiles,2:cx1,2:cy1,2:cx2,2:cy2,2:offset),12
using GlobalData
phb ; Push our current data bank onto the stack
; ***TODO*** Mask off unused bits so they can be used for other things elsewhere
; Find offset into tile memory
lda cx1 ; Multiply cx1 by 4 to get offset (two pixels per byte)
asl a
asl a
sta t
clc
lda cy1 ; Multiply cy1 by 16 to get index into scanline table
asl a
asl a
asl a
asl a ; y1 is now in the accumulator
asl a ; y screen location is now in the accumulator
tax
clc
lda >ScanTable,x
lda >ScanTable,x ; Load byte offset of y position from table
adc t ; Add t to scanline offset
sta so ; Offset to start of source pixels
; Find offset into tile memory for mask data
lda offset ; Load offset
asl a ; Multiply by 4
asl a
@ -257,39 +169,36 @@ yc equ 11 ; Y Counter
adc so ; Add to source pixel offset
sta mo ; Offset to start of mask pixels
; Find offset into shadow SHR memory
lda cx2 ; Multiply cx1 by 4 to get offset (two pixels per byte)
; Find offset into target surface memory
clc
lda cx2 ; Multiply cx2 by 4 to get offset (two pixels per byte)
asl a
asl a
sta t
lda cy2 ; Multiply cy1 by 16 to get index into scanline table
clc
lda cy2 ; Multiply cy2 by 16 to get index into scanline table
asl a
asl a
asl a
asl a ; y2 is now in the accumulator
asl a ; y screen location is now in the accumulator
clc
tax
lda >ScanTable,x
lda >ScanTable,x ; Load byte offset of y position from table
adc t ; Add t to scanline offset
sta to ; Offset to start of target pixels
sei ; Disable interrupts while we change data banks
pea $0101 ; Push Effective Address (our new data bank) always 16 bits
plb ; Pull data bank from stack (data bank now $01)
plb ; Do it twice because it's only an 8 bit operation
lda #0
sta xc ; Load 0 into X and Y counters
lda #0 ; Load 0 into X and Y counters
sta xc
sta yc
blitATop ldx to ; Load X and Y registers with target pixel offset
ldy to
lda SHRShad,x ; Load 4 target pixels
ldy mo ; Load Y register with pixel mask offset
and [p],y ; AND with mask
blitTop ldy to ; Load Y register with target pixel offset
lda [surface],y ; Load target pixels
ldy mo ; Load Y register with mask pixel offset
and [tiles],y ; AND with mask
ldy so ; Load Y register with source pixel offset
ora [p],y ; OR with source pixels
sta |SHRShad,x ; Store 4 pixels into screen
ora [tiles],y ; OR with source pixels
ldy to ; Load Y register with target pixel offset
sta [surface],y ; Store 4 pixels into screen
clc ; Increment to next pixel target quad
lda #2
@ -309,7 +218,7 @@ blitATop ldx to ; Load X and Y registers with target pixel offset
adc #1
sta xc
cmp #2 ; End of X pixels?
bcc blitATop ; Nope!
bcc blitTop ; Nope!
lda #0 ; Reset X counter
sta xc
@ -330,28 +239,28 @@ blitATop ldx to ; Load X and Y registers with target pixel offset
adc #1
sta yc
cmp #8 ; End of Y pixels?
bcc blitATop ; Nope!
plb ; Pull original data bank from stack
cli ; Restore interrupts
bcc blitTop ; Nope!
jreturn
end
;----------------------------------------
; Set Border Color
;----------------------------------------
asmBorder start
jsubroutine (2:c)
jsubroutine (2:color)
short m
lda >$E0C034
and #$F0
ora c
ora color
sta >$E0C034
long m
jreturn
end
;----------------------------------------
; Draw a block of tiles from a region of tile data
;----------------------------------------
@ -363,7 +272,7 @@ offset equ 5
loopX equ 7
loopY equ 9
jsubroutine (2:startX,2:startY,2:width,2:height,4:mapData,2:stride,4:tiles),10
jsubroutine (4:surface,2:startX,2:startY,2:width,2:height,4:mapData,2:stride,4:tiles),10
lda #0 ; Zero some starting values
sta offset
@ -401,6 +310,7 @@ drawTop phy ; Keep Y for later
ph2 tileY
ph2 tileX
ph4 tiles
ph4 surface
jsl asmB88 ; Call tile drawing code
ply ; Unclobber
@ -422,6 +332,7 @@ drawTop phy ; Keep Y for later
jreturn
end
;===============================================================================================
;
@ -444,11 +355,11 @@ diff equ 15
even_c equ 17
odd_c equ 19
jsubroutine (4:p,2:penColor,2:clpx0,2:clpy0,2:clpx1,2:clpy1),20
jsubroutine (4:surface,2:penColor,2:clpx0,2:clpy0,2:clpx1,2:clpy1),20
; Say p = $012000...
; Say surface = $012000...
lda #<p ; Should be $2000
lda #<surface ; Should be $2000
sta __e0 ; set "even" addresses
sta __e1
sta __e2
@ -481,7 +392,7 @@ odd_c equ 19
sta __o13
phb ; keep original bank
lda #>p ; Should be $0120
lda #>surface ; Should be $0120
pha ; switch to bank we're pointing into
plb ; B is now $20 - bad!
plb ; B is now $01 - good!
@ -953,13 +864,12 @@ asmGetPoint start
temp1 equ 1
jsubroutine (2:Xp,2:Yp),2
using ScanTable
jsubroutine (4:surface,2:Xp,2:Yp),2
lda Yp ; Load accumulator with Y location
asl a ; Shift accumulator left (multiply by 2) for word offset into table
tax ; Transfer accumulator to x register
lda >ScanTable,x ; Look up scan line address offset
tay ; Transfer accumulator to y register
lda ScanTable,y ; Look up scan line address offset
sta temp1 ; Store accumulator (row offset into SHR memory) into temp1
clc ; Clear carry flag
lda Xp ; Place X position in accumulator
@ -968,8 +878,8 @@ temp1 equ 1
clc ; Clear carry
adc temp1 ; Add X position to SHR address with carry - a now contains address of color pair we want
plp ; Restore our carry flag
tax ; Transfer accumulator to x register
lda SHRShad,x ; Load pixel pair into accumulator
tay ; Transfer accumulator to y register
lda [surface],y ; Load pixel pair into accumulator
bcc GEven ; Branch if Carry Clear - Determines Even/Odd pixel
and #$F ; AND accumulator with $F to mask off unwanted pixel
bra GBoth
@ -985,15 +895,17 @@ GBoth sta temp1 ; Store accumulator in temp1
jreturn 2:temp1
end
;----------------------------------------
; Return the current 1/10th second timer value
;----------------------------------------
asmGetVbl start
using VblRate
using GlobalData
lda >VblTime
rtl
end
;----------------------------------------
; Turns off SHR Graphics
;----------------------------------------
@ -1007,6 +919,7 @@ asmGrOff start
jreturn
end
;----------------------------------------
; Turns on SHR Graphics
;----------------------------------------
@ -1020,6 +933,7 @@ asmGrOn start
jreturn
end
;----------------------------------------
; Reads controller axis
; Thank you to John Brooks for this code!
@ -1038,7 +952,7 @@ ptrig equ $00C070
php ; Save mx reg size bits
phb ; Save data bank
short m,i ; 8-bit m,x
short m,i ; 8-bit m,x
sei ; disable interrupts
ldx #0 ; Zero paddle 0 counter
@ -1081,11 +995,12 @@ gotpdl0 xba ; 3c
sta pret1
plp ; Restore mx 8/16 mode and interrupt enable state
long m,i
long m,i
jreturn 2:pret0
end
;----------------------------------------
; Swaps nibble values
;
@ -1096,16 +1011,16 @@ asmNSwap start
hnibo equ 1 ; High nibble old color value
hnibn equ 2 ; High nibble new color value
jsubroutine (4:P,2:C,2:O,2:N),2
jsubroutine (4:pointer,2:count,2:oldColor,2:newColor),2
short m ; Use 8 bit accumulator
lda N ; Load new color to use
short m ; Use 8 bit accumulator
lda newColor ; Load new color to use
asl a ; Shift it up a nibble
asl a
asl a
asl a
sta hnibn ; Store it for later
lda O ; Load old color to use (16 bit argument)
lda oldColor ; Load old color to use (16 bit argument)
asl a ; Shift it up a nibble
asl a
asl a
@ -1114,33 +1029,34 @@ hnibn equ 2 ; High nibble new color value
ldy #0 ; Load Y (our counter) with 0
NSLow lda [P],y ; Get byte to check
NSLow lda [pointer],y ; Get byte to check
and #$0F ; Isolate low nibble
cmp O ; Compare to old value
cmp oldColor ; Compare to old value
bne NSHigh ; Not equal, skip to high nibble
lda [P],y ; Get byte to modify
lda [pointer],y ; Get byte to modify
and #$F0 ; Clear low nibble
ora N ; Set low nibble to new color
sta [P],y ; Store it back
ora newColor ; Set low nibble to new color
sta [pointer],y ; Store it back
NSHigh lda [P],y ; Get byte to check
NSHigh lda [pointer],y ; Get byte to check
and #$F0 ; Isolate high nibble
cmp hnibo ; Compare to old color
bne NSEnd ; Not equal, skip to next byte
lda [P],y ; Get byte to modify
lda [pointer],y ; Get byte to modify
and #$0F ; Clear high nibble
ora hnibn ; Set high nibble to new color
sta [P],y ; Store it back
sta [pointer],y ; Store it back
NSEnd iny ; Increment Y
clc ; Clear carry
cpy C ; Compare Y to number of bytes to modify
cpy count ; Compare Y to number of bytes to modify
bcc NSLow ; Keep going
long m ; Back to 16 bit accumulator
long m ; Back to 16 bit accumulator
jreturn
end
;----------------------------------------
; Plots a point in a given color
;
@ -1152,41 +1068,41 @@ temp1 equ 1
temp2 equ 3
temp3 equ 5
jsubroutine (2:C,2:Xp,2:Yp),6
using ScanTable
jsubroutine (4:surface,2:color,2:Xp,2:Yp),6
using GlobalData
lda Xp ; Place X position in accumulator
lsr a ; Logical Shift Right (divide by 2) - bit shifted off the end goes into carry flag
sta temp1 ; Store accumulator in temp1
bcc PEven ; Branch if Carry Clear - Determines Even/Odd pixel
POdd lda #$FFF0 ; Load accumulator with pixel mask
sta temp2 ; Store accumulator in temp2
lda C ; Load accumulator with color
lda color ; Load accumulator with color
and #$F ; AND accumulator with $F
bra PBoth ; Branch Always to PBoth
PEven lda #$FF0F ; Load accumulator with pixel mask
sta temp2 ; Store accumulator in temp2
lda C ; Load accumulator with color
lda color ; Load accumulator with color
and #$F0 ; AND accumulator with $F0
PBoth sta temp3 ; Store accumulator in temp3
lda Yp ; Load accumulator with Y location
asl a ; Shift accumulator left (multiply by 2)
tax ; Transfer accumulator to x register
lda >ScanTable,x ; Look up scan line address offset
tay ; Transfer accumulator to y register
lda ScanTable,y ; Look up scan line address offset
adc temp1 ; Add X position to address with carry
tax ; Transfer accumulator to x
tay ; Transfer accumulator to y
lda >SHRShad,x ; Load existing pixels into accumulator
lda [surface],y ; Load existing pixels into accumulator
and temp2 ; AND accumulator with temp2
ora temp3 ; OR accumulator with temp3
sta >SHRShad,x ; Store updated pixels back into memory
sta [surface],y ; Store updated pixels back into memory
jreturn
end
;----------------------------------------
; "PEI Slam" shadowed SHR display to the
; actual display. Copies all 200 lines,
@ -1198,11 +1114,11 @@ asmSlam start
jsubroutine
short m ; Turn Shadowing On
short m ; Turn Shadowing On
lda >$E0C035
and #$F7
sta >$E0C035
long m
long m
php ; Push Processor Status Register
lda >$E0C068-1
@ -1398,11 +1314,11 @@ peiEnd lda #0 ; Swap main 48k into bank 0
sta >$E0C068-1 ; Restore main/aux bank state
plp ; Restore processor register
short m ; Turn Shadowing Off
short m ; Turn Shadowing Off
lda >$E0C035
ora #$08
sta >$E0C035
long m
long m
jreturn
@ -1416,21 +1332,21 @@ StackPtr ds 2 ; Space for SP
; Builds a table of scanline offsets
;----------------------------------------
asmStart start
jsubroutine (2:id,2:h)
using ScanTable
using VblRate
jsubroutine (2:id,2:hertz)
using GlobalData
ldx #0 ; Load 0 into x register
ldy #0 ; Load 0 into y register
lda #0 ; Load 0 into accumulator
clc ; Clear carry flag
STL sta >ScanTable,x ; Store accumulator in ScanTable+x
buildTable anop
sta ScanTable,y ; Store accumulator in ScanTable+x
adc #160 ; Add 160 to accumulator
inx ; Increment x
inx ; Increment x
cpx #400 ; Compare x to 400 (200 scanlines)
bcc STL ; Repeat Scan Table Loop until we do all 200 lines
iny ; Increment y
iny ; Increment y
cpy #400 ; Compare y to 400 (200 scanlines)
bcc buildTable ; Repeat Scan Table Loop until we do all 200 lines
lda h ; Store refresh rate / 10 in VblCount and VblRate
lda hertz ; Store refresh rate / 10 in VblCount and VblRate
sta >VblRate
lda #0 ; Reset timer
@ -1447,6 +1363,7 @@ STL sta >ScanTable,x ; Store accumulator in ScanTable+x
jreturn
end
;----------------------------------------
; Shut down assembly routines
;----------------------------------------
@ -1460,6 +1377,7 @@ asmStop start
jreturn
end
;----------------------------------------
; Increment time counter using VBLs every 1/10 second
;----------------------------------------
@ -1467,13 +1385,15 @@ VblHdr start
dc i4'0' ; Space for task pointer
VblCount dc i2'1' ; How many VBLs between calls (1 only on initial call)
dc i2'$A55A' ; Task signature
using VblRate
long m,i
using GlobalData
long m,i
lda >VblRate ; Reset hearbeat counter
sta >VblCount
lda >VblTime ; Increment timer
inc a
sta >VblTime
short m,i
short m,i
rtl
end

202
joeylib/src/jST.c Normal file
View file

@ -0,0 +1,202 @@
/*
* JoeyLib
* Copyright (C) 2018-2019 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.
*/
#include "joey.h"
void jlDisplayPresent(void) {
}
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset) {
(void)sta;
(void)cx1;
(void)cy1;
(void)cx2;
(void)cy2;
}
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlStaT *sta) {
(void)startX;
(void)startY;
(void)width;
(void)height;
(void)mapData;
(void)stride;
(void)sta;
}
void jlDrawClear(void) {
}
byte jlDrawGetPixel(jint16 x, jint16 y) {
(void)x;
(void)y;
return 0;
}
void jlDrawPoint(jint16 x, jint16 y) {
(void)x;
(void)y;
}
jint16 jlGameGetAxis(byte which) {
(void)which;
return 0;
}
bool jlGameGetButton(byte which) {
(void)which;
return false;
}
bool jlKeyPressed(void) {
return false;
}
char jlKeyRead(void) {
return 0;
}
void jlPaletteSet(byte index, byte r, byte g, byte b) {
(void)index;
(void)r;
(void)g;
(void)b;
}
void jlPaletteSetFromSta(jlStaT *sta) {
(void)sta;
}
void jlSoundFree(jlSoundT *sound) {
(void)sound;
}
bool jlSoundIsPlaying(jlSoundT *sound) {
(void)sound;
return false;
}
bool _jlSoundLoad(jlSoundT **sound, char *filename) {
(void)sound;
(void)filename;
return false;
}
void jlSoundMusicContinue(void) {
}
bool jlSoundMusicIsPlaying(void) {
return false;
}
void jlSoundMusicPause(void) {
}
void jlSoundMusicPlay(char *name) {
(void)name;
}
void jlSoundMusicStop(void) {
}
void jlSoundPlay(jlSoundT *sound) {
(void)sound;
}
bool _jlStaCreate(jlStaT **sta) {
(void)sta;
return false;
}
void jlStaDisplay(jlStaT *sta) {
(void)sta;
}
void jlUtilIdle(void) {
}
bool jlUtilMustExit(void) {
return false;
}
void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new) {
(void)mem;
(void)count;
(void)old;
(void)new;
}
void jlUtilShutdown(void) {
jlUtilDie("Clean Exit.");
}
void jlUtilStartup(char *appTitle) {
(void)appTitle;
}
juint16 jlUtilTimer(void) {
return 0;
}

View file

@ -21,8 +21,8 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
@ -627,6 +627,16 @@ void jlUtilRandomSeedSet(juint32 seed) {
}
void jlUtilSleep(juint16 tenths) {
juint16 t = jlUtilTimer();
juint16 d = 0;
while ((d < tenths) && !jlUtilMustExit()) {
d = jlUtilTimeSpan(t, jlUtilTimer());
}
}
void *_jlUtilStackPop(jlStackT **stack) {
void *d = NULL;
jlStackT *s;
@ -649,6 +659,15 @@ void _jlUtilStackPush(jlStackT **stack, void *data) {
}
juint16 jlUtilTimeSpan(juint16 past, juint16 current) {
jint32 temp = current - past;
if (temp < 0) {
temp += 65536;
}
return (juint16)temp;
}
void jlVecDisplay(jlVecT *vec, jint16 ox, jint16 oy) {
jint16 command;
jint16 count;

View file

@ -282,13 +282,14 @@ juint16 jlUtilRandom(void);
juint32 jlUtilRandomSeedGet(void);
void jlUtilRandomSeedSet(juint32 seed);
void jlUtilShutdown(void) __attribute__((noreturn));
void jlUtilSleep(juint16 tenths);
#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 *appTitle);
juint16 jlUtilTimer(void);
#define jlUtilTimeSpan(past, current) (past < current ? current - past : 65536 - past - current)
juint16 jlUtilTimeSpan(juint16 past, juint16 current);
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
void jlVecFree(jlVecT *vec);
@ -298,22 +299,22 @@ bool _jlVecLoad(jlVecT **vec, char *filename);
#ifdef JOEY_IIGS
// Inlined functions - asm code
extern void asmB88(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
extern void asmB88a(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alpha);
extern void asmDrawBM(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, byte *sta);
//extern void asmDrawLine(byte *p, jint16 color, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
extern jint16 asmGetPoint(jint16 x, jint16 y);
extern void asmB88(juint32 surface, byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
extern void asmB88a(juint32 surface, byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alphaOffset);
extern void asmDrawBM(juint32 surface, jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, byte *sta);
//extern void asmDrawLine(juint32 surface, jint16 color, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
extern jint16 asmGetPoint(juint32 surface, jint16 x, jint16 y);
extern juint16 asmGetVbl(void);
extern void asmNSwap(byte *mem, jint16 count, jint16 old, jint16 new);
extern void asmPoint(jint16 color, jint16 x, jint16 y);
extern void asmPoint(juint32 surface, jint16 color, jint16 x, jint16 y);
// Inlined functions
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2)
#define jlDrawBlit8x8a(sta, cx1, cy1, cx2, cy2, offset) asmB88a((byte *)sta->pixels, cx1, cy1, cx2, cy2, offset)
#define jlDrawBlitMap(startX, startY, width, height, mapData, stride, sta) asmDrawBM(startX, startY, width, height, (byte *)mapData, stride, (byte *)sta->pixels)
#define jlDrawGetPixel(x, y) asmGetPoint(x, y)
#define jlDrawPoint(x, y) asmPoint(_jlDrawColorNibbles, x, y)
//#define jlDrawLine(x1, y1, x2, y2) asmDrawLine((byte *)0x012000L, _jlDrawColor, x1, y1, x2, y2)
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88(0x012000, (byte *)sta->pixels, cx1, cy1, cx2, cy2)
#define jlDrawBlit8x8a(sta, cx1, cy1, cx2, cy2, offset) asmB88a(0x012000, (byte *)sta->pixels, cx1, cy1, cx2, cy2, offset)
#define jlDrawBlitMap(startX, startY, width, height, mapData, stride, sta) asmDrawBM(0x012000, startX, startY, width, height, (byte *)mapData, stride, (byte *)sta->pixels)
#define jlDrawGetPixel(x, y) asmGetPoint(0x012000, x, y)
#define jlDrawPoint(x, y) asmPoint(0x012000, _jlDrawColorNibbles, x, y)
//#define jlDrawLine(x1, y1, x2, y2) asmDrawLine(0x012000, _jlDrawColor, x1, y1, x2, y2)
#define jlUtilNibbleSwap(mem, count, old, new) asmNSwap(mem, count, (jint16)old, (jint16)new)
#define jlUtilTimer asmGetVbl

View file

@ -70,9 +70,9 @@ int main(void) {
jlStaDisplay(kanga);
jlDrawColor(1);
//jlDrawBox(0, 0, 319, 199);
jlDrawBox(0, 0, 319, 199);
//jlSoundMusicPlay("music");
jlSoundMusicPlay("music");
jlPaletteSet(15, 15, 15, 15);
printAt(font, 1, 16, "X");
@ -82,13 +82,11 @@ int main(void) {
printAt(font, 1, y++, "Y = %d ", jlGameGetAxis(1));
printAt(font, 1, y++, "T = %d ", jlUtilTimer());
jlDrawColor((byte)color);
_jlDebugBorder(BORDER_GREEN);
jlDrawLine(0, y2, 319, 199-y2);
_jlDebugBorder(BORDER_BROWN);
y2 += dy;
if (y2 == 199 || y2 == 0) dy = -dy;
jlDisplayPresent();
//jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor));
jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor));
color = nextColor;
nextColor++;
if (nextColor > 15) nextColor = 1;

View file

@ -507,11 +507,11 @@ function installIIgs() {
mkdir -p "${JOEY}/dist/IIgs"
if [[ ! -e "${JOEY}/dist/IIgs/Tool221#ba0000" ]]; then
if [[ ! -e "${IIGS}/Tool221#ba0000" ]]; then
purple "Installing Tool221"
download https://www.brutaldeluxe.fr/products/apple2gs/tool221/ninjatracker_tool221_v2.1.2mg
"${IIGS}/cadius/cadius" extractfile ninjatracker_tool221_v2.1.2mg NT.TOOL221.V2.1/SYSTEM/TOOLS/TOOL221 .
cp -f TOOL221#BA0000 "${JOEY}/dist/IIgs/Tool221#ba0000"
cp -f TOOL221#BA0000 "${IIGS}/Tool221#ba0000"
fi
purple "Building JoeyLib"

View file

@ -17,6 +17,9 @@ export PATH="${JOEY}/sdks/IIgs:${PATH}"
export MACOSX_DEPLOYMENT_TARGET=10.6
export PATH="${JOEY}/sdks/macos/bin:${PATH}"
# Amiga Cross Compiler
export PATH="${JOEY}/sdks/amiga/bin:${PATH}"
# Raspberry Pi Cross Compiler
#export PATH="${JOEY}/sdks/pi/tools/arm-bcm2708/arm-bmc2708-linux-gnueabi/bin:${PATH}"
#export PATH="${JOEY}/sdks/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:${PATH}"