diff --git a/.gitignore b/.gitignore index 2c8e6a8..dd0b28d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ include/ generated/ overlay overlayhelper +f256lib.h # Dumb QtCreator junk build-*/ diff --git a/build-f256lib.sh b/build-f256lib.sh new file mode 100755 index 0000000..91688f4 --- /dev/null +++ b/build-f256lib.sh @@ -0,0 +1,76 @@ +#!/bin/bash -ex + +# +# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + + +TARGET=f256lib.h + + +cat f256lib/stddclmr.h > ${TARGET} + +echo "#define F256LIB_AMALGAMATED_BUILD" >> ${TARGET} + +cat f256lib/f_api.h >> ${TARGET} + +cat include/f256_dma.h >> ${TARGET} +cat include/f256_intmath.h >> ${TARGET} +cat include/f256_irq.h >> ${TARGET} +cat include/f256jr.h >> ${TARGET} +cat include/f256_rtc.h >> ${TARGET} +cat include/f256_sprites.h >> ${TARGET} +cat include/f256_tiles.h >> ${TARGET} +cat include/f256_timers.h >> ${TARGET} +cat include/f256_via.h >> ${TARGET} +cat include/f256_xymath.h >> ${TARGET} + +cat f256lib/f256.h >> ${TARGET} + +cat f256lib/f_kernel.h >> ${TARGET} +cat f256lib/f_dma.h >> ${TARGET} +cat f256lib/f_math.h >> ${TARGET} +cat f256lib/f_random.h >> ${TARGET} +cat f256lib/f_text.h >> ${TARGET} +cat f256lib/f_bitmap.h >> ${TARGET} +cat f256lib/f_tile.h >> ${TARGET} +cat f256lib/f_graphics.h >> ${TARGET} +cat f256lib/f_sprite.h >> ${TARGET} +cat f256lib/f_file.h >> ${TARGET} +cat f256lib/f_platform.h >> ${TARGET} + +echo "#ifdef F256LIB_IMPLEMENTATION" >> ${TARGET} + +cat f256lib/f256.c >> ${TARGET} + +cat f256lib/f_kernel.c >> ${TARGET} +cat f256lib/f_dma.c >> ${TARGET} +cat f256lib/f_math.c >> ${TARGET} +cat f256lib/f_random.c >> ${TARGET} +cat f256lib/f_text.c >> ${TARGET} +cat f256lib/f_bitmap.c >> ${TARGET} +cat f256lib/f_tile.c >> ${TARGET} +cat f256lib/f_graphics.c >> ${TARGET} +cat f256lib/f_sprite.c >> ${TARGET} +cat f256lib/f_file.c >> ${TARGET} +cat f256lib/f_platform.c >> ${TARGET} + +echo "#endif" >> ${TARGET} diff --git a/examples/pgztest/build.sh b/examples/pgztest/build.sh index 4027943..7b51954 100755 --- a/examples/pgztest/build.sh +++ b/examples/pgztest/build.sh @@ -33,11 +33,10 @@ PATH=${LLVM}/bin:${PATH} echo "__f256_start = ${START};" > ${SETTINGS} -CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -Wall -O3" +CLANG="mos-f256k-clang -I${F256}/include -I${F256}/f256lib -Wall -Os" -${CLANG} -c ${F256}/f256lib/f256.c ${CLANG} -c ${PROJECT}.c -${CLANG} -o ${PROJECT} ${PROJECT}.o f256.o +${CLANG} -o ${PROJECT} ${PROJECT}.o mv -f ${PROJECT} ${PROJECT}.bin diff --git a/examples/pgztest/pgztest.c b/examples/pgztest/pgztest.c index 793aaee..b42c225 100644 --- a/examples/pgztest/pgztest.c +++ b/examples/pgztest/pgztest.c @@ -21,7 +21,8 @@ */ -#include "f256.h" +#define F256LIB_IMPLEMENTATION +#include "../../f256lib.h" void dirtest(void) { @@ -67,14 +68,12 @@ void dirtest(void) { } -int main(void) { +int main(int argc, char *argv[]) { struct time_t clock; - f256Init(); - //dirtest(); - while(true) { + while (true) { kernelNextEvent(); kernelArgs->common.buf = &clock; kernelArgs->common.buflen = sizeof(struct time_t); diff --git a/f256lib/f256.c b/f256lib/f256.c index c72b586..a97f3a9 100644 --- a/f256lib/f256.c +++ b/f256lib/f256.c @@ -21,41 +21,19 @@ */ +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" - - -#ifndef WITHOUT_KERNEL -#include "kernel.c" -#endif -#ifndef WITHOUT_DMA -#include "dma.c" -#endif -#ifndef WITHOUT_MATH -#include "math.c" -#endif -#ifndef WITHOUT_RANDOM -#include "random.c" -#endif -#ifndef WITHOUT_TEXT -#include "text.c" -#endif -#ifndef WITHOUT_BITMAP -#include "bitmap.c" -#endif -#ifndef WITHOUT_TILE -#include "tile.c" -#endif -#if !(defined WITHOUT_BITMAP || defined WITHOUT_TILE || defined WITHOUT_SPRITE) -#include "graphics.c" -#endif -#ifndef WITHOUT_SPRITE -#include "sprite.c" -#endif -#ifndef WITHOUT_FILE -#include "file.c" -#endif -#ifndef WITHOUT_PLATFORM -#include "platform.c" +#include "f_kernel.c" +#include "f_dma.c" +#include "f_math.c" +#include "f_random.c" +#include "f_text.c" +#include "f_bitmap.c" +#include "f_tile.c" +#include "f_graphics.c" +#include "f_sprite.c" +#include "f_file.c" +#include "f_platform.c" #endif diff --git a/f256lib/f256.h b/f256lib/f256.h index 575ff5c..842dbb7 100644 --- a/f256lib/f256.h +++ b/f256lib/f256.h @@ -21,6 +21,70 @@ */ +/* + * Configuration DEFINEs + * + * Before including this file, you may define one or more of the following + * to customize the library for your application: + * + * SWAP_RESTORE + * + * When using functions such as FAR_PEEK or bitmap features, return the + * swap slot back to it's original memory location before returning. By + * default, the swap slot is left in whatever state the last function that + * used it switched it to. + * + * WITHOUT_GRAPHICS + * + * Shortcut for WITHOUT_BITMAP, WITHOUT_TILE, and WITHOUT_SPRITE. + * + * WITHOUT_BITMAP + * + * Disables bitmap functions. + * + * WITHOUT_TILE + * + * Disables tilemap functions. + * + * WITHOUT_SPRITE + * + * Disables sprite functions. + * + * WITHOUT_FILE + * + * Disables file handling support. + * + * WITHOUT_KERNEL + * + * Disables microkernel support. Also disables FILE, PLATFORM, and MAIN. + * + * WITHOUT_TEXT + * + * Disables text functions. Also disables PLATFORM. + * + * WITHOUT_MATH + * + * Disables math coprocessor support. Also disables TEXT, PLATFORM and + * BITMAP. + * + * WITHOUT_MAIN + * + * Removes support for the standardized "int main(int argc, char *argv[])" + * function and replaces it with "int main(void)". You must also manually + * call "f256Init()" at the start of your program. + * + * WITHOUT_PLATFORM + * + * Removes basic C library I/O support for "getchar()" and "__putchar()". + * This removes printf(). + * + * WITHOUT_DMA + * + * Removes DMA support. In the future, will also disable BITMAP. + * + */ + + #ifndef F256_H #define F256_H @@ -34,10 +98,10 @@ extern "C" #include #include + +#ifndef F256LIB_AMALGAMATED_BUILD #include "stddclmr.h" - -#include "api.h" - +#include "f_api.h" #include "f256_dma.h" #include "f256_intmath.h" #include "f256_irq.h" @@ -48,6 +112,7 @@ extern "C" #include "f256_timers.h" #include "f256_via.h" #include "f256_xymath.h" +#endif typedef unsigned char byte; @@ -165,69 +230,44 @@ typedef struct colorS { // Verify configuration DEFINEs. +#if (defined WITHOUT_BITMAP && defined WITHOUT_TILE && defined WITHOUT_SPRITE) +#define WITHOUT_GRAPHICS +#endif + #ifdef WITHOUT_GRAPHICS #define WITHOUT_BITMAP #define WITHOUT_TILE #define WITHOUT_SPRITE #endif -#ifndef WITHOUT_FILE // File requires Kernel #ifdef WITHOUT_KERNEL -#error "FILE requires KERNEL." -#endif +#define WITHOUT_FILE +#define WITHOUT_MAIN +#define WITHOUT_PLATFORM +#endif + +#ifdef WITHOUT_TEXT +#define WITHOUT_PLATFORM #endif -#ifndef WITHOUT_TEXT // Text requries Math #ifdef WITHOUT_MATH -#error "TEXT requires MATH." -#endif -#endif - -#ifndef WITHOUT_BITMAP // Bitmap requries Math -#ifdef WITHOUT_MATH -#error "BITMAP requires MATH." -#endif -#endif - -#ifndef WITHOUT_MAIN // Main requries Kernel -#ifdef WITHOUT_KERNEL -#error "MAIN requires KERNEL." -#endif +#define WITHOUT_TEXT +#define WITHOUT_PLATFORM #endif -#ifndef WITHOUT_KERNEL -#include "kernel.h" -#endif -#ifndef WITHOUT_DMA -#include "dma.h" -#endif -#ifndef WITHOUT_MATH -#include "math.h" -#endif -#ifndef WITHOUT_RANDOM -#include "random.h" -#endif -#ifndef WITHOUT_TEXT -#include "text.h" -#endif -#ifndef WITHOUT_BITMAP -#include "bitmap.h" -#endif -#ifndef WITHOUT_TILE -#include "tile.h" -#endif -#if !(defined WITHOUT_BITMAP || defined WITHOUT_TILE || defined WITHOUT_SPRITE) -#include "graphics.h" -#endif -#ifndef WITHOUT_SPRITE -#include "sprite.h" -#endif -#ifndef WITHOUT_FILE -#include "file.h" -#endif -#ifndef WITHOUT_PLATFORM -#include "platform.h" +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_kernel.h" +#include "f_dma.h" +#include "f_math.h" +#include "f_random.h" +#include "f_text.h" +#include "f_bitmap.h" +#include "f_tile.h" +#include "f_graphics.h" +#include "f_sprite.h" +#include "f_file.h" +#include "f_platform.h" #endif @@ -250,4 +290,11 @@ void FAR_POKEW(uint32_t address, uint16_t value); #endif +#ifndef F256LIB_AMALGAMATED_BUILD +#ifdef F256LIB_IMPLEMENTATION +#include "f256.c" +#endif +#endif + + #endif // F256_H diff --git a/f256lib/api.h b/f256lib/f_api.h similarity index 100% rename from f256lib/api.h rename to f256lib/f_api.h diff --git a/f256lib/bitmap.c b/f256lib/f_bitmap.c similarity index 98% rename from f256lib/bitmap.c rename to f256lib/f_bitmap.c index 4d30128..fe833a4 100644 --- a/f256lib/bitmap.c +++ b/f256lib/f_bitmap.c @@ -21,8 +21,13 @@ */ -#include "bitmap.h" -#include "dma.h" +#ifndef WITHOUT_BITMAP + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_bitmap.h" +#include "f_dma.h" +#endif static uint16_t _MAX_X; @@ -246,3 +251,6 @@ void bitmapSetVisible(byte p, bool v) { break; } } + + +#endif diff --git a/f256lib/bitmap.h b/f256lib/f_bitmap.h similarity index 95% rename from f256lib/bitmap.h rename to f256lib/f_bitmap.h index c954854..7dcec50 100644 --- a/f256lib/bitmap.h +++ b/f256lib/f_bitmap.h @@ -23,6 +23,7 @@ #ifndef BITMAP_H #define BITMAP_H +#ifndef WITHOUT_BITMAP #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void bitmapClear(void); @@ -51,4 +54,5 @@ void bitmapSetVisible(byte p, bool v); #endif +#endif #endif // BITMAP_H diff --git a/f256lib/dma.c b/f256lib/f_dma.c similarity index 95% rename from f256lib/dma.c rename to f256lib/f_dma.c index 32298cf..87d39e4 100644 --- a/f256lib/dma.c +++ b/f256lib/f_dma.c @@ -21,7 +21,12 @@ */ -#include "dma.h" +#ifndef WITHOUT_DMA + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_dma.h" +#endif static void dmaWait(void); @@ -66,3 +71,6 @@ static void dmaWait(void) { // Then wait for a VBL because two DMAs per frame will crash. //graphicsWaitVerticalBlank(); } + + +#endif diff --git a/f256lib/dma.h b/f256lib/f_dma.h similarity index 95% rename from f256lib/dma.h rename to f256lib/f_dma.h index bbb5bbb..fc97f37 100644 --- a/f256lib/dma.h +++ b/f256lib/f_dma.h @@ -23,6 +23,7 @@ #ifndef DMA_H #define DMA_H +#ifndef WITHOUT_DMA #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void dmaFill(uint32_t start, uint32_t length, byte value); @@ -43,4 +46,5 @@ void dma2dFill(uint32_t start, uint16_t width, uint16_t height, uint16_t stride, #endif +#endif #endif // DMA_H diff --git a/f256lib/file.c b/f256lib/f_file.c similarity index 99% rename from f256lib/file.c rename to f256lib/f_file.c index 4bbc9c9..e5abe95 100644 --- a/f256lib/file.c +++ b/f256lib/f_file.c @@ -21,9 +21,14 @@ */ +#ifndef WITHOUT_FILE + + #include -#include "file.h" +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_file.h" +#endif #define MAX_DRIVES 8 @@ -484,3 +489,4 @@ static char *pathWithoutDrive(char *path, byte *drive) { } +#endif diff --git a/f256lib/file.h b/f256lib/f_file.h similarity index 97% rename from f256lib/file.h rename to f256lib/f_file.h index 5514114..3798193 100644 --- a/f256lib/file.h +++ b/f256lib/f_file.h @@ -23,6 +23,7 @@ #ifndef FILE_H #define FILE_H +#ifndef WITHOUT_FILE #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif typedef struct fileDirEntS { @@ -91,4 +94,5 @@ int16_t fileWrite(void *buf, uint16_t nbytes, uint16_t nmemb, uint8_t *fd); #endif +#endif #endif // FILE_H diff --git a/f256lib/graphics.c b/f256lib/f_graphics.c similarity index 96% rename from f256lib/graphics.c rename to f256lib/f_graphics.c index 6f1c253..c359acb 100644 --- a/f256lib/graphics.c +++ b/f256lib/f_graphics.c @@ -21,7 +21,12 @@ */ -#include "graphics.h" +#ifndef WITHOUT_GRAPHICS + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_graphics.h" +#endif void graphicsDefineColor(byte clut, byte slot, byte r, byte g, byte b) { @@ -102,3 +107,6 @@ void graphicsWaitVerticalBlank(void) { // Spin our wheels. ; } + + +#endif diff --git a/f256lib/graphics.h b/f256lib/f_graphics.h similarity index 95% rename from f256lib/graphics.h rename to f256lib/f_graphics.h index 26a9b9d..b7387cd 100644 --- a/f256lib/graphics.h +++ b/f256lib/f_graphics.h @@ -23,6 +23,7 @@ #ifndef GRAPHICS_H #define GRAPHICS_H +#ifndef WITHOUT_GRAPHICS #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void graphicsDefineColor(byte clut, byte slot, byte r, byte g, byte b); @@ -46,4 +49,5 @@ void graphicsWaitVerticalBlank(void); #endif +#endif #endif // GRAPHICS_H diff --git a/f256lib/kernel.c b/f256lib/f_kernel.c similarity index 96% rename from f256lib/kernel.c rename to f256lib/f_kernel.c index 25acbc9..4afc37b 100644 --- a/f256lib/kernel.c +++ b/f256lib/f_kernel.c @@ -21,7 +21,12 @@ */ -#include "kernel.h" +#ifndef WITHOUT_KERNEL + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_kernel.h" +#endif kernelEventT kernelEventData; // Allocate some RAM to hold event data. @@ -132,3 +137,6 @@ void kernelReset(void) { // ***TODO*** Network */ + + +#endif diff --git a/f256lib/kernel.h b/f256lib/f_kernel.h similarity index 97% rename from f256lib/kernel.h rename to f256lib/f_kernel.h index fa57a80..011669a 100644 --- a/f256lib/kernel.h +++ b/f256lib/f_kernel.h @@ -23,6 +23,7 @@ #ifndef KERNEL_H #define KERNEL_H +#ifndef WITHOUT_KERNEL #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif #define kernelNextEvent() ({ kernelEventData.type = 0; kernelCall(NextEvent); }) @@ -70,4 +73,5 @@ void kernelReset(void); #endif +#endif #endif // KERNEL_H diff --git a/f256lib/math.c b/f256lib/f_math.c similarity index 96% rename from f256lib/math.c rename to f256lib/f_math.c index 9dac46e..9d4cf16 100644 --- a/f256lib/math.c +++ b/f256lib/f_math.c @@ -21,7 +21,12 @@ */ -#include "math.h" +#ifndef WITHOUT_MATH + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_math.h" +#endif int16_t mathSignedDivision(int16_t a, int16_t b) { @@ -124,3 +129,6 @@ uint32_t mathUnsignedMultiply(uint16_t a, uint16_t b) { POKEW(MULU_B_L, b); return PEEKD(MULU_LL); } + + +#endif diff --git a/f256lib/math.h b/f256lib/f_math.h similarity index 96% rename from f256lib/math.h rename to f256lib/f_math.h index 641f9f9..6f357ef 100644 --- a/f256lib/math.h +++ b/f256lib/f_math.h @@ -23,6 +23,7 @@ #ifndef MATH_H #define MATH_H +#ifndef WITHOUT_MATH #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif int16_t mathSignedDivision(int16_t a, int16_t b); @@ -48,4 +51,5 @@ uint32_t mathUnsignedMultiply(uint16_t a, uint16_t b); #endif +#endif #endif // MATH_H diff --git a/f256lib/platform.c b/f256lib/f_platform.c similarity index 93% rename from f256lib/platform.c rename to f256lib/f_platform.c index 1a58d25..eb242a7 100644 --- a/f256lib/platform.c +++ b/f256lib/f_platform.c @@ -21,7 +21,12 @@ */ -#include "platform.h" +#ifndef WITHOUT_PLATFORM + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_platform.h" +#endif // printf() support. @@ -48,3 +53,4 @@ int getchar(void) { } +#endif diff --git a/f256lib/platform.h b/f256lib/f_platform.h similarity index 94% rename from f256lib/platform.h rename to f256lib/f_platform.h index 525f70f..8c59d40 100644 --- a/f256lib/platform.h +++ b/f256lib/f_platform.h @@ -23,6 +23,7 @@ #ifndef PLATFORM_H #define PLATFORM_H +#ifndef WITHOUT_PLATFORM #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void __putchar(char c); @@ -43,4 +46,5 @@ int getchar(void); // This is an int so llvm-mos finds it. #endif +#endif #endif // PLATFORM_H diff --git a/f256lib/random.c b/f256lib/f_random.c similarity index 94% rename from f256lib/random.c rename to f256lib/f_random.c index cc2cebe..5128216 100644 --- a/f256lib/random.c +++ b/f256lib/f_random.c @@ -21,7 +21,12 @@ */ -#include "random.h" +#ifndef WITHOUT_RANDOM + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_random.h" +#endif uint16_t randomRead(void) { @@ -50,3 +55,5 @@ void randomSeed(uint16_t seed) { POKE(VKY_RND_CTRL, 3); // Enable, load seed. } + +#endif diff --git a/f256lib/random.h b/f256lib/f_random.h similarity index 95% rename from f256lib/random.h rename to f256lib/f_random.h index 9469802..212a053 100644 --- a/f256lib/random.h +++ b/f256lib/f_random.h @@ -23,6 +23,7 @@ #ifndef RANDOM_H #define RANDOM_H +#ifndef WITHOUT_RANDOM #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif uint16_t randomRead(void); @@ -44,4 +47,5 @@ void randomSeed(uint16_t seed); #endif +#endif #endif // RANDOM_H diff --git a/f256lib/sprite.c b/f256lib/f_sprite.c similarity index 95% rename from f256lib/sprite.c rename to f256lib/f_sprite.c index 4103bbe..f326dcb 100644 --- a/f256lib/sprite.c +++ b/f256lib/f_sprite.c @@ -21,7 +21,12 @@ */ -#include "sprite.h" +#ifndef WITHOUT_SPRITE + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_sprite.h" +#endif #define OFF_SPR_ADL_L 1 @@ -77,3 +82,6 @@ void spriteReset(void) { // Hide all sprites. for (x=0; x<64; x++) spriteSetVisible(x, false); } + + +#endif diff --git a/f256lib/sprite.h b/f256lib/f_sprite.h similarity index 95% rename from f256lib/sprite.h rename to f256lib/f_sprite.h index a9137b7..8e927a7 100644 --- a/f256lib/sprite.h +++ b/f256lib/f_sprite.h @@ -23,6 +23,7 @@ #ifndef SPRITE_H #define SPRITE_H +#ifndef WITHOUT_SPRITE #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void spriteDefine(byte s, uint32_t address, byte size, byte CLUT, byte layer); @@ -45,4 +48,5 @@ void spriteReset(void); #endif +#endif #endif // SPRITE_H diff --git a/f256lib/text.c b/f256lib/f_text.c similarity index 98% rename from f256lib/text.c rename to f256lib/f_text.c index f382a0d..126ea6d 100644 --- a/f256lib/text.c +++ b/f256lib/f_text.c @@ -21,8 +21,13 @@ */ -#include "text.h" -#include "math.h" +#ifndef WITHOUT_TEXT + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_text.h" +#include "f_math.h" +#endif colorT textColors[16] = { @@ -251,3 +256,6 @@ void textSetDouble(bool x, bool y) { _MAX_COL = x ? 40 : 80; _MAX_ROW = y ? 30 : 60; } + + +#endif diff --git a/f256lib/text.h b/f256lib/f_text.h similarity index 96% rename from f256lib/text.h rename to f256lib/f_text.h index 7c0ca80..4e5291b 100644 --- a/f256lib/text.h +++ b/f256lib/f_text.h @@ -23,6 +23,7 @@ #ifndef TEXT_H #define TEXT_H +#ifndef WITHOUT_TEXT #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif // Apple IIgs Colors, because that's how we roll. @@ -81,4 +84,5 @@ void textSetDouble(bool x, bool y); #endif +#endif #endif // TEXT_H diff --git a/f256lib/tile.c b/f256lib/f_tile.c similarity index 97% rename from f256lib/tile.c rename to f256lib/f_tile.c index e8e1fde..cc6613e 100644 --- a/f256lib/tile.c +++ b/f256lib/f_tile.c @@ -21,7 +21,12 @@ */ -#include "tile.h" +#ifndef WITHOUT_TILE + + +#ifndef F256LIB_AMALGAMATED_BUILD +#include "f_tile.h" +#endif static byte _tileSize[3]; @@ -136,3 +141,6 @@ void tileReset(void) { tileSetVisible(1, false); tileSetVisible(2, false); } + + +#endif diff --git a/f256lib/tile.h b/f256lib/f_tile.h similarity index 95% rename from f256lib/tile.h rename to f256lib/f_tile.h index 4cdd057..6779543 100644 --- a/f256lib/tile.h +++ b/f256lib/f_tile.h @@ -23,6 +23,7 @@ #ifndef TILE_H #define TILE_H +#ifndef WITHOUT_TILE #ifdef __cplusplus @@ -31,7 +32,9 @@ extern "C" #endif +#ifndef F256LIB_AMALGAMATED_BUILD #include "f256.h" +#endif void tileDefineTileMap(byte t, uint32_t address, byte tileSize, uint16_t mapSizeX, uint16_t mapSizeY); @@ -46,4 +49,5 @@ void tileReset(void); #endif +#endif #endif // TILE_H