diff --git a/f256lib/f256.c b/f256lib/f256.c index bc9d2bf..83d61f2 100644 --- a/f256lib/f256.c +++ b/f256lib/f256.c @@ -165,3 +165,15 @@ void FAR_POKEW(uint32_t address, uint16_t value) { SWAP_IO_SHUTDOWN(); } + + +#ifndef WITHOUT_MAIN +#ifdef main +#undef main +#endif +int f256main(int argc, char *argv[]); +int main(void) { + f256Init(); + return f256main(kernelArgs->common.extlen / 2, (char **)kernelArgs->common.ext); +} +#endif diff --git a/f256lib/f256.h b/f256lib/f256.h index 2d1f4d1..a586d7f 100644 --- a/f256lib/f256.h +++ b/f256lib/f256.h @@ -154,7 +154,7 @@ typedef struct colorS { #define SET_BIT(x, pos) (x |= (1U << pos)) -// Work out configuration DEFINEs. +// Verify configuration DEFINEs. #ifdef WITHOUT_GRAPHICS #define WITHOUT_BITMAP #define WITHOUT_TILE @@ -162,16 +162,29 @@ typedef struct colorS { #endif #ifndef WITHOUT_FILE // File requires Kernel -#undef WITHOUT_KERNEL +#ifdef WITHOUT_KERNEL +#error "FILE requires KERNEL." +#endif #endif #ifndef WITHOUT_TEXT // Text requries Math -#undef WITHOUT_MATH +#ifdef WITHOUT_MATH +#error "TEXT requires MATH." +#endif #endif #ifndef WITHOUT_BITMAP // Bitmap requries Math -#undef WITHOUT_MATH +#ifdef WITHOUT_MATH +#error "BITMAP requires MATH." #endif +#endif + +#ifndef WITHOUT_MAIN // Main requries Kernel +#ifdef WITHOUT_KERNEL +#error "MAIN requires KERNEL." +#endif +#endif + #ifndef WITHOUT_KERNEL #include "kernel.h" @@ -215,6 +228,11 @@ void FAR_POKE(uint32_t address, byte value); void FAR_POKEW(uint32_t address, uint16_t value); +#ifndef WITHOUT_MAIN +#define main f256main +#endif + + #ifdef __cplusplus } #endif