From e9ad4e2a7994705d23ae3c1397e5f41760616f1b Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Sat, 11 Mar 2023 20:36:46 +0100 Subject: [PATCH 01/12] Start working on libgint-fxascg - compilation options --- CMakeLists.txt | 15 +++++++++++++++ cmake/FindGint.cmake | 4 ++++ giteapc.make | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8307e3..fd65a0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,10 @@ set(SOURCES_CG src/render-cg/image/image_p4_dye.c ) +set(SOURCES_FXASCG + # R61524 driver +) + set(ASSETS_FX src/font5x7.png) set(ASSETS_CG src/font8x9.png) fxconv_declare_assets(${ASSETS_FX} ${ASSETS_CG}) @@ -273,6 +277,17 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) ${LINKER_SCRIPTS}) endif() +if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) + add_compile_options(-DFX9860G) + add_compile_definitions(FX9860G_AS_CG) + set(NAME "gint-fxascg") + set(LINKER_SCRIPTS + "${CMAKE_CURRENT_BINARY_DIR}/fxcg50.ld" + "${CMAKE_CURRENT_BINARY_DIR}/fxcg50_fastload.ld") + add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_FX} ${SOURCES_FXASCG} ${ASSETS_FX} + ${LINKER_SCRIPTS}) +endif() + set_target_properties("${NAME}" PROPERTIES OUTPUT_NAME "${NAME}") # Generate linker scripts diff --git a/cmake/FindGint.cmake b/cmake/FindGint.cmake index 89ddd4f..2d765c8 100644 --- a/cmake/FindGint.cmake +++ b/cmake/FindGint.cmake @@ -7,6 +7,10 @@ elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G) set(PC fx) set(INTF_DEFN FX9860G) set(INTF_LINK "-T;fx9860g.ld") +elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) + set(PC fxascg) + set(INTF_DEFN FX9860G_AS_CG) + set(INTF_LINK "-T;fxcg50.ld") else() message(FATAL_ERROR "gint: unknown fxSDK platform '${FXSDK_PLATFORM}'") endif() diff --git a/giteapc.make b/giteapc.make index 0e04359..c3ef6ce 100644 --- a/giteapc.make +++ b/giteapc.make @@ -5,14 +5,17 @@ configure: @ fxsdk build-fx -c $(GINT_CMAKE_OPTIONS) @ fxsdk build-cg -c $(GINT_CMAKE_OPTIONS) + @ fxsdk build-fx-as-cg -c $(GINT_CMAKE_OPTIONS) build: @ fxsdk build-fx @ fxsdk build-cg + @ fxsdk build-fx-as-cg install: @ fxsdk build-fx install @ fxsdk build-cg install + @ fxsdk build-fx-as-cg install uninstall: @ if [ -e build-fx/install_manifest.txt ]; then \ @@ -21,5 +24,8 @@ uninstall: @ if [ -e build-cg/install_manifest.txt ]; then \ xargs rm -f < build-cg/install_manifest.txt; \ fi + @ if [ -e build-fx-as-cg/install_manifest.txt ]; then \ + xargs rm -f < build-fxascg/install_manifest.txt; \ + fi .PHONY: configure build install uninstall -- 2.45.0 From ff587b6e90d45473c8cec804df6d1d928e6622ac Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Sun, 12 Mar 2023 16:18:54 +0100 Subject: [PATCH 02/12] libgint-fxascg - compilation options set to TARGET_FXCG50 --- CMakeLists.txt | 14 ++++++++++---- src/intc/intc.c | 1 - src/kernel/start.c | 6 +++--- src/render-cg/topti.c | 13 ++++++++++--- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd65a0a..076dffb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,8 +249,14 @@ set(SOURCES_FXASCG # R61524 driver ) -set(ASSETS_FX src/font5x7.png) -set(ASSETS_CG src/font8x9.png) +set(ASSETS_FX + src/font5x7.png +) + +set(ASSETS_CG + src/font8x9.png +) + fxconv_declare_assets(${ASSETS_FX} ${ASSETS_CG}) include_directories( @@ -278,13 +284,13 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) endif() if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) - add_compile_options(-DFX9860G) + add_compile_options(-DFXCG50) add_compile_definitions(FX9860G_AS_CG) set(NAME "gint-fxascg") set(LINKER_SCRIPTS "${CMAKE_CURRENT_BINARY_DIR}/fxcg50.ld" "${CMAKE_CURRENT_BINARY_DIR}/fxcg50_fastload.ld") - add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_FX} ${SOURCES_FXASCG} ${ASSETS_FX} + add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_CG} ${SOURCES_FXASCG} ${ASSETS_FX} ${LINKER_SCRIPTS}) endif() diff --git a/src/intc/intc.c b/src/intc/intc.c index 10c471a..2acdf50 100644 --- a/src/intc/intc.c +++ b/src/intc/intc.c @@ -11,7 +11,6 @@ //--- // Interrupt controllers //--- - GRODATA3 sh7705_intc_t const SH7705_INTC = { .IPR = { (void *)0xfffffee2, (void *)0xfffffee4, diff --git a/src/kernel/start.c b/src/kernel/start.c index 4421cc8..8b8a268 100644 --- a/src/kernel/start.c +++ b/src/kernel/start.c @@ -26,7 +26,7 @@ extern uint32_t lilram, silram, rilram, /* IL memory section */ lxyram, sxyram, rxyram, /* X and Y memory section */ sbss, rbss; /* User's BSS section */ -#ifdef FX9860G +#if defined(FX9860G) && !defined(FX9860G_AS_CG) extern uint32_t lgmapped, sgmapped, /* Permanently mapped functions */ lreloc, sreloc; /* Relocatable references */ @@ -136,7 +136,7 @@ static int start2(int isappli, int optnum) 1.00 and the fx-9860G emulator) is not clear yet, so gint can't load pages dynamically. Load everything preventively (works only if the add-in is small enough) */ - #ifdef FX9860G + #if defined(FX9860G) && !defined(FX9860G_AS_CG) if(isSH3()) { /* Try to map every ROM address up to _srom */ @@ -159,7 +159,7 @@ static int start2(int isappli, int optnum) gint_load_onchip_sections(); - #ifdef FX9860G + #if defined(FX9860G) && !defined(FX9860G_AS_CG) /* Copy permanently-mapped code to start of user RAM (on fx-CG 50 it is loaded along ILRAM contents) */ void *rgmapped = mmu_uram(); diff --git a/src/render-cg/topti.c b/src/render-cg/topti.c index 31fdb39..3bab6e9 100644 --- a/src/render-cg/topti.c +++ b/src/render-cg/topti.c @@ -9,9 +9,16 @@ #include "topti-asm.h" /* Default font */ -extern font_t gint_font8x9; -font_t const * gint_default_font = &gint_font8x9; -font_t const * topti_font = &gint_font8x9; +#if(FX9860G_AS_CG) + extern font_t gint_font5x7; + font_t const * gint_default_font = &gint_font5x7; + font_t const * topti_font = &gint_font5x7; +#else + extern font_t gint_font8x9; + font_t const * gint_default_font = &gint_font8x9; + font_t const * topti_font = &gint_font8x9; +#endif + /* topti_glyph(): Render a glyph on the VRAM Prints a glyph naively using word accesses, because for most fonts with a -- 2.45.0 From 836706b4dc68b6b138a1e2e9fe29141651bbc1a3 Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Sun, 12 Mar 2023 21:41:57 +0100 Subject: [PATCH 03/12] [WIP] build-fx-as-cg : upscaling of FX VRAM to CG VRAM + adhoc dupdate --- CMakeLists.txt | 31 +++++++++++- include/gint/display-cg.h | 2 +- include/gint/display-fx.h | 2 +- include/gint/display.h | 4 +- src/render-fxascg/dupdate.c | 97 +++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 src/render-fxascg/dupdate.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 076dffb..8ea5cd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,7 +246,34 @@ set(SOURCES_CG ) set(SOURCES_FXASCG - # R61524 driver + # Gray engine + src/gray/engine.c + src/gray/gclear.c + src/gray/ggetpixel.c + src/gray/gint_gline.c + src/gray/gpixel.c + src/gray/grect.c + src/gray/gsubimage.c + src/gray/gtext.c + # Rendering + src/render-fx/bopti-asm-gray-scsp.s + src/render-fx/bopti-asm-gray.s + src/render-fx/bopti-asm-mono-scsp.s + src/render-fx/bopti-asm.s + src/render-fx/bopti.c + src/render-fx/dclear.c + src/render-fx/dgetpixel.c + src/render-fx/dpixel.c + src/render-fx/drect.c + src/render-fx/dsubimage.c + src/render-fx/gint_dline.c + src/render-fx/masks.c + src/render-fx/topti-asm.s + src/render-fx/topti.c + #special dupdate functions to treat a FX VRAM and convert to a CG VRAM + src/render-fxascg/dupdate.c + # R61524 driver as we are working with a CG50 + src/r61524/r61524.c ) set(ASSETS_FX @@ -290,7 +317,7 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) set(LINKER_SCRIPTS "${CMAKE_CURRENT_BINARY_DIR}/fxcg50.ld" "${CMAKE_CURRENT_BINARY_DIR}/fxcg50_fastload.ld") - add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_CG} ${SOURCES_FXASCG} ${ASSETS_FX} + add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_FXASCG} ${ASSETS_FX} ${LINKER_SCRIPTS}) endif() diff --git a/include/gint/display-cg.h b/include/gint/display-cg.h index e297205..e9fa807 100644 --- a/include/gint/display-cg.h +++ b/include/gint/display-cg.h @@ -15,7 +15,7 @@ #ifndef GINT_DISPLAY_CG #define GINT_DISPLAY_CG -#ifdef FXCG50 +#if defined(FXCG50) && !defined(FX9860G_AS_CG) #ifdef __cplusplus extern "C" { diff --git a/include/gint/display-fx.h b/include/gint/display-fx.h index af85e43..eb4eff6 100644 --- a/include/gint/display-fx.h +++ b/include/gint/display-fx.h @@ -9,7 +9,7 @@ #ifndef GINT_DISPLAY_FX #define GINT_DISPLAY_FX -#ifdef FX9860G +#if defined(FX9860G) || defined(FX9860G_AS_CG) #ifdef __cplusplus extern "C" { diff --git a/include/gint/display.h b/include/gint/display.h index 599fd15..7236800 100644 --- a/include/gint/display.h +++ b/include/gint/display.h @@ -19,11 +19,11 @@ extern "C" { /* Platform-specific functions include VRAM management and the definition of the color_t type. */ -#ifdef FX9860G +#if defined(FX9860G) || defined(FX9860G_AS_CG) #include #endif -#ifdef FXCG50 +#if defined(FXCG50) && ! defined(FX9860G_AS_CG) #include #endif diff --git a/src/render-fxascg/dupdate.c b/src/render-fxascg/dupdate.c new file mode 100644 index 0000000..be5d455 --- /dev/null +++ b/src/render-fxascg/dupdate.c @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include "../render-fx/render-fx.h" + +/* The destination VRAM for upscaling + centering + conversion B&W --> 16bits RGB565 */ +uint16_t *cg_vram; // set to 0 at initialisation + +/* Standard video RAM for fx9860g is 1 bit per pixel */ +GALIGNED(32) static uint32_t fx_vram[256]; + +/* Here is the definition of the VRAM pointer, exposed in */ +uint32_t *gint_vram = fx_vram; + +/* The current rendering mode */ +struct rendering_mode const *dmode = NULL; + + +bool dvram_init( void ) +{ + int const MARGIN = 32; + + /* Leave MARGIN bytes on each side of the region; this enables some + important optimizations in the image renderer. We also add another + 32 bytes so we can manually 32-align the region */ + uint32_t region = (uint32_t)kmalloc(DWIDTH*DHEIGHT*2 + MARGIN*2 + 32, +#if !defined(GINT_NO_OS_STACK) + "_ostk" +#else + NULL +#endif + ); + if(region == 0) + return false; + + /* 32-align the region */ + region = (region + 31) & -32; + /* Skip a MARGIN */ + region += MARGIN; + /* Use an uncached address */ + region = (region & 0x1fffffff) | 0xa0000000; + + /* Don't enable triple buffering by default */ + cg_vram = (void *)region; + return true; +} + +void dgetvram(uint16_t **ptr_vram_1, uint16_t **ptr_vram_2) +{ + if(ptr_vram_1) *ptr_vram_1 = &cg_vram; + if(ptr_vram_2) *ptr_vram_2 = &cg_vram; +} + +inline drawupscale( int x, int y, int color ) +{ + int u=y*396*3*2; + + uint16_t colorcg; + + if (color==C_WHITE) colorcg=0xFFFF; + else colorcg=0x0000; + + int baseindex = (396*16+6+x+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black + cg_vram[baseindex] = colorcg; + cg_vram[baseindex+1] = colorcg; + cg_vram[baseindex+2] = colorcg; + + baseindex+=396; + cg_vram[baseindex] = colorcg; + cg_vram[baseindex+1] = colorcg; + cg_vram[baseindex+2] = colorcg; + + baseindex+=396; + cg_vram[baseindex] = colorcg; + cg_vram[baseindex+1] = colorcg; + cg_vram[baseindex+2] = colorcg; +} + +/* dupdate(): Push the video RAM to the display driver */ +void dupdate(void) +{ + + for( int j=0; j Date: Mon, 13 Mar 2023 22:22:36 +0100 Subject: [PATCH 04/12] corrected issue with screen aspect ratio on CG50 during upscaling --- src/render-fxascg/dupdate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/render-fxascg/dupdate.c b/src/render-fxascg/dupdate.c index be5d455..545625e 100644 --- a/src/render-fxascg/dupdate.c +++ b/src/render-fxascg/dupdate.c @@ -54,14 +54,15 @@ void dgetvram(uint16_t **ptr_vram_1, uint16_t **ptr_vram_2) inline drawupscale( int x, int y, int color ) { - int u=y*396*3*2; + int u=y*396*3; + int v=x*3; uint16_t colorcg; if (color==C_WHITE) colorcg=0xFFFF; else colorcg=0x0000; - int baseindex = (396*16+6+x+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black + int baseindex = (396*16+6+v+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black cg_vram[baseindex] = colorcg; cg_vram[baseindex+1] = colorcg; cg_vram[baseindex+2] = colorcg; -- 2.45.0 From dceaa2e9cfaa9d230edc6278b75363770884be86 Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Thu, 16 Mar 2023 22:28:28 +0100 Subject: [PATCH 05/12] [WIP] - conversion of the gray scale engine to the CG for fx_as_cg build target - compiling - linking _ but ony B&W yet --- CMakeLists.txt | 2 +- src/gray/engine_fxascg.c | 353 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 354 insertions(+), 1 deletion(-) create mode 100644 src/gray/engine_fxascg.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ea5cd3..4309d58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,7 @@ set(SOURCES_CG set(SOURCES_FXASCG # Gray engine - src/gray/engine.c + src/gray/engine_fxascg.c src/gray/gclear.c src/gray/ggetpixel.c src/gray/gint_gline.c diff --git a/src/gray/engine_fxascg.c b/src/gray/engine_fxascg.c new file mode 100644 index 0000000..80a7ec0 --- /dev/null +++ b/src/gray/engine_fxascg.c @@ -0,0 +1,353 @@ +//--- +// gint:gray:engine - Core gray engine +//--- + +#include +#include +#include +#include +#include + +#include + +#include "../render-fx/render-fx.h" + +/* Three additional video RAMS, allocated statically if --static-gray was set + at configure time, or with malloc() otherwise. */ +#ifdef GINT_STATIC_GRAY +GBSS static uint32_t gvrams[3][256]; +#endif + +uint16_t *cg_vram_gray; + +/* Four VRAMs: two to draw and two to display */ +static uint32_t *vrams[4] = { NULL, NULL, NULL, NULL }; + +/* Current VRAM pair used for drawing; the value can either be 0 (draws to + VRAMs 0 and 1) or 2 (draws to VRAMs 2 and 3). */ +static int volatile st = 0; +/* Timer ID, always equal to GRAY_TIMER except if initialization fails */ +static int timer = -1; +/* Whether the engine is scheduled to run at the next frame */ +static int runs = 0; + +/* Underlying timer, set to count at P_phi/64 */ +#define GRAY_TIMER 0 +#define GRAY_CLOCK TIMER_Pphi_64 +/* Delays of the light and dark frames for the above setting */ +GBSS static int delays[2]; + +/* The alternate rendering mode structure used to override d*() */ +static struct rendering_mode const gray_mode = { + .dupdate = gupdate, + .dclear = gclear, + .drect = grect, + .dpixel = gpixel, + .dgetpixel = ggetpixel, + .gint_dhline = gint_ghline, + .gint_dvline = gint_gvline, + .dtext_opt = gtext_opt, + .dsubimage = gsubimage, +}; +static struct rendering_mode const gray_exit_mode = { + .dupdate = gupdate, + .dclear = NULL, + .drect = NULL, + .dpixel = NULL, + .dgetpixel = NULL, + .gint_dhline = NULL, + .gint_dvline = NULL, + .dtext_opt = NULL, + .dsubimage = NULL, +}; + +//--- +// Engine control (init/quit and start/stop) +//--- + +static int gray_int(void); +static void gray_quit(void); + +/* gray_isinit(): Check whether the engine is initialized and ready to run */ +static int gray_isinit(void) +{ + return (vrams[0] && vrams[1] && vrams[2] && vrams[3] && timer >= 0); +} + + +bool dvram_init_gray( void ) +{ + int const MARGIN = 32; + + /* Leave MARGIN bytes on each side of the region; this enables some + important optimizations in the image renderer. We also add another + 32 bytes so we can manually 32-align the region */ + uint32_t region = (uint32_t)kmalloc(DWIDTH*DHEIGHT*2 + MARGIN*2 + 32, +#if !defined(GINT_NO_OS_STACK) + "_ostk" +#else + NULL +#endif + ); + if(region == 0) + return false; + + /* 32-align the region */ + region = (region + 31) & -32; + /* Skip a MARGIN */ + region += MARGIN; + /* Use an uncached address */ + region = (region & 0x1fffffff) | 0xa0000000; + + /* Don't enable triple buffering by default */ + cg_vram_gray = (void *)region; + return true; +} + + + +/* gray_init(): Initialize the engine + This is done at startup so that memory can be reserved very early from the + heap (because not having enough memory is unrecoverable for the engine). */ +GCONSTRUCTOR static void gray_init(void) +{ + /* We need four VRAMs. First use the standard monochrome one */ + vrams[0] = gint_vram; + + #ifdef GINT_STATIC_GRAY + vrams[1] = gvrams[0]; + vrams[2] = gvrams[1]; + vrams[3] = gvrams[2]; + #else + vrams[1] = malloc(1024); + vrams[2] = malloc(1024); + vrams[3] = malloc(1024); + #endif /* GINT_STATIC_GRAY */ + + /* Default delays from Graph 35+E II are different from other models */ + if(gint[HWCALC] == HWCALC_G35PE2) + { + delays[0] = 762; + delays[1] = 1311; + } + else + { + delays[0] = 923; + delays[1] = 1742; + } + + dvram_init_gray(); + + /* Try to obtain the timer right away */ + timer = timer_configure(GRAY_TIMER | GRAY_CLOCK, 1000, + GINT_CALL(gray_int)); + + /* On failure, release the resources that we obtained */ + if(!gray_isinit()) gray_quit(); +} + +/* gray_quit(): Free engine resources */ +GDESTRUCTOR static void gray_quit(void) +{ + #ifndef GINT_STATIC_GRAY + if(vrams[1]) free(vrams[1]); + if(vrams[2]) free(vrams[2]); + if(vrams[3]) free(vrams[3]); + + vrams[1] = NULL; + vrams[2] = NULL; + vrams[3] = NULL; + #endif /* GINT_STATIC_GRAY */ + + if(timer >= 0) timer_stop(timer); + timer = -1; +} + +/* gray_start(): Start the gray engine */ +static void gray_start(void) +{ + st = 2; + timer_reload(GRAY_TIMER, delays[0]); + timer_start(GRAY_TIMER); + runs = 1; +} + +/* gray_stop(): Stop the gray engine */ +static void gray_stop(void) +{ + timer_pause(GRAY_TIMER); + runs = 0; + st = 0; +} + +//--- +// Dynamic udpate and rendering mode +//--- + +/* dgray(): Start or stop the gray engine at the next dupdate() */ +int dgray(int mode) +{ + /* Stack of states for the push modes */ + static uint8_t states[32] = { 0 }; + static uint8_t current = 0; + + if(mode == DGRAY_ON) + { + if(!gray_isinit()) return 1; + + /* Set the display module's alternate rendering mode to + override rendering functions to use their g*() variant */ + if(!dgray_enabled()) dmode = &gray_mode; + } + else if(mode == DGRAY_OFF) + { + /* Set the mode to a temporary one that only overrides + dupdate() so that we can stop the engine next frame */ + if(dgray_enabled()) dmode = &gray_exit_mode; + } + else if(mode == DGRAY_PUSH_ON) + { + if(current >= 32) return 1; + states[current++] = dgray_enabled() ? DGRAY_ON : DGRAY_OFF; + + return dgray(DGRAY_ON); + } + else if(mode == DGRAY_PUSH_OFF) + { + if(current >= 32) return 1; + states[current++] = dgray_enabled() ? DGRAY_ON : DGRAY_OFF; + + return dgray(DGRAY_OFF); + } + else if(mode == DGRAY_POP) + { + /* Stay at 0 if the user's push/pop logic is broken */ + if(current > 0) current--; + + /* Switch to previous state */ + return dgray(states[current]); + } + else return 1; + + return 0; +} + + +#define C_RGB(r,g,b) (((r) << 11) | ((g) << 6) | (b)) + + +inline gdrawupscale( int x, int y, int color ) +{ + int u=y*396*3; + int v=x*3; + + uint16_t colorcg; + + if (color==C_WHITE) colorcg=0xFFFF; + else if (color==C_LIGHT) colorcg=C_RGB(20,20,20); + else if (color==C_DARK) colorcg=C_RGB(10,10,10); + else colorcg=0x0000; + + int baseindex = (396*16+6+v+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black + cg_vram_gray[baseindex] = colorcg; + cg_vram_gray[baseindex+1] = colorcg; + cg_vram_gray[baseindex+2] = colorcg; + + baseindex+=396; + cg_vram_gray[baseindex] = colorcg; + cg_vram_gray[baseindex+1] = colorcg; + cg_vram_gray[baseindex+2] = colorcg; + + baseindex+=396; + cg_vram_gray[baseindex] = colorcg; + cg_vram_gray[baseindex+1] = colorcg; + cg_vram_gray[baseindex+2] = colorcg; +} + + +/* gray_int(): Interrupt handler */ +int gray_int(void) +{ + //t6k11_display(vrams[st ^ 2], 0, 64, 16); + timer_reload(GRAY_TIMER, delays[(st ^ 3) & 1]); + + st ^= 1; + + return TIMER_CONTINUE; +} + +/* gupdate(): Push the current VRAMs to the screen */ +int gupdate(void) +{ + /* At the first gupdate(), start the engine */ + if(dmode == &gray_mode && !runs) + { + gray_start(); + return 0; + } + /* At the last gupdate(), stop the engine */ + if(dmode == &gray_exit_mode) + { + gray_stop(); + dmode = NULL; + return 1; + } + + + + for( int j=0; j Date: Fri, 17 Mar 2023 21:07:12 +0100 Subject: [PATCH 06/12] minors fixes --- src/gray/engine_fxascg.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gray/engine_fxascg.c b/src/gray/engine_fxascg.c index 80a7ec0..eac432c 100644 --- a/src/gray/engine_fxascg.c +++ b/src/gray/engine_fxascg.c @@ -233,9 +233,6 @@ int dgray(int mode) } -#define C_RGB(r,g,b) (((r) << 11) | ((g) << 6) | (b)) - - inline gdrawupscale( int x, int y, int color ) { int u=y*396*3; @@ -243,10 +240,11 @@ inline gdrawupscale( int x, int y, int color ) uint16_t colorcg; - if (color==C_WHITE) colorcg=0xFFFF; - else if (color==C_LIGHT) colorcg=C_RGB(20,20,20); - else if (color==C_DARK) colorcg=C_RGB(10,10,10); - else colorcg=0x0000; + if (color==0b00) colorcg=0xFFFF; + else if (color==0b01) colorcg=0xAD55; + else if (color==0b10) colorcg=0x528A; + else if (color==0b11) colorcg=0x0000; + else color=0xf800; // unrecognized pixels are red int baseindex = (396*16+6+v+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black cg_vram_gray[baseindex] = colorcg; @@ -295,11 +293,21 @@ int gupdate(void) + uint32_t *light, *dark; + dgray_getvram(&light, &dark); + for( int j=0; j> 5); + uint32_t mask = 1 << (~i & 31); + int l = (light[offset] & mask) !=0 ? 1 : 0; + int d = (dark [offset] & mask) !=0 ? 1 : 0; + + int color = (d << 1) | l; + + gdrawupscale( i, j, color ); // really not optimised; just to check if OK } } -- 2.45.0 From e5ca6c0fe537eb04e494e7eb27d4fb256013c4f6 Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Fri, 17 Mar 2023 22:41:44 +0100 Subject: [PATCH 07/12] corrected dupdate redirection as per dmode (normal / gray engine) - gray engine now woking on FX9860G_AS_CG target --- CMakeLists.txt | 2 +- src/render-fxascg/dupdate.c | 53 ++++++++++++++++++--- src/{gray => render-fxascg}/engine_fxascg.c | 29 ++++++++++- 3 files changed, 75 insertions(+), 9 deletions(-) rename src/{gray => render-fxascg}/engine_fxascg.c (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4309d58..a248ede 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,7 @@ set(SOURCES_CG set(SOURCES_FXASCG # Gray engine - src/gray/engine_fxascg.c + src/render-fxascg/engine_fxascg.c src/gray/gclear.c src/gray/ggetpixel.c src/gray/gint_gline.c diff --git a/src/render-fxascg/dupdate.c b/src/render-fxascg/dupdate.c index 545625e..af4e11d 100644 --- a/src/render-fxascg/dupdate.c +++ b/src/render-fxascg/dupdate.c @@ -81,16 +81,55 @@ inline drawupscale( int x, int y, int color ) /* dupdate(): Push the video RAM to the display driver */ void dupdate(void) { + bool run_default = true; - for( int j=0; jdupdate) + { + /* Call the overridden dupdate(), but continue if it returns + non-zero (this is used when stopping the gray engine) */ + int rc = dmode->dupdate(); + run_default = (rc != 0); + } + + if(run_default) + { + for( int j=0; j Date: Tue, 21 Mar 2023 21:16:31 +0100 Subject: [PATCH 08/12] removed vram switch and timer for fx-as-cg build target --- CMakeLists.txt | 2 +- src/render-fxascg/engine_fxascg.c | 142 +++++++++++------------------- 2 files changed, 53 insertions(+), 91 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a248ede..507273f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,6 @@ set(SOURCES_CG set(SOURCES_FXASCG # Gray engine - src/render-fxascg/engine_fxascg.c src/gray/gclear.c src/gray/ggetpixel.c src/gray/gint_gline.c @@ -272,6 +271,7 @@ set(SOURCES_FXASCG src/render-fx/topti.c #special dupdate functions to treat a FX VRAM and convert to a CG VRAM src/render-fxascg/dupdate.c + src/render-fxascg/engine_fxascg.c # R61524 driver as we are working with a CG50 src/r61524/r61524.c ) diff --git a/src/render-fxascg/engine_fxascg.c b/src/render-fxascg/engine_fxascg.c index 8174e65..2887bd8 100644 --- a/src/render-fxascg/engine_fxascg.c +++ b/src/render-fxascg/engine_fxascg.c @@ -6,7 +6,7 @@ #include #include #include -#include +//#include #include @@ -15,27 +15,27 @@ /* Three additional video RAMS, allocated statically if --static-gray was set at configure time, or with malloc() otherwise. */ #ifdef GINT_STATIC_GRAY -GBSS static uint32_t gvrams[3][256]; +GBSS static uint32_t gvrams[1][256]; #endif uint16_t *cg_vram_gray; /* Four VRAMs: two to draw and two to display */ -static uint32_t *vrams[4] = { NULL, NULL, NULL, NULL }; +static uint32_t *vrams[2] = { NULL, NULL }; -/* Current VRAM pair used for drawing; the value can either be 0 (draws to - VRAMs 0 and 1) or 2 (draws to VRAMs 2 and 3). */ -static int volatile st = 0; /* Timer ID, always equal to GRAY_TIMER except if initialization fails */ -static int timer = -1; +//static int timer = -1; /* Whether the engine is scheduled to run at the next frame */ static int runs = 0; /* Underlying timer, set to count at P_phi/64 */ -#define GRAY_TIMER 0 -#define GRAY_CLOCK TIMER_Pphi_64 +//#define GRAY_TIMER 0 +//#define GRAY_CLOCK TIMER_Pphi_64 /* Delays of the light and dark frames for the above setting */ -GBSS static int delays[2]; +//GBSS static int delays[2]; + +extern struct rendering_mode const *dmode; + /* The alternate rendering mode structure used to override d*() */ static struct rendering_mode const gray_mode = { @@ -65,13 +65,14 @@ static struct rendering_mode const gray_exit_mode = { // Engine control (init/quit and start/stop) //--- -static int gray_int(void); +//static int gray_int(void); static void gray_quit(void); /* gray_isinit(): Check whether the engine is initialized and ready to run */ static int gray_isinit(void) { - return (vrams[0] && vrams[1] && vrams[2] && vrams[3] && timer >= 0); + //return (vrams[0] && vrams[1] && vrams[2] && vrams[3] && timer >= 0); + return (vrams[0] && vrams[1] >= 0); } @@ -116,32 +117,12 @@ GCONSTRUCTOR static void gray_init(void) #ifdef GINT_STATIC_GRAY vrams[1] = gvrams[0]; - vrams[2] = gvrams[1]; - vrams[3] = gvrams[2]; #else vrams[1] = malloc(1024); - vrams[2] = malloc(1024); - vrams[3] = malloc(1024); #endif /* GINT_STATIC_GRAY */ - /* Default delays from Graph 35+E II are different from other models */ - if(gint[HWCALC] == HWCALC_G35PE2) - { - delays[0] = 762; - delays[1] = 1311; - } - else - { - delays[0] = 923; - delays[1] = 1742; - } - dvram_init_gray(); - /* Try to obtain the timer right away */ - timer = timer_configure(GRAY_TIMER | GRAY_CLOCK, 1000, - GINT_CALL(gray_int)); - /* On failure, release the resources that we obtained */ if(!gray_isinit()) gray_quit(); } @@ -151,33 +132,20 @@ GDESTRUCTOR static void gray_quit(void) { #ifndef GINT_STATIC_GRAY if(vrams[1]) free(vrams[1]); - if(vrams[2]) free(vrams[2]); - if(vrams[3]) free(vrams[3]); - vrams[1] = NULL; - vrams[2] = NULL; - vrams[3] = NULL; #endif /* GINT_STATIC_GRAY */ - - if(timer >= 0) timer_stop(timer); - timer = -1; } /* gray_start(): Start the gray engine */ static void gray_start(void) { - st = 2; - timer_reload(GRAY_TIMER, delays[0]); - timer_start(GRAY_TIMER); runs = 1; } /* gray_stop(): Stop the gray engine */ static void gray_stop(void) { - timer_pause(GRAY_TIMER); runs = 0; - st = 0; } //--- @@ -232,47 +200,46 @@ int dgray(int mode) return 0; } - -inline gdrawupscale( int x, int y, int color ) +/* convert the gray scale into RGB565 and draw in the virutal VRAMthe 3x3 pixels upscaled and centered */ +inline gdrawupscale( int x, int y, int color_fx ) { int u=y*396*3; int v=x*3; - uint16_t colorcg; + uint16_t color_cg; - if (color==0b00) colorcg=0xFFFF; - else if (color==0b01) colorcg=0xAD55; - else if (color==0b10) colorcg=0x528A; - else if (color==0b11) colorcg=0x0000; - else color=0xf800; // unrecognized pixels are red + if (color_fx==C_WHITE) color_cg=0xFFFF; + else if (color_fx==C_LIGHT) color_cg=0xAD55; + else if (color_fx==C_DARK) color_cg=0x528A; + else color_cg=0x0000; int baseindex = (396*16+6+v+u); // 16 lines on top/bottom remain black and 6 columns on left/right remain black - cg_vram_gray[baseindex] = colorcg; - cg_vram_gray[baseindex+1] = colorcg; - cg_vram_gray[baseindex+2] = colorcg; + cg_vram_gray[baseindex] = color_cg; // draw 3 pixels side by side + cg_vram_gray[baseindex+1] = color_cg; + cg_vram_gray[baseindex+2] = color_cg; - baseindex+=396; - cg_vram_gray[baseindex] = colorcg; - cg_vram_gray[baseindex+1] = colorcg; - cg_vram_gray[baseindex+2] = colorcg; + baseindex+=396; // same for the line below (line #2) + cg_vram_gray[baseindex] = color_cg; + cg_vram_gray[baseindex+1] = color_cg; + cg_vram_gray[baseindex+2] = color_cg; - baseindex+=396; - cg_vram_gray[baseindex] = colorcg; - cg_vram_gray[baseindex+1] = colorcg; - cg_vram_gray[baseindex+2] = colorcg; + baseindex+=396; // same for the line below (line #3) + cg_vram_gray[baseindex] = color_cg; + cg_vram_gray[baseindex+1] = color_cg; + cg_vram_gray[baseindex+2] = color_cg; } /* gray_int(): Interrupt handler */ -int gray_int(void) -{ - //t6k11_display(vrams[st ^ 2], 0, 64, 16); - timer_reload(GRAY_TIMER, delays[(st ^ 3) & 1]); - - st ^= 1; - - return TIMER_CONTINUE; -} +//int gray_int(void) +//{ +// //t6k11_display(vrams[st ^ 2], 0, 64, 16); +// timer_reload(GRAY_TIMER, delays[(st ^ 3) & 1]); +// +// st ^= 1; +// +// return TIMER_CONTINUE; +//} /* gupdate(): Push the current VRAMs to the screen */ int gupdate(void) @@ -293,7 +260,7 @@ int gupdate(void) uint32_t *light, *dark; - dgray_getvram(&light, &dark); + dgray_getscreen(&light, &dark); for( int j=0; j Date: Wed, 22 Mar 2023 21:04:10 +0100 Subject: [PATCH 09/12] bug resolved --- src/render-fxascg/engine_fxascg.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/render-fxascg/engine_fxascg.c b/src/render-fxascg/engine_fxascg.c index 2887bd8..aedd5ed 100644 --- a/src/render-fxascg/engine_fxascg.c +++ b/src/render-fxascg/engine_fxascg.c @@ -6,7 +6,6 @@ #include #include #include -//#include #include @@ -20,20 +19,12 @@ GBSS static uint32_t gvrams[1][256]; uint16_t *cg_vram_gray; -/* Four VRAMs: two to draw and two to display */ +/* two VRAMs: two to draw and two to display */ static uint32_t *vrams[2] = { NULL, NULL }; -/* Timer ID, always equal to GRAY_TIMER except if initialization fails */ -//static int timer = -1; /* Whether the engine is scheduled to run at the next frame */ static int runs = 0; -/* Underlying timer, set to count at P_phi/64 */ -//#define GRAY_TIMER 0 -//#define GRAY_CLOCK TIMER_Pphi_64 -/* Delays of the light and dark frames for the above setting */ -//GBSS static int delays[2]; - extern struct rendering_mode const *dmode; @@ -248,10 +239,9 @@ int gupdate(void) if(dmode == &gray_mode && !runs) { gray_start(); - return 0; } /* At the last gupdate(), stop the engine */ - if(dmode == &gray_exit_mode) + else if(dmode == &gray_exit_mode) { gray_stop(); dmode = NULL; -- 2.45.0 From f4e5b0f91c02e49185e0e11c18442ff399afe58c Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Wed, 22 Mar 2023 22:29:29 +0100 Subject: [PATCH 10/12] addin upscaling now supports usb bulk transfert for screenshot and video capture (of course also text output) --- CMakeLists.txt | 2 ++ include/gint/usb-ff-bulk.h | 36 ++++++++++++++++++++++------------ src/usb/classes/ff-bulk-gray.c | 2 +- src/usb/classes/ff-bulk.c | 4 ++-- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 507273f..268ba19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,6 +274,8 @@ set(SOURCES_FXASCG src/render-fxascg/engine_fxascg.c # R61524 driver as we are working with a CG50 src/r61524/r61524.c + + src/usb/classes/ff-bulk-gray.c ) set(ASSETS_FX diff --git a/include/gint/usb-ff-bulk.h b/include/gint/usb-ff-bulk.h index 2d962b5..24fe352 100644 --- a/include/gint/usb-ff-bulk.h +++ b/include/gint/usb-ff-bulk.h @@ -44,12 +44,6 @@ extern usb_interface_t const usb_ff_bulk; // Sending standard messages //--- -/* usb_fxlink_text(): Send raw text - Send a string; fxlink will display it in the terminal. This can be used to - back stdout/stderr. Sending lots of small messages can be slow; if that's a - problem, fill in message manually. If size is 0, uses strlen(text). */ -void usb_fxlink_text(char const *text, int size); - /* usb_fxlink_screenshot(): Take a screenshot This function sends a copy of the VRAM to fxlink. This is best used just @@ -63,6 +57,27 @@ void usb_fxlink_text(char const *text, int size); display (it's usually slow and currently not even implemented). */ void usb_fxlink_screenshot(bool onscreen); +#if defined(FX9860G) || defined(FX9860G_AS_CG) +/* usb_fxlink_screenshot_gray(): Take a gray screenshot on fx-9860G + + This function is similar to usb_fxlink_screenshot(), but it takes a gray + screenshot. It depends on the gray engine so if you use your add-in will + automatically have the gray engine, that's why it's separate. */ +void usb_fxlink_screenshot_gray(bool onscreen); +#endif + +/* usb_fxlink_text(): Send raw text + + This function sends a string with the "text" type, which fxlink prints on + the terminal. It will send a full fxlink message (with a commit), which is + inefficient if there is a lot of text to send. For better speed, send the + message manually by filling the header and doing the writes and commit + manually. + + This function sends the text by blocks of 4 bytes or 2 bytes when alignment + and size allow, and 1 byte otherwise. If size is 0, strlen(text) is used. */ +void usb_fxlink_text(char const *text, int size); + /* usb_fxlink_videocapture(): Send a frame for a video recording This function is essentially the same as usb_fxlink_screenshot(). It sends a @@ -74,12 +89,9 @@ void usb_fxlink_screenshot(bool onscreen); automatically send new frames to fxlink. */ void usb_fxlink_videocapture(bool onscreen); -#ifdef FX9860G -/* Similar to usb_fxlink_screenshot(), but takes a gray screenshot if the gray - engine is currently running. */ -void usb_fxlink_screenshot_gray(bool onscreen); - -/* Like usb_fxlink_videocapture(), but uses VRAM data from the gray engine. */ +#if defined(FX9860G) || defined(FX9860G_AS_CG) +/* usb_fxlink_videocapture_gray(): Send a gray frame for a video recording + Like usb_fxlink_videocapture(), but uses VRAM data from the gray engine. */ void usb_fxlink_videocapture_gray(bool onscreen); #endif diff --git a/src/usb/classes/ff-bulk-gray.c b/src/usb/classes/ff-bulk-gray.c index aab01e8..829423f 100644 --- a/src/usb/classes/ff-bulk-gray.c +++ b/src/usb/classes/ff-bulk-gray.c @@ -1,4 +1,4 @@ -#ifdef FX9860G +#if defined(FX9860G) || defined(FX9860G_AS_CG) #include #include diff --git a/src/usb/classes/ff-bulk.c b/src/usb/classes/ff-bulk.c index c90af33..3ecd1c5 100644 --- a/src/usb/classes/ff-bulk.c +++ b/src/usb/classes/ff-bulk.c @@ -104,12 +104,12 @@ static void capture_vram(GUNUSED bool onscreen, char const *type) void *source = gint_vram; int size, format; - #ifdef FX9860G + #if defined(FX9860G) || defined(FX9860G_AS_CG) size = 1024; format = USB_FXLINK_IMAGE_MONO; #endif - #ifdef FXCG50 + #if defined(FXCG50) && !defined(FX9860G_AS_CG) if(onscreen) { uint16_t *main, *secondary; dgetvram(&main, &secondary); -- 2.45.0 From 2e5f99a9969123cf8e22f440a6342a55e0719247 Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Thu, 23 Mar 2023 21:07:15 +0100 Subject: [PATCH 11/12] update of README.md --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index f5dda44..16e17e6 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,22 @@ The available options are: % fxsdk build-cg install ``` +**"Cross-Building" a fx-9860G II project for fx-CG 50** + +fx-9860G II sources can be automatically converted to run on fx-CG 50, provided no +low level function/specific hardware manipulation/or syscall is used by the program. + +The command is very similar to fx-9860G II one, except it is `fxsdk build-fx-as-cg` +instead of `fxsdk build-fx`. + +The available options are: + +``` +% fxsdk build-fx-as-cg +% fxsdk build-fx-as-cg install +``` + + ## Using in CMake-based add-ins Find the `Gint` module and link against `Gint::Gint`. gint declares the include @@ -125,6 +141,10 @@ using the fxSDK, you will need to: * Link with `-T fx9860g.ld -lgint-fx -lopenlibm -lc` on fx-9860G; * Link with `-T fxcg50.ld -lgint-cg -lopenlibm -lc` on fx-CG 50. +Manually building a fx-9860G project to run on a fx-CG50 can be done : +* Build with `-m4-nofpu -mb -DFXCG50 -DFX9860G_AS_CG`; +* Link with `-T fxcg50.ld -lgint-fxascg -lopenlibm -lc`. + If you don't have a standard library such as [Memallox's port of newlib](/PlaneteCasio/libc), you also need `-nostdlib`. I typically use `-m3 -mb` or `-m4-nofpu -mb` to specify the platform, but that -- 2.45.0 From 3edb80018ca2fdb75fd630f391ebb72eebdc7500 Mon Sep 17 00:00:00 2001 From: Lephe Date: Thu, 21 Mar 2024 19:08:14 +0100 Subject: [PATCH 12/12] quick fixes and definitely a few bugs in there --- CMakeLists.txt | 6 +++--- include/gint/config.h.in | 8 ++++++-- src/render-fxascg/dupdate.c | 10 +++++----- src/render-fxascg/engine_fxascg.c | 6 ++++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 268ba19..4d02144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,14 +312,14 @@ if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) ${LINKER_SCRIPTS}) endif() -if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_AS_CG) +if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A) add_compile_options(-DFXCG50) add_compile_definitions(FX9860G_AS_CG) - set(NAME "gint-fxascg") + set(NAME "gint-fxg3a") set(LINKER_SCRIPTS "${CMAKE_CURRENT_BINARY_DIR}/fxcg50.ld" "${CMAKE_CURRENT_BINARY_DIR}/fxcg50_fastload.ld") - add_library(gint-fxascg STATIC ${SOURCES_COMMON} ${SOURCES_FXASCG} ${ASSETS_FX} + add_library(gint-fxg3a STATIC ${SOURCES_COMMON} ${SOURCES_FXASCG} ${ASSETS_FX} ${LINKER_SCRIPTS}) endif() diff --git a/include/gint/config.h.in b/include/gint/config.h.in index 6e3d500..347e29c 100644 --- a/include/gint/config.h.in +++ b/include/gint/config.h.in @@ -20,7 +20,7 @@ #if defined(FX9860G) # define GINT_HW_FX 1 # define GINT_HW_CG 0 -#elif defined(FXCG50) +#elif defined(FXCG50) || defined(FX9860G_AS_CG) # define GINT_HW_FX 0 # define GINT_HW_CG 1 #endif @@ -57,6 +57,10 @@ /* GINT_RENDER_DMODE: Selects whether the dmode override is available on rendering functions. */ -#define GINT_RENDER_DMODE GINT_HW_FX +#if defined(FX9860G_AS_CG) +# define GINT_RENDER_DMODE 1 +#else +# define GINT_RENDER_DMODE GINT_HW_FX +#endif #endif /* GINT_CONFIG */ diff --git a/src/render-fxascg/dupdate.c b/src/render-fxascg/dupdate.c index af4e11d..6d97813 100644 --- a/src/render-fxascg/dupdate.c +++ b/src/render-fxascg/dupdate.c @@ -2,7 +2,7 @@ #include #include #include -#include "../render-fx/render-fx.h" +#include "../render/render.h" /* The destination VRAM for upscaling + centering + conversion B&W --> 16bits RGB565 */ uint16_t *cg_vram; // set to 0 at initialisation @@ -48,11 +48,11 @@ bool dvram_init( void ) void dgetvram(uint16_t **ptr_vram_1, uint16_t **ptr_vram_2) { - if(ptr_vram_1) *ptr_vram_1 = &cg_vram; - if(ptr_vram_2) *ptr_vram_2 = &cg_vram; + if(ptr_vram_1) *ptr_vram_1 = cg_vram; + if(ptr_vram_2) *ptr_vram_2 = cg_vram; } -inline drawupscale( int x, int y, int color ) +void drawupscale( int x, int y, int color ) { int u=y*396*3; int v=x*3; @@ -134,4 +134,4 @@ void dupdate(void) gint_call(dupdate_get_hook()); } __attribute__((alias("dupdate"))) -void _WEAK_dupdate(void); \ No newline at end of file +void _WEAK_dupdate(void); diff --git a/src/render-fxascg/engine_fxascg.c b/src/render-fxascg/engine_fxascg.c index aedd5ed..00ce56c 100644 --- a/src/render-fxascg/engine_fxascg.c +++ b/src/render-fxascg/engine_fxascg.c @@ -6,9 +6,11 @@ #include #include #include +#include #include +#include "../render/render.h" #include "../render-fx/render-fx.h" /* Three additional video RAMS, allocated statically if --static-gray was set @@ -63,7 +65,7 @@ static void gray_quit(void); static int gray_isinit(void) { //return (vrams[0] && vrams[1] && vrams[2] && vrams[3] && timer >= 0); - return (vrams[0] && vrams[1] >= 0); + return (vrams[0] && vrams[1]); } @@ -192,7 +194,7 @@ int dgray(int mode) } /* convert the gray scale into RGB565 and draw in the virutal VRAMthe 3x3 pixels upscaled and centered */ -inline gdrawupscale( int x, int y, int color_fx ) +void gdrawupscale( int x, int y, int color_fx ) { int u=y*396*3; int v=x*3; -- 2.45.0