corrected dupdate redirection as per dmode (normal / gray engine) - gray engine now woking on FX9860G_AS_CG target

This commit is contained in:
Sylvain PILLOT 2023-03-17 22:41:44 +01:00
parent e4653c0ace
commit fa7885a287
3 changed files with 75 additions and 9 deletions

View File

@ -243,7 +243,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

View File

@ -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; j<DHEIGHT; j++ ) // 64 lines
{
for( int i=0; i<DWIDTH; i++ ) // 128 column
if(dmode && dmode->dupdate)
{
/* 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<DHEIGHT; j++ ) // 64 lines
{
drawupscale( i, j, dgetpixel(i,j) ); // really not optimised; just to check if OK
}
}
for( int i=0; i<DWIDTH; i++ ) // 128 column
{
drawupscale( i, j, dgetpixel(i,j) ); // really not optimised; just to check if OK
}
}
r61524_display(cg_vram, 0, 224, R61524_DMA_WAIT );
//draw a black layer around the screen
int base1 = 0;
int base2 = (64*3+16)*396;
for(int u = 0; u<16; u++)
{
for(int v = 0; v<396; v++)
{
cg_vram[base1+v] = 0;
cg_vram[base2+v] = 0;
}
base1+=396;
base2+=396;
}
base1 = 16*396;
base2 = 16*396+6+128*3;
for(int u = 0; u<64*3; u++)
{
for(int v = 0; v<6; v++)
{
cg_vram[base1+v] = 0;
cg_vram[base2+v] = 0;
}
base1+=396;
base2+=396;
}
r61524_display(cg_vram, 0, 224, R61524_DMA_WAIT );
}
gint_call(dupdate_get_hook());
}

View File

@ -292,7 +292,6 @@ int gupdate(void)
}
uint32_t *light, *dark;
dgray_getvram(&light, &dark);
@ -311,6 +310,34 @@ int gupdate(void)
}
}
//draw a black layer around the screen
int base1 = 0;
int base2 = (64*3+16)*396;
for(int u = 0; u<16; u++)
{
for(int v = 0; v<396; v++)
{
cg_vram_gray[base1+v] = 0;
cg_vram_gray[base2+v] = 0;
}
base1+=396;
base2+=396;
}
base1 = 16*396;
base2 = 16*396+6+128*3;
for(int u = 0; u<64*3; u++)
{
for(int v = 0; v<6; v++)
{
cg_vram_gray[base1+v] = 0;
cg_vram_gray[base2+v] = 0;
}
base1+=396;
base2+=396;
}
r61524_display(cg_vram_gray, 0, 224, R61524_DMA_WAIT );
/* When the engine is running, swap frames */